Question about display Text

steve86steve86 Member Posts: 806
edited November -1 in Working with GS (Mac)
Hi guys

Quick question I want to display the time it took the player to complete the level. I have in a fix variable the time it took the player to complete the level, and I'm using the display text behavior to let the user know the time.

Im trying to put this in the display text area and when I run it is says invalid expresion:

"Total Time"..game.totalTime.."Seconds".

Any idea whats wrong with that expression?

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
  • steve86steve86 Member Posts: 806
    Thank you for that video John, I did had a look a it before asking this but I already know how to make a timer.

    The question is how to display text and a constraint value using a single display text behavior.

    for instance in Java you could use "Total Time:"+totaltimevariable"+"Seconds". Im asking what is the command in game salad that would so the same. Because if I put this in the text area of the display text behavior it will say invalid expression.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Did you use the expression editor and select the attribute from the attribute list?

    "Total Time"..game.totalTime.."Seconds"

    would be correct.
  • steve86steve86 Member Posts: 806
    Hello CodeMonkey

    Yes I did and i got it to display the following "Totaltime9.41312Seconds" Without spaces between the text and the attribute.

    For some reason when I select the attribute into the display text area it wont let me put spaces between words anymore, and also it adds a lot of decimal numbers to the attributed.

    I only want to display two decimals and if I display just the attribute it displays two decimals just fine, but when I add text and attributes to the display text area its when it gets weird by not letting me put spaces between words and it adds a lot of decimals.

    any idea what is going on?

    thanks a lot in advance
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Use Option+<space> to enter a space.
  • steve86steve86 Member Posts: 806
    That did the trick Thanks a LOT code monkey
Sign In or Register to comment.