Help needed for multi "button"

AppsterAppster Member Posts: 112
edited November -1 in Working with GS (Mac)
Hi all, need your advice on this. I have 3 buttons (A, B and C) and all of them are set with Mouse Down events + one game.Attribute. I want to be able to store the value to the attribute based on the button is click. When I tried (I display attribute using Display Text), I notice it is always detecting A when mouse click, even I click at B or C. How do I make the button to store attribute base on button I click?

Comments

  • AppsRacKAppsRacK Member Posts: 346
    include mouse position = inside in your rule.
  • AppsterAppster Member Posts: 112
    Thanks!!! Silly me... just one more question.

    My Button A, B or C actually is number (1, 2 and 3) and I have another button as "+"

    I want to be to click A & "+" & B to store the value of A+B. How to go about doing it? The display show A+B (1+2) instead of 3 (=1+2)
  • AppsRacKAppsRacK Member Posts: 346
    If im gonna do it i'll approach it like this.

    1. Make 4 attributes "PressA" "PressB" "PressC" & "PressPlus" and set them all to BOOL and 1 Integer attribute name it like Score or something.
    2. On your rule you could just set it like this:
    RULE
    ->if PressA == True && PressPlus == True && PressB == true;
    --> change Attribute game.Score = 3

    RULE
    ->if PressA == True && PressPlus == True && PressC == true;
    --> change Attribute game.Score = 4

    RULE
    ->if PressB == True && PressPlus == True && PressC == true;
    --> change Attribute game.Score = 5

    Thats how im gonna approach it but other may have a more efficient way.
    hope it helps.
    :)
  • AppsterAppster Member Posts: 112
    Thanks drahc. I can't do that bcoz I lots of number. So I wan an attribute to be able to store an equation such as 1+2=3 where 1, + and 2 is based on button pressed. How to make it store as equation?
  • AppsRacKAppsRacK Member Posts: 346
    i think you can but you need to detect first the touches on the button then you can use the expression editor. You can pass the value of wahtever button is press to a global attribute and add it using the expression editor.
  • AppsterAppster Member Posts: 112
    Thanks, drahc. How would be the Expression looks like? I tried
    game.A-value..game.EquationValue..game.B-value and it didn't work

    A-Value = value store for Button A
    B-Value = value store for Button B
    EquationValue = value store for Button C (+)
Sign In or Register to comment.