count letters, get a number

This forum is currently in read-only mode.
From the Asset Store
An educational game for counting pictures. An easy to use template for developers to build larger games
  • hey all,

    i have a little question and i can't figure it out myself how to do it

    here it comes

    I have two names e.g. "michael" and "Michelle"

    now i want construct to count the letter but not in a normal way but more like this

    m = 2, i = 2, c = 2, h = 2, a = 1, e = 3, l = 3

    so that it would sum it up like this:

    2-2-2-2-1-3-3

    And then (i don't now if it is possible but i still ask it ) i want it to count the number up like this

    2-2-2-2-1-3-3

    first + last, so you get 5 and again 5 and then 3 and last the 2

    so you will get this

    2-2-2-2-1-3-3

    5-5-3-2

    7-8

    78

    So that in the end i will have two numbers, i know it seems a little hard and that's why i don't know how to do it, and i need a little push in the good direction so i know were to start.

    If someone can help me out with this i will be very gratefull

    (my english isn't that good so there can be a few mistakes in my question)

  • In order to do this you should have a close look at the following wiki page:

    SYSTEM EXPRESSIONS

    That would be the needed push in the right direction for you.

    Other than that I made a cap which does what you requested. Enter a name in the editbox and click the calculate button. For the letters you had in your example I assigned the same values. So calculating "Michael" will indeed give 78.

    Here's the link: http://dl.dropbox.com/u/2306601/namevalthing.cap

    And my further approach to this is to EXPLAIN NOTHING else about it. You go figure it out. That should make for about the best possible learning experience.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thanks for the quick reply and thanks for the right push

    first i will look at the wiki page and if i still can't get to it i will use your example

    edit:

    Well i took a quick look at your example and i realize i explained my idea wrong i think, what my idea was is that you have Two names in different editboxes, and that it counts how much each letter is used,

    E.g.

    Michael Michelle

    m is used 2 times, the i 2 times etc.

    but with your example i can look more in depth of how to keep counting till there are two numbers left

  • edit:

    Well i took a quick look at your example and i realize i explained my idea wrong i think, what my idea was is that you have Two names in different editboxes, and that it counts how much each letter is used,

    E.g.

    Michael Michelle

    m is used 2 times, the i 2 times etc.

    but with your example i can look more in depth of how to keep counting till there are two numbers left

    Well yeah, you only provided an example for one name, so that's what I based my cap on. Once you understand it you can adapt the method to handle as many names as you like though.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)