Page 1 of 1

#if color

Posted: Sat Aug 09, 2008 11:44 pm
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.

Posted: Sun Aug 10, 2008 2:15 am
by Schroedingers Cat
I know #if any <thing> will work, but as far as I know #if doesn't work with directions.

Posted: Sun Aug 10, 2008 7:49 am
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.

Posted: Sun Aug 10, 2008 4:07 pm
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

Posted: Sun Aug 10, 2008 5:06 pm
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.

Posted: Sun Aug 10, 2008 5:26 pm
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

Posted: Sun Aug 10, 2008 5:49 pm
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.

Posted: Thu Aug 14, 2008 10:16 am
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.

Posted: Thu Aug 14, 2008 6:18 pm
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.

Posted: Thu Aug 14, 2008 7:48 pm
by Microwave
Thanks. I'll go with invisible.

Posted: Sun Aug 17, 2008 4:25 am
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)

Posted: Sun Aug 17, 2008 4:40 am
by Dr. Dos
or just have it so the boulder is in a corner since usually corners are where engines get stuffed

Posted: Sun Sep 14, 2008 10:01 am
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.