Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Levi on January 21, 2015, 07:00:45 AM

Title: Digitalis Growth: How to notate?
Post by: Levi on January 21, 2015, 07:00:45 AM
So, I've got my fake emitters supporting existing digitalis growth now (which most script versions I've seen of them don't), and that was pretty simple; setting attributes is dead easy.  But they don't start growth where none exists, yet.

Here's what I attempted, which doesn't work.

....

#Checks if there is creeper - and if there is, sets the unit to grow digitalis where it is.

CurrentCoords GetCreeper 0 gt if
SetDigitalisGrowth CurrentX CurrentY 1
endif

delay <-30

....

Is there a right way round I should be doing that?
Title: Re: Digitalis Growth: How to notate?
Post by: J on January 21, 2015, 07:15:48 AM
CRPL is a stack-based language, so you put the commands after the arguments like this:


CurrentCoords GetCreeper 0 gt if
CurrentX CurrentY 1 SetDigitalisGrowth
endif

delay <-30


If you want to use parentheses, they move the command before '(' to ')', so you can put commands before the arguments.


if ( CurrentCoords GetCreeper gt(0) )
SetDigitalisGrowth ( CurrentX CurrentY 1 )
endif

delay <-30


For the game both codes are exactly the same.
Title: Re: Digitalis Growth: How to notate?
Post by: Levi on January 21, 2015, 08:18:31 AM
Stack-based, Yoda's speech patterns are.


...Hmm.  Compiles, still doesn't trigger full-on growth.  Need to sort this more.
Title: Re: Digitalis Growth: How to notate?
Post by: J on January 21, 2015, 08:34:39 AM
The script currently only places digigrowth at the current location (the single cell in the center of the core). If you want it to seed digitalis, add the line 'CurrentCoords 1 SetDigitalis' so the digi can start to grow. In the editor you can choose to let the core support digi (to keep it alive and let it grow to other cells with digigrowth).
Title: Re: Digitalis Growth: How to notate?
Post by: Levi on January 21, 2015, 11:01:00 PM
Ha-HA!  Works.