Add to score outputs a string and not a number !

  • Hi Team, I am new to the app. The output dragged out of add to score node gives a string value. I need a number value out of it to perform some calculations. How do I achieve that ..?

  • Hi..

    I just tried to make something like (string) + (string) = String
    I give every string a value for example i have 3 strings (cat, dog and rabbit).

    Cat value = 1
    Dog value = 3
    Rabbit value = 4

    dog value:

    Cat value:

    Label value:

    The result is when dog + cat will give us a rabbit which mean value 4


    I hope this will help you.

  • This post is deleted!

  • @WindwakerX Hi.. thanks very much for the intuitive logic.. I have to think a bit to see if I can some how tweak it to get what I want but I got so distracted by the cool dark theme you’ve got on your screenshots and been trying to find the settings to change theme..but I couldn’t.. Can you guide me to get my theme changed ??

  • @Saman i think i had a dark theme because i changed my iPad settings to dark theme.

  • @Saman

    The Add to Score behavior doesn't output a number. It outputs an Object ID, which is a string. Object IDs references an object in the scene.

    Performing math operations with a string will treat it as 0. hyperPad doesn't throw an error when this happens.

    Eg. "cat" + 3 = 3 => 0 + 3 = 3

    If you want to get the score value after executing the Add to Score behavior, use Get Label. This behavior will read the contents of a text and not just give the object ID.

    The output of behaviors will automatically convert to numbers to perform math operations on.

  • Sidenote: All behaviors that manipulate objects will output Object ID(s). Some behaviors can have multiple output fields and you can select whichever one you want. 👍

Log in to reply