Page 1 of 1
n00b ZZT-OOP question about #give time
Posted: Sat Nov 17, 2007 10:52 pm
by Ian Plastic
Are there any differences between time and the other #give/#take items (health, ammo, etc)?
For example, if I create a game devoid of boards with a time limit, can time be used as just another counter, or does it act funny?
Posted: Sat Nov 17, 2007 11:38 pm
by Commodore
without zzt in front of me I can guess that if you set the the time it will start to countdown and then eventually hurt the player.
also in an odd twist you have to #take time to actually make the counter go up and #give time to take it.
Posted: Sun Nov 18, 2007 12:37 am
by gingermuffins
For example, if I create a game devoid of boards with a time limit, can time be used as just another counter, or does it act funny?
<s>I'm pretty sure that the time counter ticks down regardless of whether there's a limit set or not</s> (actually i don't know). It resets every time you travel between screens.
to my knowledge, the only use the time counter has (when not being used normally) is for checking if the player has just entered a board.
wil wrote:...In addition, if you're willing to do a bit of shit for it, the following are invaluable tools when developign unique inventory engines:
First: the "I know when you re-entered the board" trick. This trick is very useful because it uses the "time" variable, which nobody uses anyway.
Code: Select all
@checkingobject
#cycle 1
:enteredboard
#give time 16300
You have entered the board!
Whee!
Execute valuable entered board code here.
:loop
/i/i#take time 1 enteredboard
#loop
This code is most valuable because it happens completely behind the scenes. If you don't want to tell them, people won't even know their progress across boards is being tracked.
Posted: Sun Nov 18, 2007 1:19 am
by Ian Plastic
Thanks guys. Good to know.
Posted: Sun Nov 18, 2007 2:10 am
by gingermuffins
You could make use of the time counter if you had an object #take time 1 every second; that would cancel out the countdown and give you another big counter, albiet with restrictions. could be useful for an engine, though.
Posted: Sun Nov 18, 2007 2:57 am
by Ian Plastic
An RPG battle engine or some other one-board minigame, maybe. But the reason I asked in the first place was because I'm looking to make optimal use of as many universal (trans-board) counters as possible, so time doesn't interest me as much anymore. I'm sure I'll think of some place for it though.
Posted: Sun Nov 18, 2007 3:08 am
by Ian Plastic
Some food for thought, though. I believe that the countdown doesn't start if you mess with time.
I ran the following program:
#cycle 1
#give time 100
/i/i/i/i/i/i/i/i/i/i/i/i/i
#take time 99 bob
There is not a countdown.
#end
:bob
There is a countdown.
And it resulted in "There is not a countdown."
Posted: Tue Nov 20, 2007 6:51 am
by Commodore
i'm not sure you could ever get a message to be sent using #take with the time counter. this is a guess.
Posted: Tue Nov 20, 2007 8:22 am
by Dr. Dos
Maybe if you got the time over 32767.
Posted: Tue Nov 20, 2007 3:24 pm
by gingermuffins
the on enter trick uses '#take time 1 enteredboard' so it must work, only with a full counter instead of an empty one.
Posted: Tue Nov 20, 2007 5:52 pm
by Ian Plastic
You know what the enter board trick would be useful for?
If you wanted to play a short 5-second tune every time the player entered a city.
Posted: Sat Nov 24, 2007 12:26 pm
by Kjorteo
Actually, that's a really neat idea. I'd totally do that for Adventure of Sam if I knew the first thing about ZZT music.