flags
Farvardin
07 Oct 2003, 16:26I wanted just a precision :
can it lead to errors if I don't declare a flag at the beginning of a game (in define game, startscript { etc...) and test this flag during the game ?
I think it won't, since the test is the check if the flag is present or not, but I want to be sure of this...
can it lead to errors if I don't declare a flag at the beginning of a game (in define game, startscript { etc...) and test this flag during the game ?
I think it won't, since the test is the check if the flag is present or not, but I want to be sure of this...
Alex
07 Oct 2003, 16:56There's no need to define a flag at the beginning of a game - since the only way you could would be to set it ON, which usually won't be sensible. So you can test for the presence of a flag which you've never mentioned before, without problems.
codingmasters
29 Oct 2003, 07:33Just on the topic of flags, what is the point of a flag? What is it designed to do?
Matthew G.
Matthew G.
MaDbRiT
29 Oct 2003, 13:28Matthew wrote
Facetious answer is 'whatever you want it to do'.
In fact you use flags as a convenient way to keep track of things during a game.
Say that you need your player to turn on the water supply to a hose before he can use the hose to extinguish a fire.
When the player turns on the water during the game you could (in code) set a flag called 'water_available'. Now you have a nice convenient way to test whether the player can fight the fire by checking to see if the flag 'water_available' is set. If set your player can fight the fire if not he can't.
'water_available' is thus indicating a true/false (or yes/no) state and is a sort of "signal flag" to the status of the water supply - so we call it a 'flag'
Hope that helps,
Al
Just on the topic of flags, what is the point of a flag? What is it designed to do?
Facetious answer is 'whatever you want it to do'.
In fact you use flags as a convenient way to keep track of things during a game.
Say that you need your player to turn on the water supply to a hose before he can use the hose to extinguish a fire.
When the player turns on the water during the game you could (in code) set a flag called 'water_available'. Now you have a nice convenient way to test whether the player can fight the fire by checking to see if the flag 'water_available' is set. If set your player can fight the fire if not he can't.
'water_available' is thus indicating a true/false (or yes/no) state and is a sort of "signal flag" to the status of the water supply - so we call it a 'flag'
Hope that helps,
Al
codingmasters
30 Oct 2003, 02:30Thanks Al
Matthew G.
Matthew G.