Page 1 of 2

which toolkit has keys & locks that are robots?

Posted: Fri Dec 26, 2003 11:49 pm
by 520
hi again! which toolkit has keys & locks that are robots in disguise???
-smilymzx

Posted: Sat Dec 27, 2003 12:08 am
by Zenith Nadir
Transformers! Robots in disguise!

Posted: Sat Dec 27, 2003 12:22 am
by 539
Was that supposed to be a joke, or did you really mean that? (the toolkit with the robot thing.)

Posted: Sat Dec 27, 2003 12:52 am
by Commodore
@key
#end
:touch
#set key
#die

@door
#end
:touch
#if key #do
/i
Locked!
#end
:do
Unlocked!
#clear key
#die

Or some variation on that.

Posted: Sat Dec 27, 2003 1:52 am
by Dr. Dos
Yeah, it was like Morekeys or something stupid like that.

Posted: Sat Dec 27, 2003 3:39 am
by 536
The Mystical Winds Encyclopedia had an object library of immitation robots. I don't remember if I made key/door immitations, but Commodore's code is about as close as you can get. Objects don't have any way of setting real keys, nor can they be "captured" by the player like ammo, torches, gems, etc., unless you do some freaky stuff that you probably don't want to do (which requires multiple objects).

Posted: Sat Dec 27, 2003 2:58 pm
by Ryan Ferneau
You could make an object put out or turn into a key, though that's boring.

Posted: Sat Dec 27, 2003 4:30 pm
by 518
If you're really bored, you could have a yellow object for yellow key code like so:

Code: Select all

@Yellow key
#cycle 1
:loop
#if contact do
#loop
:do
#go opp seek
#put seek yellow key 
#die
Hence, to give the illusion that a yellow key was there all along. Since this is practically pointless in itself, have a green key-like object make a yellow key.

Posted: Sat Dec 27, 2003 4:50 pm
by 536
"#become yellow key" would be better.

Posted: Sat Dec 27, 2003 5:19 pm
by 136
I remember in 1 game I made on ZZT I made the program to atomaticly giv you the key in 1 secend. This is how, from west to est (all ar color dark red on dark red):

(1) Object:

Code: Select all

@secret
#end
:ok
#go e
(2) Key

(3) Fake

(4) Duplicator: Dir=W Speed=fast speed

(5) Extra Player No Stats

Put a red solid wall around all uv this.

Posted: Sat Dec 27, 2003 5:20 pm
by 518
Damnit, I always miss something ridiculously obvious.

Posted: Sat Dec 27, 2003 6:07 pm
by 536
For a similar engine to zzo38's, check out the Give Anything engine in the MW Encyclopedia.

Posted: Sat Dec 27, 2003 9:07 pm
by 518
If you want a door that is a real door but displays a different message when you don't have the key, do the following:

Key

Code: Select all

@YellowKey
#cycle 1
:loop
#if contact do
#loop
:do
#if not key do2
You already have a key of this kind!
#loop
:do2
#set key
#become yellow key
Door

Code: Select all

@YellowDoor
#cycle 1
:loop
#if contact check
#loop
:check
#if key do2
You don't have a key! 
#loop
:do2
#clear key
#become yellow door
You can use whatever color of key or door you want.

Posted: Sun Dec 28, 2003 2:04 am
by 536
There is a problem with that code. If the player already has a key and stands next to the key, you would see:

You already have a key of this kind!

You already have a key of this kind!

You already have a key of this kind!

etc. in a text box. Similar situation if you stand next to the door and don't have a key. You can fix this by adding "/i" before "#loop", but then the message at the bottom of the screen would rapidly refresh. I recommend adding another loop that it stay in as long as the player is in contact with the object before returning to the original loop. This would ensure that it doesn't display the message again until the player at least steps away and returns.

I wouldn't use real keys in conjunction with flags because that uses up both flag and key space. If you're doing something simple like that last example, I would just use real keys and door, but if you're doing something that absolutely requires them to be objects, I would probably use flags. One flag can easily represent three keys using a "piggy-back" technique. Basically, the following flags could represent "key 1" being set: key100, key101, key110, key111. Whereas flag 2 would be: key010, key011, key110, key111. Instead of just checking if "flag1" is set, check if one of the four are set. Setting the flag is a little more complicated, so here's a snippet:

Code: Select all

@key
#end
:touch
#if key100 havekey
#if key101 havekey
#if key110 havekey
#if key111 havekey
' The player doesn't have the key, so we're setting it
#if key000 k00
#if key001 k01
#if key010 k10
#if key011 k11
:k00
#clear key000
#set key100
#die
:k01
#clear key001
#set key101
#die
:k10
#clear key010
#set key110
#die
:k11
#clear key111
#set key111
#die
:havekey
You already have this key.
For doors, you would just switch the 'clear's and 'set's and switch the flag names in the two groups of 'if' commands.

Posted: Sun Dec 28, 2003 2:40 am
by Dr. Dos
Christ people IT'S FUCKING KEYS. WHO CARES?