0 Favourites

Text Input and Variables?

  • 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

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
[Plugin] tag text
188 25,446
RBuster's avatar
RBuster
Unread hot topic
96 57,360
bitworks's avatar
bitworks
Unread hot topic
118 32,901
rexrainbow's avatar
rexrainbow