text attribute to integer or real attribute converter?

GamePizzaGamePizza Member, PRO Posts: 227
edited June 2012 in Working with GS (Mac)
Is there a built in function to convert a text attribute to an integer or real attribute?

For instance if I have a text attribute of '127'. Can I convert this into the integer attribute 127 or real attribute 127.0?

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    It's not a very useful conversion because it's limited in terms of implementation, but if you assign an integer or real attribute to a Keyboard Input behavior, it will convert it for you.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • MotherHooseMotherHoose Member Posts: 2,456
    the computer by definition computes number values
    … and numbers are numbers no matter what type of storage for their value
    … text of only numericalCharacters store as text number values

    add an attribute: integer, real, index (or a table columns for integer or real)

    those attributes can be changed to any textAttribute that consists only of numericalCharacters
    (with/without decimals)

    try this with the actor's name: 127.35
    and change the integer or real attribute to the actor's name

    image MH
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2012

    Hi @GamePizza

    Or you can simply convert it by putting the text value into the appropriate new attribute, and this will convert it accordingly, providing it's a number. If the value in the Text attribute is text, the result will be 0.

    So say you have your Text attribute, integer and real attributes. Let's make the text attribute's value 127.0 as per your example. So:

    Change attribute IntAtt to TextAtt
    --will make the value of IntAtt 127

    Change attribute RealAtt to TextAtt
    --will make the value of RealAtt 127.0

    Maybe that'll be useful for you.

    ----------------------------------------------
    http://davidgriffinapps.co.uk/

    PS Does anyone know where I can put the above address in the proper forum signature form? I'm blowed if I can find out where that is.... I've looked three times or more in my Profile and Settings...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MotherHooseMotherHoose Member Posts: 2,456
    Hey @gyroscope … click your name
    should see Edit Forum Profile next to View GS Profile
    click that Edit
    on the right side under your avatar
    click Signature Settings

    why it is so hidden? … I don't know! #-o

    image MH
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2012

    @MotherHoose

    Hiya MH,


    why it is so hidden? … I don't know! #-o
    Nor do I now!! Thanks - I was looking for it in the drop down menu when clicking my username top right... so.... why didn't I think of clicking on my actual name used in posts? ... I don't know! #-o

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.