Page 3 of 3

Re: ZZT-OOP questions

Posted: Wed Aug 15, 2012 5:02 pm
by meldels
Is nogems a variable that's already in the game?

Re: ZZT-OOP questions

Posted: Wed Aug 15, 2012 8:47 pm
by Saxxon
meldels wrote:Is nogems a variable that's already in the game?
Nogems is one of the labels in the code (:nogems).

The syntax for the #TAKE command:

Code: Select all

#TAKE <item> <quantity> <label>
Item can be any of the following: ammo, gems, score, time, health, torches.
Quantity is any positive number.
Label is for when this is not possible; the player does not have enough of the item desired.

Code: Select all

#TAKE HEALTH 10 NOPE
This tries to take 10 health from the player. If it succeeds, nothing else is done by this command. If the player does not have 10 health to take, it jumps to the :NOPE label.

Re: ZZT-OOP questions

Posted: Wed Aug 15, 2012 8:48 pm
by meldels
Oh that's great, you can't take negative quantity though?

Re: ZZT-OOP questions

Posted: Wed Aug 15, 2012 8:50 pm
by Saxxon
meldels wrote:Oh that's great, you can't take negative quantity though?
No. If you want to give some health to the player, you would use #GIVE instead. The syntax is the same. In either case, <label> is not required. Nobody really uses a label with #GIVE since it's almost always possible for the player to receive more of something.

Code: Select all

#GIVE GEMS 5
Gives 5 gems to the player.

Re: ZZT-OOP questions

Posted: Wed Aug 15, 2012 9:04 pm
by meldels
But it is possible to use a label with it? That gives me an idea, if there's something that gives you health, and you already have max health it could do something based on that. Not that it would be anything big, just for finishing touches I guess.

Re: ZZT-OOP questions

Posted: Wed Aug 15, 2012 9:26 pm
by Saxxon
meldels wrote:But it is possible to use a label with it? That gives me an idea, if there's something that gives you health, and you already have max health it could do something based on that. Not that it would be anything big, just for finishing touches I guess.
You CAN use a label with #GIVE. The limit for player resources is 32767. But unless this is likely in your game I don't think you'll really have to worry about it.

Re: ZZT-OOP questions

Posted: Thu Aug 16, 2012 12:16 am
by meldels
Is it possible to set a board/world resource limit?

Re: ZZT-OOP questions

Posted: Thu Aug 16, 2012 3:16 am
by meldels
sorry4doublepost; I have this strange issue with a vital object in my game. The error I'm getting is bad direction and I can't tell why.

Code: Select all

========OBJECT ONE=======
@bottom
#END
:GO
/n/n/n/n/n
#END

========OBJECT TWO=======
@middle
#END
:TOUCH
!START;START
!;NO
#END
:START
#TAKE 2 GEMS NOGEMS
#GO
:NOGEMS
Not enough gems.
#END
:GO
#SEND BOTTOM GO
/n/n/n/n/n
#END

Also, why doesn;t this code work?
/i/i/i/i/i
#CHANGE RED FAKE BLUE NORMAL

Re: ZZT-OOP questions

Posted: Thu Aug 16, 2012 3:04 pm
by Commodore
#go is an actual command, the short hand is the slash '/'
#try is similar, using a question mark '?'

so that bare #go command is looking for a direction after it. Change it to something else.

There is no way to set a maximum heath limit. There are ways around this of course.

@maxhealth
#cycle 1
:loop
/i
#take health 101 #loop
#endgame
#give health 100
#loop

If #take cannot take 101 health it takes nothing and loops. When the players health does go over 100, it executes and #endgame, which brings health to zero, then gives 100 back.

The #endgame trick is an old one. You won't get a game over if you give health right away.

I'm not sure what's wrong with the last bit.

Re: ZZT-OOP questions

Posted: Thu Aug 16, 2012 10:08 pm
by Saxxon

Code: Select all

/i/i/i/i/i
#CHANGE RED FAKE BLUE NORMAL
This actually looks good to me. What's it doing?

Re: ZZT-OOP questions

Posted: Thu Aug 16, 2012 11:42 pm
by meldels
My mistake I was tired when I wrote it, should say change invisible not change fake. Project I'm working on is near finished though.

Re: ZZT-OOP questions

Posted: Sat Aug 18, 2012 12:13 am
by Quantum P.
Saxxon wrote:You CAN use a label with #GIVE. The limit for player resources is 32767. But unless this is likely in your game I don't think you'll really have to worry about it.
I learn something every day.

Re: ZZT-OOP questions

Posted: Sun Aug 19, 2012 12:09 am
by meldels
There are 2 objects called A and I #send A:LABEL will LABEL be sent to both? Are there any other abbreviations (for colors or patterns?) or a repeat-last sort of command? Also how much memory does an EMPTY take compared to a FAKE? Because #PUT N FAKE Takes fewer bytes via text; however #PUT N EMPTY may be smaller in the fact that it just makes an empty. Also, is there a way to identify text solids for manipulation within code. e.g. #CHANGE PURPLE INVISIBLE 'B'. How do I change an objet's character?

Re: ZZT-OOP questions

Posted: Sun Aug 19, 2012 10:37 am
by Saxxon
meldels wrote:There are 2 objects called A and I #send A:LABEL will LABEL be sent to both?
Yes.
meldels wrote:Are there any other abbreviations (for colors or patterns?) or a repeat-last sort of command?
Not really, there's only one way to specify elements in the game. You can only use its full name.
meldels wrote:Also how much memory does an EMPTY take compared to a FAKE? Because #PUT N FAKE Takes fewer bytes via text; however #PUT N EMPTY may be smaller in the fact that it just makes an empty.
Since these two elements don't create stats, they take up the same amount ingame.
meldels wrote:Also, is there a way to identify text solids for manipulation within code. e.g. #CHANGE PURPLE INVISIBLE 'B'.
You can't use #CHANGE in that manner, and you can't reference another named object as a type. #CHANGE <anything> OBJECT nets you nothing as well- as a general rule of thumb, in ZZT, you can't create code from nothing.
meldels wrote:How do I change an objet's character?
An object can change its character using the #CHAR command. For example, #CHAR 1 makes it a smiley.

Re: ZZT-OOP questions

Posted: Sun Aug 19, 2012 11:03 pm
by Schroedingers Cat
Saxxon wrote:
meldels wrote:How do I change an objet's character?
An object can change its character using the #CHAR command. For example, #CHAR 1 makes it a smiley.
On that note, this might be of some interest.