Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: planetfall on February 20, 2014, 08:26:56 PM

Title: Strings as numbers
Post by: planetfall on February 20, 2014, 08:26:56 PM
It turns out that the following works:

"64" "64" "1" SetCreeper

Is this a bug, or intentional? Because a script I plan on using relies on this, but I will create a workaround if it is likely to be patched.
Title: Re: Strings as numbers
Post by: Crimson King on February 20, 2014, 08:51:08 PM
Not exactly sure why you need to use strings as numbers with SetCreeper since there is no need to use a string with that command. It is probably a good idea to at least look into a workaround even if it doesn't get patched.
Title: Re: Strings as numbers
Post by: planetfall on February 20, 2014, 09:27:37 PM
I didn't intend it for SetCreeper specifically, it was just a simple example to show that it's a thing. The use I had in mind was my Mounted Runner Nest, which spawns runners with different crpl units "riding" them. Specifically, so that the spawned core's variables would be controlled by a single input variable to the nest for all ints, floats and strings.
Title: Re: Strings as numbers
Post by: knucracker on February 20, 2014, 10:32:47 PM
That is working as designed. When a command pops an item from the stack it coerces it into the type that it requires. So a string in the correct format will coerce to a non zero value.
Title: Re: Strings as numbers
Post by: Flabort on February 21, 2014, 12:49:18 AM
Wait... totally unrelated, but I just realized that I can script my ciphers super easy in crpl!
This just... reminded me. Yes.
Title: Re: Strings as numbers
Post by: planetfall on February 21, 2014, 06:13:57 AM
Quote from: virgilw on February 20, 2014, 10:32:47 PM
That is working as designed. When a command pops an item from the stack it coerces it into the type that it requires. So a string in the correct format will coerce to a non zero value.

All right!
(goes on to destroy world)
Title: Re: Strings as numbers
Post by: Annonymus on February 21, 2014, 09:24:19 AM
@planetfall After you're done with all your maps/plans/scripts we will have a whole new game to play :P