ZZT-OOP questions

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

Moderators: Commodore, Zenith Nadir

User avatar
Schroedingers Cat
We must invent teleportation!
Posts: 721
Joined: Mon Jun 19, 2006 11:35 pm
Location: Idaho, Wisconsin

Re: Basic commands?

Post by Schroedingers Cat »

Saxxon wrote:* It is only necessary to use # at the very beginning of a line to mark it as a command. #IF BLOCKED N PUT N EMPTY is a perfectly valid command.
I thought Saxxon was being a LIAR, so I typed meldel's code verbatim. It didn't work. I noticed, however, that if I added just a carriage return to the first line, the code would work.

Anybody have any explanation? I'm confused as to why my code worked when it has :loop as the first line, while meldel's does not!

Attached is the board I experimented with.
Attachments
trebeck_2012.08.13.zip
SUCK IT, TREBECK
(962 Bytes) Downloaded 252 times
User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post by meldels »

I'd like to inform you that since I posted that code, I've changed and updated the object's code to be more efficient. Also how would I open a '.brd'.

Code: Select all

#CYCLE 1
:R
#IF ALLIGNED DO
/i
#R

:DO
WRONG WAY, YOU MONG.
/i/i/i/i/i
#R

:TOUCH
#BECOME GREEN FAKE
Also is there a way I could save on return characters here that I'm not realizing?
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 »

Yes:

Code: Select all

#CYCLE 1
:R
#IF ALLIGNED DO
/i#R
:DO
WRONG WAY, YOU MONG.
/i/i/i/i/i#R
:TOUCH
#BECOME GREEN FAKE
It looks a little uglier without some spacing to break up the code, but the player usually won't be looking at the code, so that's not too important. If you wanted to preserve the readability, /i#r would still work fine.

To open a .brd file, you need to import it through the editor. I'm pretty sure KevEdit has the same function, but I don't know what it is off the top of my head. In the default editor, you'd press "t" to "t"ransfer a board, and the select import (or export, if you wanted to transfer the selected board to a different world). Then, type in the name of the board (in this case, "trebeck"). Note that transferring a board will mess with passage destinations, so you'll need to manually set them if there are any present.

