display text problem pleas help

mintmomegmintmomeg Member, PRO Posts: 261
edited November -1 in Working with GS (Mac)
I need show game.number1 x game number 2 by use display text and I give game.number1=1 and game.number 2=0 then I use text display by game.number1.."x"..game.number2 and result should be 1x0 but the result from gamesalad is 0 on actor.. please help

Comments

  • xarmianxarmian Member Posts: 124
    If you change the "x" to a different character like a y or t or even a string of several characters, or try putting a space on either side of it, does it display correctly? If you display just game.number1 and then just game.number2 do you get the correct result each time? I have noticed when trying to concatenate two numbers it will do strange things, but putting a space or character in-between usually resolved it, so I'm wondering if it's just the fact that it's an "x".
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi mintmomeg, xarmian is correct that the x is incorrect. To show the multiply symbol, you should use * which is shift8. Then you'll hve no probs. 1 * 0 equals 0 by the way! :-)

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

  • mintmomegmintmomeg Member, PRO Posts: 261
    @gyroscope if I need to show 1x0 not 1*0 what should I do... I make a math game no problem with other sign except this x sign and how can make space lik 1 + 1 not 1+1 please sugguest
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Try the following in the Expression Editor within the Display Text Behavior:

    game.number1.." x "..game.number2

    Don't forget the double full stops (..) either side of the x; this tells GS to join the expressions together (concatanate) with the text. Also notice the quote marks to tell GS this is text, not an expression. And finally, to get the space before and after the x in the Expression Editor, press alt space.

    :-)

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

  • mintmomegmintmomeg Member, PRO Posts: 261
    I already try but same result 0 not 1x1 and by the way spacebar cannot type too
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    mintmomeg said:
    I already try but same result 0 not 1x1 and by the way spacebar cannot type too

    I don't understand what you mean now. Either you want to actually show in the Display Text whatever is in number1 attribute, then a space, then a multiplication symbol, then a space, then whatever is in the second attribute called number2.

    So what shows when you preview is: 1 x 0

    The way to do this is described in my previous post.

    If you want 1 x 1 (for the result to be 1), then simply change the attribute game.number2 to 1.

    As for the spacebar, if you hold down the alt key (which might be called the option key on your keyboard) and press the spacebar while using the Expression Editor, you'll get the space you require. (if you do actually require it, i.e to show in Preview something like 1 x 0, or 3 x 7, etc; as I say, I'm confused now as to what you actually need!).

    Or if you want to simply multiply the contents of number1 with number2, and show the result, then in the Display Text via the Expression editor, put
    game.number1*game.number2
    And the result will be shown in Preview as:
    0

    (if, as in your example, game.number1 is 1 and game.number2 is 0)

    :-)

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

  • mintmomegmintmomeg Member, PRO Posts: 261
    Sorry, but gamesalad won't let be type the space in between the quotation marks and the 'x'. You can't type this (game.number1.." x "..game.number2) When ever i try to type it, it turns out to be this (game.number1.."x"..game.number2) with no space . I don't know what is the problem.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    No worries; you have to make sure that when the space bar is hit, the alt key is being held down, to make spaces in the Expression Editor. And providing you've selected the attributes via the Expression Editor drop down lists, and put in the two dots after and before the attributes, and the two quotation marks, it should work. I mean, it will work!

    :-)

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

Sign In or Register to comment.