Turn Scripts and Unsuccessful Turns

ezekieljd
I just recently made my first quest test game and posted it here: http://textadventures.co.uk/games/view/_nnvawqikkgijiwvwnl2vq/survival-in-siberia. Anyways, there was a comment that reminded me about this problem I had.

While this might be intentional, it was somewhat jarring when I lost health because the parser didn't get what I was trying to command it to do.



Basically, I set a turn script where every turn the person lost 2% health. But that means you lose health even if the program says "You can't do that" or something like that. How do I specify the turn script to ONLY be when a successful turn occurs? Is that even possible?

HegemonKhan
you're going to have to set up conditions (using the 'if' Script in your Turnscript), for when it is to reduce your life vs not, otherwise, it will remain as it is, reducing life after every action (the internal 'turn' coding of the quest engine) that you do.

~ OR (maybe) ~

I think Pixie (I think it was in one of his~her guides, anyways) used a Boolean Attribute or Variable called 'notarealturn', but I don't know if this was just a custom Boolean Attribute or Variable Pixie made or if it's an internal code command. If it's an internal code command, then you could use it (ask Pixie though on how to use it, as I'm not sure on how to), otherwise, if you want to set it up customly too, then again, ask Pixie for help, laughs.

The Pixie
Put something like this in your turn script so the turn count only increments if game.notarealturn is not true, and then resets game.notarealturn:
if (not game.notarealturn) {
game.turncount = game.turncount + 1
}
game.notarealturn = false

Then set up notarealturn as a boolean attribute on the game object and unresolvedcommandhandler as a script attribute. Quest will look to see if that script exists and call it if it does if the command is not recognised. Put this code in the script.
game.notarealturn = true

This system will catch all input that Quest has no idea how to handle, but not commands like DRINK HAT or WEAR COFFEE that make no sense to you or me, but that Quest will try to handle with default responses. Catching them is a much bigger job, and you need to flag when a command is successful, and then make sure that every good command sets the flag. It is doable, but much more work.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums