Page 1 of 4

ZZT Guy's ZZT Questions

Posted: Wed Sep 27, 2006 6:20 pm
by ZZT Guy
Im an extreme ZZT noob but...
How do i get it so that when I
touch a character it says its message?
when i make a message object, and go
into the room its in, it says its text as soon as i move one space!

Posted: Wed Sep 27, 2006 6:30 pm
by Commodore
You need to stop it. So use #end then you need to start it when you :touch it.

@person
#end
:touch
Hello!

Posted: Wed Sep 27, 2006 6:35 pm
by ZZT Guy
Commodore wrote:You need to stop it. So use #end then you need to start it when you :touch it.

@person
#end
:touch
Hello!
THANK YOU!
EDIT: Alright, now i want the Object to move to the
West after giving out the message, how do i do that?

Posted: Wed Sep 27, 2006 6:47 pm
by Schroedingers Cat

Code: Select all

@person
#cycle 1
#end

'this is a comment.
'ZZT ignores all comments.
'comments begin with a '.
'they don't end until the next line.
'comments are used to help the programmer.
'they have no bearing on gameplay.

:touch
Hello!
/w 'tells the object to go one square west, regardless of whether or
'not the space is blocked. The object will keep trying until it suceeds.
'alternativly, you could use "?w", which tells the object to try to go west,
'but if it can't, no biggie.
#end

Posted: Wed Sep 27, 2006 6:52 pm
by ZZT Guy
Schrödinger's Cat wrote:

Code: Select all

@person
#cycle 1
#end

'this is a comment.
'ZZT ignores all comments.
'comments begin with a '.
'they don't end until the next line.
'comments are used to help the programmer.
'they have no bearing on gameplay.

:touch
Hello!
/w 'tells the object to go one square west, regardless of whether or
'not the space is blocked. The object will keep trying until it suceeds.
'alternativly, you could use "?w", which tells the object to try to go west,
'but if it can't, no biggie.
#end
Thanks
EDIT:Alright, im thinking on making a Mario game,
so how do i get it to where a message object will walk around, shoot bullets at you, and die after 3 hits?

Posted: Wed Sep 27, 2006 7:09 pm
by Dr. Dos
You should really check out similar games and look at the code in there. I'm pretty sure Link's Adventure taught me a lot about making enemies.

But to move around randomly you can use /rnd or #go rnd
For shooting #shoot rnd or #shoot seek to shoot at the player

As for multiple hits:

Code: Select all

@Blah
BLAH BLAH CODE HERE
#end
:shot
#zap shot
#restart
:shot
#zap shot
#restart
:shot
#die
You can use labels instead of #restart and can actually shorten the code to

Code: Select all

#end
:shot
:shot
#zap shot
#restart
:shot
#die

Posted: Wed Sep 27, 2006 7:16 pm
by ZZT Guy
Dr. Dos wrote:But to move around randomly you can use /rnd or #go rnd
Tried that, but he only walks one space,
i need him to just randomly walk anywhere
without stopping

Posted: Wed Sep 27, 2006 8:23 pm
by Quantum P.
Welcome, ZZT Guy! In order for the object to keep on moving, you need to set up a loop. There are a couple of ways of doing this:

Code: Select all

/rnd
#restart
This program has two instructions: (1) Move randomly. (2) Go back to instruction #1. It is easy to see that the object will not stop moving.

Code: Select all

:runaround
/rnd
#runaround
This is the way I prefer. It's three lines now, but it's more descriptive. The object reads the first line, which it ignores for the moment. It reads the second line and takes a step in a random direction. It reads the third line, which tells the object to go back to the line that says ":runaround".

Posted: Wed Sep 27, 2006 8:26 pm
by ZZT Guy
Quantum P. wrote:Welcome, ZZT Guy! In order for the object to keep on moving, you need to set up a loop. There are a couple of ways of doing this:

Code: Select all

/rnd
#restart
This program has two instructions: (1) Move randomly. (2) Go back to instruction #1. It is easy to see that the object will not stop moving.

Code: Select all

:move
/rnd


#move
This is the way I prefer. It's three lines now, but it's more descriptive. The object reads the first line, which it ignores for the moment. It reads the second line and takes a step in a random direction. It reads the third line, which tells the object to go back to the line that says ":move".
Thanks

Posted: Wed Sep 27, 2006 9:19 pm
by thematrixeatsyou
Though I WOULD sugest using ?rnd instead of /rnd, as if it hits a wall, the object locks up.
Although ?RNDP RNDNE works.

Posted: Thu Sep 28, 2006 12:24 am
by Quantum P.
tmey is right here. Change those /s to ?s.

Posted: Thu Sep 28, 2006 11:26 am
by Zenith Nadir
in honour of this new user i am going to change my board name to "zzt cool dude :D"

i hope this is acceptable

Posted: Thu Sep 28, 2006 2:04 pm
by Ryan Ferneau
I'm the boy who cried joke account!

Posted: Thu Sep 28, 2006 5:38 pm
by Schroedingers Cat
AND IN HONOR OF <s>ZENITH NADIR</s> ZZT COOL DUDE :D I AM GOING TO CHANGE MY NAME TO ZENITH NADIR.



OH WAIT, NO I'M NOT.


Also
Quantum P, ZZT Overlord wrote:Timmy is right here. Change those /s to ?s.
Fixed.

Posted: Thu Sep 28, 2006 8:18 pm
by Ryan Ferneau
The name's Weenie

Tim's Weenie