#if color

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

Moderators: Commodore, Zenith Nadir

Post Reply
Microwave
hi
Posts: 114
Joined: Fri Aug 03, 2007 10:34 pm

#if color

Post by Microwave »

I forget, and have recently tried and failed, but is there a way for an object to check for a certain color/type. Like #if s red solid blahblah. I've got some ideas but I wish this worked.
User avatar
Schroedingers Cat
We must invent teleportation!
Posts: 721
Joined: Mon Jun 19, 2006 11:35 pm
Location: Idaho, Wisconsin

Post by Schroedingers Cat »

I know #if any <thing> will work, but as far as I know #if doesn't work with directions.
Last edited by Schroedingers Cat on Thu Aug 14, 2008 7:21 pm, edited 1 time in total.
Microwave
hi
Posts: 114
Joined: Fri Aug 03, 2007 10:34 pm

Post by Microwave »

Yeah, I tried #if any earlier and that worked. Well, my idea was to make something based off of Carnage Heart for Playstation, although I've never really played the game. Anyway, there'd be a main object that'd check if certain things were in random/set directions and then make another object act accordingly to it. Have some robot vs robot type shit. Yeaaahhh, I think it can be done another way though.
User avatar
Scribbit
is keeping the new avatar, thanks.
Posts: 543
Joined: Tue Sep 18, 2007 8:06 pm

Post by Scribbit »

if all you need is a randomizer you can just use commands like these:

Code: Select all

'assume the object is enclosed, with a wall to the south and a fake to the north.
@suits
#if blocked rndns black
'
'these are the "red" options, but no label is needed.
#if blocked rndns heart
'
'so this is the diamonds code.
#send bot:diamond
'
:heart
#send bot:heart
'
'but, if Black was selected earlier...
:black
#if blocked rndns spade
'
#send bot:club
'
:spade
#send bot:spade
'and if you want constant updates, you should make the randomizer keep 
'looping. You can also use flags instead of messages, or whatever.
#restart
I'm nupanick.
Microwave
hi
Posts: 114
Joined: Fri Aug 03, 2007 10:34 pm

Post by Microwave »

More than a randomizer. See, in Carnage Heart you program robots by placing chips on a grid, and it acts accordingly. I wanted to recreate that so that you could place your own commands in a box and then let an object move around randomly and check to see what's near it, then send that command to the robot.
User avatar
Dr. Dos
OH YES! USE VINE WHIP! &lt;3
Posts: 1772
Joined: Tue Mar 11, 2003 12:00 am
Location: Washington

Post by Dr. Dos »

Couldn't you do it linear and just make it like the old composer's engine?

Just have it #put dir red line or whatever as you place chips. Then when you need to read chips #put s boulder #if any red boulder whatever
Visit the Museum of ZZT
Follow Worlds of ZZT on Twitter

Apologies for the old post you may have just read.
Microwave
hi
Posts: 114
Joined: Fri Aug 03, 2007 10:34 pm

Post by Microwave »

Nice, that would work. I actually have been wondering about the composer engine, that explains how it works now. This allows for a lot of other things, and solves the mystery for another engine I was working on.
Microwave
hi
Posts: 114
Joined: Fri Aug 03, 2007 10:34 pm

Post by Microwave »

Well, I've been working on this engine, and it's not quite working correctly. http://rs71.rapidshare.com/files/137239 ... ottest.zip here's a link to it.

Edit: Oh yeah, the color keys shown aren't exactly accurate. The directions are supposed to be though.
User avatar
Scribbit
is keeping the new avatar, thanks.
Posts: 543
Joined: Tue Sep 18, 2007 8:06 pm

Post by Scribbit »

Oh, I see the problem! You put a boulder to check, and then when you're done you're trying to cover the boulder with

Code: Select all

#put e empty
#put e yellow normal
but that doesn't get rid of the boulder. Since the boulder is a pushable object, putting an empty just pushes the boulder out of the way and puts the empty where the boulder used to be. Instead, you should use non-pushable objects (like invisible walls) or else just do a straightforward #change boulder normal.

Since the boulder isn't cleared, the object is seeing that same boulder over and over again, and trying to repeat the command over and over again.
Last edited by Scribbit on Thu Aug 14, 2008 7:53 pm, edited 1 time in total.
I'm nupanick.
Microwave
hi
Posts: 114
Joined: Fri Aug 03, 2007 10:34 pm

Post by Microwave »

Thanks. I'll go with invisible.
Xhin
newcomer
Posts: 7
Joined: Sun Mar 26, 2006 4:56 pm

Post by Xhin »

Or, if the thing is in the north or south, you could change it to a sliderew, and a sliderns if it is to the east or west (so it's impossible to push it)
User avatar
Dr. Dos
OH YES! USE VINE WHIP! &lt;3
Posts: 1772
Joined: Tue Mar 11, 2003 12:00 am
Location: Washington

Post by Dr. Dos »

or just have it so the boulder is in a corner since usually corners are where engines get stuffed
Visit the Museum of ZZT
Follow Worlds of ZZT on Twitter

Apologies for the old post you may have just read.
wil
GABZABOOLZABBA
Posts: 105
Joined: Mon Mar 15, 2004 6:21 pm
Location: EAST SIDE
Contact:

Post by wil »

aww was dr dos' engine stuffed in a corner wen he was little? How old-fashioned. I thought they didn't do that to kids these days.
Post Reply