ZZT-OOP questions

NOTE: I HATE A LOT OF YOUR ZZT GAMES, SO WATCH OUT!

Moderators: Commodore, Zenith Nadir

User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post by meldels »

Is nogems a variable that's already in the game?
User avatar
Saxxon
the Gargoyle.
Posts: 608
Joined: Tue Jul 25, 2006 10:02 am
Contact:

Re: ZZT-OOP questions

Post 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.
User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post by meldels »

Oh that's great, you can't take negative quantity though?
User avatar
Saxxon
the Gargoyle.
Posts: 608
Joined: Tue Jul 25, 2006 10:02 am
Contact:

Re: ZZT-OOP questions

Post 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.
User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post 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.
User avatar
Saxxon
the Gargoyle.
Posts: 608
Joined: Tue Jul 25, 2006 10:02 am
Contact:

Re: ZZT-OOP questions

Post 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.
User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post by meldels »

Is it possible to set a board/world resource limit?
User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post 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
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: ZZT-OOP questions

Post 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.
*POW* *CLANK* *PING*
User avatar
Saxxon
the Gargoyle.
Posts: 608
Joined: Tue Jul 25, 2006 10:02 am
Contact:

Re: ZZT-OOP questions

Post 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?
User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post 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.
User avatar
Quantum P.
Level 17 Accordion Thief
Posts: 1433
Joined: Fri Sep 12, 2003 1:41 am
Location: Edmonds, WA
Contact:

Re: ZZT-OOP questions

Post 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.
User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post 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?
User avatar
Saxxon
the Gargoyle.
Posts: 608
Joined: Tue Jul 25, 2006 10:02 am
Contact:

Re: ZZT-OOP questions

Post 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.
User avatar
Schroedingers Cat
We must invent teleportation!
Posts: 721
Joined: Mon Jun 19, 2006 11:35 pm
Location: Idaho, Wisconsin

Re: ZZT-OOP questions

Post 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.
Post Reply