Text Input and Variables?

Get help using Construct 2

Post » Wed May 29, 2013 4:42 pm

Hey all,

    I am trying to create something which in theory and on paper is very simple but I am not sure how to execute it in Construct 2 or even know if it is possible.

    Basically all I am trying to do is create a basic program where the User would enter a Word. Each Letter in that word will be assigned a value. Then all those values will be added up for a total number.

For example: The user inputs their name, say Jimbo.
J= 10
I= 9
M= 13
B= 2
O= 15

so 10+9+13+2+15=49

There is obviously more to it than this, but this is the fundamental information I need before I can carry on.


Is it possible to do this? And if so how would I do it? Just to note as well. It will be used on android, ios, and web.

Thanks and Sincerely,
TodOrcim
B
3
Posts: 4
Reputation: 208

Post » Thu May 30, 2013 4:14 pm

You could do something like that using the system string functions listed in the manual.

Essentially, you would loop through the word running the left() function once for each letter (using it to return the first letter only). Compare that character in a giant if statement that adds its given value to the total. Then you would trim down the original word to get rid of the first letter using something like the mid() function.

Then repeat until there are no letters left.
B
21
S
8
G
5
Posts: 89
Reputation: 6,017


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests