Timers

GameBoy
01 Sept 2004, 05:57
I've set some timers into my game, but it seems that the script only runs once, and not every time the interval reaches 0.

define timer <food>
interval <20>
action {
msg <|bYou begin to feel hungry.|xb>
timeron <food_two>
timeroff <food>
}
enabled
end define

define timer <thirst>
interval <20>
action {
msg <|bYou begin to look parched.|xb>
timeron <thirst_two>
timeroff <thirst>
}
enabled
end define

define timer <food_two>
interval <10>
action {
set numeric <hp; -5>
msg <|bYou feel hungry.|xb>
}
disabled
end define

define timer <thirst_two>
interval <10>
action {
set numeric <hp; -5>
msg <|bYou feel thirsty.|xb>
}
disabled
end define


The timers work together, and once food has been eaten:

define room <Items>

define object <water>
alias <Water>
take
use {
msg <|bYou drink the water.|xb>
timeroff <thirst_two>
timeron <thirst>
}
end define

define object <Apple>
take
use {
msg <|bYou bite into the apple.|xb>
timeroff <food_two>
timeron <food>
}
end define

end define


That sends the main food/thirst timer back off again. I need it to take off 5 each time the timer hits 0 on food_two/thirst_two.

Once the HP reaches the 0 or less, the player will die.

GameBoy
01 Sept 2004, 06:01
FIXED

Instead of trying to minus the value each time, i simply used to decrement tag instead, like so:

		dec <hp; 5>

Alex
01 Sept 2004, 11:52
Yes, the problem was this syntax is incorrect:


set numeric <hp; -5>


should be


set numeric <hp; %hp%-5>

GameBoy
01 Sept 2004, 14:14
ahh yes now i remember! :roll: lol, thanks alex