Reading the name of an Att. from the content of a Text Att.

DuendeArkanoDuendeArkano Member Posts: 52
edited November -1 in Working with GS (Mac)
Hi again!

Thanks a lot for all the help you're giving to me :)

Today i have a question about attributes, im wondering if its possible to do this:

I have a text attribute called "Box", and inside this box i want to put the name of another att. who i'll call it later from another place of the game.

The idea its to have a place where to put diferent attributes name, because this attributes, at the end, are a kind of index for a database, so it will be changed as soon as the data base increases, this attributes will be like "name1, name2, name3..." so i need to know, if its possible, how to save and load the name of an att. inside another att.

thats it :)

LOT OF THANKS IN ADVANCE!!!! :D

Comments

  • xarmianxarmian Member Posts: 124
    Unfortunately this isn't possible. In programming terminology, you're looking to use "indirection" to access a variable based on the contents of another variable. The problem in GameSalad is that an attribute's name means nothing. An attribute with the name "Box" has an internal identifier, which is something like "id329202" (you can see these values by looking at the XML files that make up your project, in the case of game attributes they're in object.xml).

    As a result you can have two attributes named Box, each with a unique internal identifier. And thus the name Box can not be used to identify either attribute (it's too vague, and the gamesalad engine doesn't even bother to look at the names).

    So in the end, the answer is simply no, it's not possible.

    Dave
  • xarmianxarmian Member Posts: 124
    One additional note - they're working on adding "tables" aka arrays, which, in theory, would give you an alternate and much easier way to accomplish what you're trying to do. This should be out in the next couple months if they can meet their goals.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi Duende, there's no way you can use a text attribute as a "label" for a group of other attributes - integers, for instance - contained within it. In other words, no way to show the Text attribute with the value Box and expect it to automatically bring up a set of other attributes.

    Maybe when arrays are in GS, there should be a way....

    Edit: xarmian beat me to it...

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

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

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi again Duende, well I never, it sounds like you CAN do what you're asking: you can find the info by CodeMonkey in Yodapollo's yellow sticker post here:

    http://gamesalad.com/forums/topic.php?id=30832

    I'm unsure how this actually works in practice, (I'm a bit slow on the uptake sometimes!) but I'm sure you'll work it out; can't quite figure out how to "pick" from the Text list; someone's bound to explain it some time or other...

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

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

  • DuendeArkanoDuendeArkano Member Posts: 52
    Thanks a loooooot again guys!

    It seems i have to keep working on the other projects and leave this till the arrays appear...

    Thanks god this is becoming bigger and bigger :D

    But anyway thanks a looot for your long explanation :)
Sign In or Register to comment.