Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: asdfchlwnsgy1236 on April 17, 2014, 04:31:23 AM

Title: Text Stuff
Post by: asdfchlwnsgy1236 on April 17, 2014, 04:31:23 AM
I would like for a CRPL Tower to display some text on mouse-over.
The problem is that the Text commands do not seem to like having numbers as arguments.
Is there a way to convert a number to a String?
I know there is type-casting in other languages, but I don't know about this kind of programming language....
Note: The number changes during gameplay so I can't just set it to be a constant in the once endonce block.
Title: Re: Text Stuff
Post by: planetfall on April 17, 2014, 06:15:59 AM
Have you tried <-number "" concat?
Title: Re: Text Stuff
Post by: knucracker on April 17, 2014, 09:23:38 AM
Types in CRPL auto coerce.  That means you can treat a number as a string and it will just work.  For instance

42 ->num
SetPopupText(<-num)


Or if you want to construct a more complex string concat things together.  The concat command pops two items from the stack, coerces them both as strings, and pushes a single merged string back to the stack.


GetUpdateCount ->num
SetPopupText("Update Count: " <-num concat)