Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

While Loops

9 years ago

Is there a list of the syntax of this scripting language? I'm trying to create a fighting system and I need the syntax for a while loop

While Loops

9 years ago
Unfortunately we only have the basic if, and else statement. Making something like the while loop would definitely be nice, but it's advance. However, if you know JavaScript, you can definitely use that to make your own while loops.

While Loops

9 years ago

Is there anyway to make a pseudo while loop with proper scripting? Can't think of any

While Loops

9 years ago
Using JavaScript? Yes. Unfortunately I'm more advance in PHP than JavaScript, so I'm afraid I can't help you there. However, there is this guy with a snail's avatar from a while back...And Bradin.

While Loops

9 years ago

Wait you can use JavaScript here? Im confused.

While Loops

9 years ago

Yeah.

This is the guy with the snail as a profile pic by the way.
http://chooseyourstory.com/forums/advanced-editor-forum/message/15917

So that's evidence that it works in storygames, and I think brads profile uses JavaScript, though I honestly have no clue. I'm pretty sure it works just about anywhere on here.

While Loops

9 years ago

While Loops

9 years ago
In a storygame, I would ask if a while loop would be the best option. Generally, in a while loop, especially in combat, you're going to keep going until something happens -- usually repeat until someone dies. With a storygame, wouldn't it make more sense to give the reader/player the option whether they want to keep going?

You could accomplish a similar thing by having a page that does something like display the stats (HP, whatever), then have two (or more) links that say something like, "Keep fighting" or "Flee." The "Keep fighting" link could lead to that very same page, and the page could have the combat at the start of the page so each time the player chooses to "keep fighting," the page will do one round of combat, then give the player the same options again.

Of course, the "flee" option could lead to another page, and you could put a simple IF statement in the page that determines which page to send the reader to when either their HP or the opponent's HP reach zero.

Or maybe that's not what you're trying to do...

While Loops

9 years ago

I suppose that works, I'm trying to use the fighting fantasy model of combat, if you ever played their games. I think your idea works, thanks