How to Convert Text to Number?

To make this short, I need to take a number such as 0027 and assign a number property to it. The number 0027 is assembled using four different properties using a [Create text with] block. This is because these numbers are decoded from a save file code inputted using a custom keyboard. My issue is that no matter what I need to combine the four digits after converting each one separately to a number which always makes them a text again.

1 Like

I think BH was doing this sometime ago, i forgot

I’m pretty sure you can put numbers into text properties, so something like using counters to replicate text properties to numbers, if you know what I mean?

Could be kind of complex using counters but that gives me some ideas. Not marking a solution yet though

Not really, all you have to do is have a text property and a number property. Then, within a trigger or counter (preferred), you could compare the text and number properties. The one problem is that I haven’t tried this, so I’m not sure if text properties can go to numbers. I know that numbers can go to text, though.

The problem is when you have to combine them. Won’t you have to compare each digit individually?

So if you’re looking to convert text to number, which I think is what you’re trying to do here, simply multiply the text by 1 in block code. If you can’t put the text inside the multiplication block, put the text in a variable and put that inside the multiplication block.

5 Likes

smrat

thats big brain

shoulda thought of that sooner

1 Like

By the way, those leading zeros in the front will be destroyed when you do this. (So you might have to put a 1 or something in front of all the numbers)

WAIT THAT WORKS?!?! (I already converted text to number multiple times using a much longer method that only works with single digits) Thanks

It better if they get destroyed. They aren’t actually useful it is just how the code is read

how you know this? : 0

The GKC stuff I do involves a lot of encoding and decoding numbers and so this is just stuff I picked up while working in that field.

2 Likes

hes bh

thats how

2 Likes

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.