Something important that you might not know about (and likely wouldn't know about until it was too late) that that you must NEVER rename a ZZT world. You can change the extension just fine (temp.zzt -> temp.sav works flawlessly), but renaming the name part (temp.zzt -> temp2.zzt) will irretrievably corrupt your ZZT world, so DON'T DO IT. (temp.zzt -> temp2.zzt -> temp.zzt will still be broken!! ) If you must rename your ZZT world, do it from within the editor (save the world and type in a different name. note that you will have two copies of the world, each with different names).
Last edited by Schroedingers Cat on Tue Aug 14, 2012 3:49 am, edited 1 time in total.
User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post by meldels »

Okay, so can hashmarks come directly after labels on the same line? And do all characters take equal space?

EDIT: Also, new avatar and does ZZT have IRC?

EDIT II: I also see a problem in a lot of old ZZT games where the player leaves a black hole in a field of fakes, to fix this I always have an object near player with code:

Code: Select all

#CYCLE 3
:R
#IF NOT ALLIGNED DO
/i#R
:DO
#PUT W GREEN FAKE
#BECOME GREEN FAKE
Your thoughts? Is there a different way of doing this? And can I push the DO label's code and the IF statement together? AND is there a command for something like "GET COLOR NORTH" or "GET PATTERN NORTH"(Type of block)?
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: ZZT-OOP questions

Post by Commodore »

It doesn't necessarily have to be next to the hole it if you use #change empty green fake.
*POW* *CLANK* *PING*
User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post by meldels »

Good idea, but now that I think about it I might be using black spaces for something else.
User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post by meldels »

Does this code seem right? If not, what could I be doing differently?

Code: Select all

@Wonderful Chest
#END
#IF KEYHAVE DO
:TOUCH
A sealed chest lays before you.
#END
:DO
#ZAPTOUCH
#KEYHAVE=0
#END
:TOUCH
#BECOME PASSAGE
It's supposed to wait 'til the key value is 1, then become a passage when touched.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: ZZT-OOP questions

Post by Commodore »

First off, you can #become passage, but unfortunately the passage created will always lead to the titlescreen. Instead hide a passage that leads to the board you want to go to using a black one or one that has the same foreground and background color (STK!), then use #put w green passage or whatever to make it appear.

Flags have no value. The only number you can manipulate are the counters (score, torches, etc) with the #take and #give commands. If checks for true (set) and false (clear)

The key object will set the flag:

@key
#end
:touch
#set keyhave
#die

The door will check for it then #clear it

@door
#end
:touch
#if keyhave do
No key!
#end
:do
#clear keyhave
#put n blue passage
#die

The real bug is that the #if has to come after the :touch.
*POW* *CLANK* *PING*
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Re: Basic commands?

Post by Commodore »

Schroedingers Cat wrote:
Saxxon wrote:* It is only necessary to use # at the very beginning of a line to mark it as a command. #IF BLOCKED N PUT N EMPTY is a perfectly valid command.
I thought Saxxon was being a LIAR, so I typed meldel's code verbatim. It didn't work. I noticed, however, that if I added just a carriage return to the first line, the code would work.

Anybody have any explanation? I'm confused as to why my code worked when it has :loop as the first line, while meldel's does not!

Attached is the board I experimented with.
The first line does not receive messages (for reasons beyond my knowledge), and your code doesn't actually call loop. Object 1 uses #send so when it doesn't find the label there's no error, but turning loop into a command (object 2) makes it beep.
*POW* *CLANK* *PING*
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 »

You're right! How did I miss that?

Oh, and meldels: the default cycle is already 3, so you shouldn't ever have to set it to that unless you've changed it!!
User avatar
Saxxon
the Gargoyle.
Posts: 608
Joined: Tue Jul 25, 2006 10:02 am
Contact:

Re: Basic commands?

Post by Saxxon »

Commodore wrote:The first line does not receive messages (for reasons beyond my knowledge)
When ZZT searches for a label in code, it searches for the carriage return right before it as well so that it knows that it isn't in the middle of a line somewhere. Naturally, the first line won't start with one.

I tried a #become passage trick by setting an object's P3 to a board index but this didn't seem to work- when tiles are plotted by ZZT, everything is set back to defaults. This would've been cool had it worked.
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 make the titlescreen take another slot beside the topmost, then you could still use this passage for any recurring board, say the room where battles are conducted for an RPG. Or a main room for some game that takes you back to a hub. As in:

HUB: 3 passages
in passage 1: a boss, when killed becomes passage that leads to HUB.
and so on for other passage/levels.

This isn't normally possible without having a passage already onscreen and if you care that could technically make a disadvantage for aesthetics, space conservation and making the game less predictable.

EDIT: OR you could merge the HUB and titlescreen for the same effect.

EDIT II: Having a bit of trouble figuring how I would make a certain thing happen.


What I want is an object that asks the player if he would like to proceed, the options are yes and no, if you press yes it checks if you have enough gems, if it does, it takes them and does label1, if not then it does label2.
Last edited by meldels on Wed Aug 15, 2012 3:27 am, edited 1 time in total.
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 it possible to make the titlescreen take another slot beside the topmost, then you could still use this passage for any recurring board, say the room where battles are conducted for an RPG. Or a main room for some game that takes you back to a hub. As in:

HUB: 3 passages
in passage 1: a boss, when killed becomes passage that leads to HUB.
and so on for other passage/levels.

This isn't normally possible without having a passage already onscreen and if you care that could technically make a disadvantage for aesthetics, space conservation and making the game less predictable.

EDIT: OR you could merge the HUB and titlescreen for the same effect.
The title screen will always be the first board.

Some people have created workarounds for the passage problem. An example: you have a blue Invisible tile surrounded by passages on all 4 sides. When you want to switch to another board, you #CHANGE BLUE INVISIBLE PLAYER and the next step the player takes goes to wherever the passage does. You can have sets of passages for all different destinations, just use a different element (green invisible, etc). To make this effect look good, you would need to use passages that share the same foreground+background colors, and an Invisible that shared their background color. A caveat: returning to the board of origin will cause a bug.

We have a tendency to use the game's elements in unintended ways :]
User avatar
meldels
Ordinery
Posts: 43
Joined: Thu Aug 09, 2012 7:04 pm
Location: VOILA

Re: ZZT-OOP questions

Post by meldels »

Having a bit of trouble figuring how I would make a certain thing happen.


What I want is an object that asks the player if he would like to proceed, the options are yes and no, if you press yes it checks if you have enough gems, if it does, it takes them and does label1, if not then it does label2.
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:What I want is an object that asks the player if he would like to proceed, the options are yes and no, if you press yes it checks if you have enough gems, if it does, it takes them and does label1, if not then it does label2.

Code: Select all

#end
:touch
Would you like to proceed?
!y;Yes
!;No
#end
:y
#take gems 5 nogems
You have enough gems, you can proceed.
#die
:nogems
You don't have enough gems!
The reason No has no label is because it doesn't need one- it simply does nothing when you select it.

I don't advise using numbers at the end of labels. ZZT does some really weird things when you do..
Post Reply