Converting strings to values

New releases and general discussions.

Post » Fri Apr 11, 2008 5:07 am

So, Construct is pretty awesome at the moment, but the lack of a feature to convert a string into a value is getting to me. I'm currently working on a scripting engine and I can't have it do what I want unless I can do said conversions. Are there any plans to add this feature?
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Fri Apr 11, 2008 7:23 am

have you tried a python script?

i don't know why that isnt a feature already. its a really easy concept in c++.
B
2
S
1
G
4
Posts: 64
Reputation: 1,328

Post » Fri Apr 11, 2008 7:44 am

You can use float() or int() for ex. "float(Text.Text)"
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Post » Fri Apr 11, 2008 3:32 pm

Doppel's right, they're all already under 'Convert' in the system object (and convert to integer/float accept strings). Sometimes this is done automatically, for example you can assign "55" to an object's X co-ordinate.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Fri Apr 11, 2008 3:46 pm

Ah, sweet, that fixed my problem. Thanks. :) Although you might want to clear that up a bit for the next build.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Fri Apr 11, 2008 3:50 pm

How do you think it could be clearer? It's under "Convert" in the system expressions :?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Fri Apr 11, 2008 4:40 pm

Maybe the name "Convert value to Float/Integer" misslead them becouse value is not text for them? Or maybe they dont know whats a Float/Integer?
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Post » Fri Apr 11, 2008 5:47 pm

I basically know what floats and integers are, it's just that most people(myself included) are going to think that a value means a number. Making a "string to value" action, even if it's a little redundant, would probably clear up any confusion anybody had.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Fri Apr 11, 2008 6:13 pm

I thought floats are whole numbers and integers use decimals, but i'm not a programmer, having only used MMF. I didnt make the connection between them and strings and strill don't get it.

I think a lot of people will be the same. I really think you should make it clearer, "value to string" as Linkman says.
B
37
S
19
G
18
Posts: 613
Reputation: 10,231

Post » Fri Apr 11, 2008 6:26 pm

Fair enough, I guess it is a bit jargon-y... and don't forget integers are whole numbers and floats can have fractional parts (you had it the wrong way round).

So to clear it up, how about just "Convert to number"? Or "Convert value/text to float"?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests