Displaying Text and Attributes

DigitalDianaDigitalDiana Member Posts: 34
edited January 2012 in Working with GS (Mac)
Hello!

I am having trouble displaying text that contains 2 attribute values.
Any help would be greatly appreciated!


What I am trying to get Actor 1 to do:

-Display Text similar to the following:
And the
answer is...
10:20 (example numbers)
(Yes, on separate lines. I might change up the phrase at some point, but I really need the numbers and the colon to be in place since the numbers in both spots will change with various circumstances.)

My current set-up:

Game Attributes:
game.SpotA text
game.SpotB text
(Originally I did them as integers. I wasn't sure which to use in this case.)

Actor 1:
Rule: When pressed, display text:
Displayed Text:
And the answer is.... game.SpotA : game.SpotB
(I tried separating the lines in the code so that game.SpotA : game.SpotB had its own line. Sometimes I was able to do separate lines, but it didn't always work.)


My problem:

Getting game.SpotA : game.SpotB displaying its number values with the colon in between them. When it's just either game.SpotA or just game.SpotB in the Display Text, it does display the values by themselves, but not when both are in the Display Box together.

For example:
Display Text: game.SpotA (This works)
Display Text: game.SpotB (This works)
Display Text: game.SpotA : game.SpotB (doesn't work at all)


Main Question:

How do I make it so that I can have game.SpotA : game.SpotB be in the Display Text along with my other text?





Comments

  • hotMagichotMagic Member, PRO Posts: 266
    Are you using the lua syntax for joining them?
    I would write it like this:
    gamespota..":"..gamespotb
    (like with the dot dot in there, which is used to join strings like that)
    To do sep lines, are you doing this?
    gamespota..":".."\n"..gamespotb

    So anything that a string, put it in the quotes. and variables are just chilling wihtout quotes.
  • DigitalDianaDigitalDiana Member Posts: 34
    I am not familiar with the lua syntax, though I have come across a few things mentioning the dots. I've tried various things, but it seems that I'm still not inserting them properly. I just tried this and it didn't work:

    Display Text:
    And the.."\n"answer is:.."\n"..game.SpotA..":".."\n".."game.SpotB"

    What did I do wrong?
  • ultimaultima Member, PRO Posts: 1,207
    edited January 2012
    are you doing it in the little black window? (can't remember what it was called for the life of me)... "operations window"?

    edit:..ohh.. nvm... you are putting the quotes in the wrong place. ... it would be more like "\nsomething"..game.something.."\nsomething else"

    the reason hot magic puts "\n"..gamespotb... is because game.spotB is a attribute... and you don't put quotes outside of attributes..
  • DigitalDianaDigitalDiana Member Posts: 34
    Yes, the Expression Editor.
  • micksolomicksolo Member Posts: 264
    Attribute..":"attribute

    Should work
  • ultimaultima Member, PRO Posts: 1,207
    "\nanswer is:"..game.SpotA..":"..game.SpotB

    should work... or according to micksolo

    "\nanswer is:"..game.SpotA..":"game.SpotB
  • DigitalDianaDigitalDiana Member Posts: 34
    edited January 2012
    @ultima: I tried doing what you said and I wrote it like this:
    And the"\nanswer is".. game.SpotA ..":".. game.SpotB .."
    It didn't work. I wrote it in the Expression Editor.

    @micksolo: I tried what you said and I wrote it like this without the accompanying text (And the answer is...):
    game.SpotA ..":"game.SpotB
    This didn't work either.
  • ultimaultima Member, PRO Posts: 1,207
    you are putting a .." after what i wrote... of course it didn't work haha
  • DigitalDianaDigitalDiana Member Posts: 34
    edited January 2012
    @ultima: I just tried this and it didn't work:
    And the "\nanswer is:".. game.SpotA ..":".. game.SpotB

    I'll try it again though.
  • ultimaultima Member, PRO Posts: 1,207
    are you sure? i tried it on my GS and it works perfectly fine.
  • ultimaultima Member, PRO Posts: 1,207
    can you elaborate on what doesn't work? like what the result is showing...? are you typing in game.SpotA instead of clicking(picking) the attribute? is game.SpotA the correct attribute?
  • DigitalDianaDigitalDiana Member Posts: 34
    This was my most recent attempt and it said Invalid Expression:
    And the "\nanswer is:".. game.SpotA ..":".. game.SpotB
  • ultimaultima Member, PRO Posts: 1,207
    edited January 2012
    but you can't even type "space" in the expression editor... if that's what you typed.. it would have become
    \answeris:

    what i mean is you need to click on the "e" symbol and type in exactly as above, and when it comes to attribute, you click them from the drop down menu.
  • DigitalDianaDigitalDiana Member Posts: 34
    Yes, I'm sure it's right. game.SpotA appears perfectly by itself without the colon or game.SpotB and vise versa. I tested both game.SpotA and game.SpotB alone in Display Text and they appear perfectly. They just don't seem to work together.
  • ultimaultima Member, PRO Posts: 1,207
    edited January 2012
    space is achieved by... can't remember that either lol. it's been a while I did anything that way. if it doesn't work then it's beyond me...
    there are some who's more qualified to answer this question ^^
  • DigitalDianaDigitalDiana Member Posts: 34
    I'll try without the space. I had read somewhere that you could space words by pushing Option and Spacebar. That seemed to space the words out fine.
  • DigitalDianaDigitalDiana Member Posts: 34
    I just tried this and to no avail.
    Andthe"\nansweris"..game.SpotA..":"game.SpotB
  • ultimaultima Member, PRO Posts: 1,207
    yes that works as well. like i said i haven't display text this way for a while so it's gone by me... but it works when I tried it on my end.. =) what type of attribute are they?
  • ultimaultima Member, PRO Posts: 1,207
    edited January 2012
    you'd put "and the" also inside of the quote... i had thought you are referring to what you had typed... didn't even noticed And the is part of what you want to include.

    "\nAnd the answer is:".. game.SpotA ..":".. game.SpotB
  • DigitalDianaDigitalDiana Member Posts: 34
    Lucky. I wish it worked on my end. Lol. I have the attributes set to Text. I originally had them as Integers, but I wasn't sure which to use in this case.
  • ultimaultima Member, PRO Posts: 1,207
    did u try this??

    "\nAnd the answer is:".. game.SpotA ..":".. game.SpotB
  • DigitalDianaDigitalDiana Member Posts: 34
    I'll try that now.
  • DigitalDianaDigitalDiana Member Posts: 34
    edited January 2012
    That worked beautifully! :D Thank you so much!
    I apologize for all the trouble.
  • ultimaultima Member, PRO Posts: 1,207
    haha. no. no .. apologies ...it's an oversight on my part.. usually scan through these things.. had there been blue box or some sort for all the syntax .. would be much easier to read and separate it out from "description".. could have solved ur problem with 1 reply had i know what you are trying to type exactly =)
  • DigitalDianaDigitalDiana Member Posts: 34
    Lol. Yeah, that's true. I guess there's no box telling us about all the types of syntax, huh? I was trying to google some info so I can try to understand it better.
  • DigitalDianaDigitalDiana Member Posts: 34
    Thank you everyone for all your help!
Sign In or Register to comment.