/    Sign up×
Community /Pin to ProfileBookmark

I’m haveing a lot of truble with the function’s.
anyone wanna help?
all I will need is someone to tell me how to set the function and run it.
I want my propmt and if to be run upon a function.

Please be warned I’m not exactly good at this.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@CharlesJul 12.2003 — [font=georgia]I need you to explain very clearly and in great detail exactly what it is that you want to happen. This is a lot harder than you might think and most people cannot get past this first hurdle but if you cannot explain things to a human you won't be able to explain things to a computer.[/font]
Copy linkTweet thisAlerts:
@scragarauthorJul 14.2003 — to run my game I wil need the user to pick a charcter type, this is what I have so far and what I want:
<i>
</i>RSP = prompt(USERNAME+" do you want to be a mage, theif or knight?","type theif, mage or knight");
if (RSP=="theif")
{TYPE=1};
else {
if(RSP=="mage")
{TYPE=2};
else{
if(RSP=="knight")
{TYPE=3};
else{
//I want it to run the alert bell9ow then restart this from the prompt.
alert("please re-enter your choice without capitals")
};};};

RSP, USERNAME and TYPE are all variable's defined earlier in this script(before I copied it from)

This will be changed afterward's when the file is running propely, to allow more choice's and a string search.
Copy linkTweet thisAlerts:
@CharlesJul 14.2003 — [font=monospace]<script type="text/javascript">

<!--

function getType () {

var ct = {theif:1, mage:2, knight:3} [prompt('Do you want to be a mage, theif or knight?','type theif, mage or knight').toLowerCase()];

if (ct) {return ct} else {alert ('Please enter a valid choice.'); return getType()};

}

alert (getType())

// -->

</script>[/font]
Copy linkTweet thisAlerts:
@scragarauthorJul 14.2003 — How about explaining what your doing to me?

that make's no sense to me.

and how about making any other resopnce forward them to the next function.

If you was to place it in the if's like I did it would be easier for me to understand and for whan I set it up for the main game.

The main game uses lot's of if's and set's to run the file, and I thought If someone could show me how to put this on a function I could loop it (upon the if's ending it would run the function again, untill they completed the game)

Please explain everything you do that I have not allready used.
×

Success!

Help @scragar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...