ZZT-OOP questions
Moderators: Commodore, Zenith Nadir
Re: ZZT-OOP questions
Is nogems a variable that's already in the game?
Re: ZZT-OOP questions
Nogems is one of the labels in the code (:nogems).meldels wrote:Is nogems a variable that's already in the game?
The syntax for the #TAKE command:
Code: Select all
#TAKE <item> <quantity> <label>
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
Re: ZZT-OOP questions
Oh that's great, you can't take negative quantity though?
Re: ZZT-OOP questions
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.meldels wrote:Oh that's great, you can't take negative quantity though?
Code: Select all
#GIVE GEMS 5
Re: ZZT-OOP questions
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
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.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.
Re: ZZT-OOP questions
Is it possible to set a board/world resource limit?
Re: ZZT-OOP questions
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.
Also, why doesn;t this code work?
/i/i/i/i/i
#CHANGE RED FAKE BLUE NORMAL
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
#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.
#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.
*POW* *CLANK* *PING*
Re: ZZT-OOP questions
Code: Select all
/i/i/i/i/i
#CHANGE RED FAKE BLUE NORMAL
Re: ZZT-OOP questions
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.
- Quantum P.
- Level 17 Accordion Thief
- Posts: 1433
- Joined: Fri Sep 12, 2003 1:41 am
- Location: Edmonds, WA
- Contact:
Re: ZZT-OOP questions
I learn something every day.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.
Re: ZZT-OOP questions
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
Yes.meldels wrote:There are 2 objects called A and I #send A:LABEL will LABEL be sent to both?
Not really, there's only one way to specify elements in the game. You can only use its full name.meldels wrote:Are there any other abbreviations (for colors or patterns?) or a repeat-last sort of command?
Since these two elements don't create stats, they take up the same amount ingame.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.
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:Also, is there a way to identify text solids for manipulation within code. e.g. #CHANGE PURPLE INVISIBLE 'B'.
An object can change its character using the #CHAR command. For example, #CHAR 1 makes it a smiley.meldels wrote:How do I change an objet's character?
- Schroedingers Cat
- We must invent teleportation!
- Posts: 721
- Joined: Mon Jun 19, 2006 11:35 pm
- Location: Idaho, Wisconsin
Re: ZZT-OOP questions
On that note, this might be of some interest.Saxxon wrote:An object can change its character using the #CHAR command. For example, #CHAR 1 makes it a smiley.meldels wrote:How do I change an objet's character?