Expression to variable

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    No, that won't work at all. Try (with example to add them):

    game.Box (chosen from via the Editor, not typed) +self.1 + self.j

    Also, a small tip, to make your attribute names with more information (actual words) because if you're project gets complex with lots of single letters, it'd be easy to get confused.

    Hope that helps.

    Edit: or if attributes are text, concatenate (join one after the other) as TSB wrote.

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

  • YarikYarik Member Posts: 15
    if i write "game.Box.37" then Invalid Expression
    "game.Box..self.i..self.j" Empty
    "game.Box...self.i..self.j" Invalid Expression
    "game.Box..(self.i)..(self.j)" Empty
    "game.Box...(self.i)..(self.j)" Invalid Expression

    Why can not
  • YarikYarik Member Posts: 15
    no... this not working
    i think problem is not .. or +
    if write game.Name or game.Box.37 then shows Invalid Expression
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi Yarik, what type of attribute is game.Name? And what type of attribute is game.Box.37? Also calling an attribute, whatever type it is, with a fullstop is not good either, should be called Box37, and so shows up in the Editor as game.Box37.

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

  • YarikYarik Member Posts: 15
    Name - text
    Box.37 this is not name, name is 37,
    Box is size for variable, like self.Position or self.Size

    37,i,j - I tried it with Index and real
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Still confused about game.Box.37; but for certain you can't mix text attributes with any number attributes in the Expression Editor unless the Expression Editor is accessed via a Display Text Behaviour.

    So, as far as I can make out Name is a text attribute, 37 is a text attribute and Box is a variable attribute: integer, real or index.

    Fo this example, lets say the following values are: Name = John; Box = 37;and we'll give i the value of 28; and j the value of 290.

    So using the Expression Editor in a Display Text Behaviour, if you put, (as TSB said):
    Name...Box...i...j you'll get:

    John3728290

    If you put Name..." "...Box..." "...i..." "...j you'll get:
    John 37 28 290

    Still confused what your actual values are but hope that's helped.

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

  • YarikYarik Member Posts: 15
    no =)
    game attributes
    real game.11 = 478
    real game.27 = 996
    real game.34 = 754

    actor attribute
    real self.i
    real self.j
    display text: game.(self.i)(self.j)

    if i=1 j=1 then show 478
    if i=2 j=7 then show 996
    if i=3 j=4 then show 754

    is similar to a static array
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Right, OK! I'm getting there:

    game.11 = 478
    game.27 = 996
    game.34 = 754
    self.i
    selfj

    if i=1 j=1 then show 478
    if i=2 j=7 then show 996
    if i=3 j=4 then show 754

    478, 996 and 754 need to be put into attributes, presumably either self.i or self.j?

    Display Text: (self.i)..(self.j)

    Say self.i becomes 478 and self.j becomes 996, then you'll get displayed:

    478996

    If you want 478 996 then put:

    Display Text: (self.i).." "..(self.j)

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

  • YarikYarik Member Posts: 15
    Forget, I asked stupid
    wanted to work with a static array
    but I forgot that I can not enter the expression into the first slot "Chang Attribute "

    but even so thank you very much
Sign In or Register to comment.