Display TExt + custom text

I dont remember how to use display text, display a attrib and add custom text like: score.."game.score"
im using search for the forum..

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited January 2013

    Hi @mrpacogp Simply drag out a Display Text behaviour, then click the "e" symbol for the expression editor.

    As far as I can see, you've used the quote marks for the attribute and not the word; should be:

    "score "..game.score

    To put the space after the word score, hold down option (alt) and hit the spacebar.

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

  • mrpacogpmrpacogp Member Posts: 400
    edited January 2013
    With Game score works, but not with bolean like true or false
    With "score"..game.score shows Score0
    No problem with space feels better (could be this added to the cookbook?)
    Whats about bolean attribs?
    dont work display text: "Attack "..game.attack (invalid expression9
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited January 2013
    With Game score works, but not with bolean like true or false
    With "score"..game.score shows Score0
    Whats about bolean attribs?
    dont work display text: "Attack "..game.attack (invalid expression9
    Booleans are fine to display as well; you'll either get false or true, depending on their state.

    So for your example "Attack "..game.attack, providing game.attack is a boolean, it should display either Attack false or Attack true. The invalid expression message means something's not been put in correctly...not sure what... (maybe you typed in the attribute rather than selecting it).

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

  • mrpacogpmrpacogp Member Posts: 400
    edited January 2013
    I put "Something "..game.attack
    and only get invalid expression
    I have destroyed the actor and recreate it and still invalid
    Dont work, i have tested on a blank project and maybe is another formula.

    Im testing all way to make it work with bolean attrib...
    game.score.." score" works too :P
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hey @mrpacogp I see what you mean.... that is totally unexpected, and should work with booleans as well.... just the attribute on its own shows fine, but concatenated with a word doesn't seem to... I'll investigate further... (but surely must be a bug...)

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

  • mrpacogpmrpacogp Member Posts: 400
    edited January 2013
    I think is a bug.
    In debugging statement its the same issue:
    Log statement: "score "..game.score
    and you see: Score 0
    Log statement: "rule "..game.rule
    and you see: Invalid Expression

    Its a bug?

    Just tested, and works with integer, real, index, angle.... but never with boolean!!!!!
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    I think you're right, it has to be a bug... well spotted... worth contacting support about, I think.

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Nope, you cannot concatenate anything with a boolean. The ONLY DisplayText expression that will work with a boolean is the boolean attribute itself. I added this as a feature suggestion recently.

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

  • ChakkuChakku Member Posts: 1,513
    @mrpacogp

    Make a text attribute and say when boolean is true, change to true and when boolean is false change to false and then display that text attribute

    This way, you have a text attribute thats essentailly mimicing the boolean, but is also displaying via display text.

    And if you're trying to chain booleans together, then make an integer attribute that x%2, then if its 1 its odd, and if its 2, its even.

    Hope I'm not mixed up, but I think this is what you want

    Chakku :)
  • mrpacogpmrpacogp Member Posts: 400
    @Chakku, very good idea!!
Sign In or Register to comment.