Is a counter acted on before or after a user command

To give you an example.
I have 6 bullets in gun.
Each time I shoot the gun a counter decreases giving me one less bullet in the gun
Now if the counter is a acted on before the users command then when the user shoots the gun a check is made on the bullet counter and if zero the user is told that he does not have any bullets to shoot the gun so the users command is not carried out.

If the counter is acted on after the users command the I'd need to set a flag to indictate that the gun is empty.

I know that turnscript acts on the script after the users command has been acted on it, but I don 't think there is a way for a script to act before the user has had his command acted on for every turn in the game.


What do you mean "acted on"?

When the user enters a command, the game runs the script for that command.

If the script for your 'shoot' command reduces the number of the bullets they have, the counter will be reduced when the script tells it to. It's entirely up to you which order you put the parts of the command in.

A typical shoot command might look like:

  • if you have ammo {
    • Shoot, do damage to an enemy, or whatever
    • Reduce the number of bullets
  • else {
    • Display a message saying you have no bullets

Quest doesn't "act on" a counter; counters change only when your script tells them to.
(If you mean a changescript for a counter, that will run as part of any command that changes the counter)


Sorry mrangel for the confusion.
I have tried programming with other text adventure compilers such as Inform, lads, etc and there has been actions with some text adventure compilers that are preformed before the users command is performed and there are actions that are preformed after the users command has been preformed (Turnscript for Quest). For actions that are preformed before a players command is preformed you could always do things such as check a counter before the players command is preformed. For example the 'light counter' as if the light runs out then the command is not preformed.
It seems the only way to do a check on the light counter for Quest is after the user command action has been preformed as you don't want the light counter checked as part of the script for every command you write a script for.

I see some strengths and weaknesses in all the text adventure compilers I've tried and the two that seem to work the best and are more adaptable to most situations are 'Quest' and 'Inform'. Quest tends to keep things grouped together better than what Inform does and having a graphical user interface helps to make things easier for the adventure writer.


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

Support

Forums