Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: thepenguin on December 18, 2012, 07:55:55 PM

Title: Syntax Help
Post by: thepenguin on December 18, 2012, 07:55:55 PM
I can't quite get this right, what I need is to take a random number and save it to a variable:

0 61 RandInt  ->x
CurrentCoords 0 <-x 1 10 CreateSpore
30 Delay
Title: Re: Syntax Help
Post by: Grauniad on December 18, 2012, 08:04:54 PM
I do believe Virgil has not yet provided a build with the variable support.

For now just do



CurrentCoords 0 0 61 RandInt 1 10 CreateSpore
30 Delay


Edit. Omitted one parameter. Now it works.
Title: Re: Syntax Help
Post by: knucracker on December 18, 2012, 08:16:23 PM
Yeah, give me another day and the local var support build will be out.  I want to add some nullifier changes (and maybe a sniper change) in the next build before I release it.  Local vars are nice.... 
The syntax is another homage to HP RPN calculators.  I intend to make =>x to mean to store the top of the stack into x in _global_ memory, whereas ->x stores it in local memory.
Global memory will be visible across all CRPLTowers, so it can be used to coordinate actions (maybe)...
Title: Re: Syntax Help
Post by: thepenguin on December 18, 2012, 08:44:27 PM
Quote from: virgilw on December 18, 2012, 08:16:23 PM
Yeah, give me another day and the local var support build will be out.  I want to add some nullifier changes (and maybe a sniper change) in the next build before I release it.  Local vars are nice.... 
The syntax is another homage to HP RPN calculators.  I intend to make =>x to mean to store the top of the stack into x in _global_ memory, whereas ->x stores it in local memory.
Global memory will be visible across all CRPLTowers, so it can be used to coordinate actions (maybe)...

I see where you're going...
Title: Re: Syntax Help
Post by: thepenguin on December 18, 2012, 09:39:33 PM
does div imply Floor, Ceiling, or Round? (i.e. 13/2=(6 or 7))
Title: Re: Syntax Help
Post by: Grauniad on December 18, 2012, 10:12:04 PM
If you do division of integers, you will get an integer result (Eg, Floor). if you do division of floating point, you'll get a floating point result.

The "easy" way to do this is to test it in a CRPLT script, using Trace, that way you 'll learn a lot faster.