Right mouse button question

  • #1, by smac96Friday, 22. March 2013, 13:34 12 years ago
    Hi,

    I think that Glenfx's tutorial is one of the best out there.

    In my game I'm using the "Runaway interface" (part 11 of the tutorial) and I have 2 questions about it.

    My actual situation is:

    MOUSE ENTERING OBJECT AREA:
    Set cursor LOOK
    Set command LOOK
    
    MOUSE LEAVING OBJECT AREA:
    Set cursor WALK
    Set command WALK
    
    RIGHT CLICK:
    Set cursor TALK
    Set command TALK
    


    Question 1:
    Is it possible to add a "cycle"? I mean, with the right click the cursor/command changes to TALK but with another right click is there any way to restart the cycle from the beginning (LOOK)? Now this is possible only leaving and entering again the action area.

    Question 2:
    Is there any way to assign more actions to the right click command?
    Example:
    Entering: LOOK
    Right click 1: TALK
    Right click 2: TAKE

    Thank you in advance for your help!

    Newbie

    97 Posts


  • #2, by afrlmeFriday, 22. March 2013, 13:40 12 years ago
    the GlenFX tutorial is a little out of date but for the most parts it is still quite valid wink

    have you looked at the demo game that comes with the freeware version of Visionaire Studio?
    it uses a right click cycle command & monkey island 3 style ring interface.

    setting the right click cycle command is simple enough - browse to "game" tab > "mouse properties" & you can control various elements of the mouse & even set custom commands of what clicking or holding x button should do.

    mouse wheel & middle button are currently only controllable via LUA Script by using the registerEventHandler with mouseEvent

    Imperator

    7285 Posts

  • #3, by smac96Friday, 22. March 2013, 16:54 12 years ago
    Now it works! Thank you AFRLme!!!

    I tried this and it works (for both "cycle" and "more actions" problem).

    Tell me if you think that this is a good solution or not:

    1) "Game tab > Mouse properties"
    Right mouse button > start following action
    SET VALUE "RIGHT CLICK" +1
    

    + With individual actions

    2) "Action area"

    - Right click (Immediate)

    If value "RIGHT CLICK" = 1
    Set command: TALK
    Set cursor: TALK
    else
    If value "RIGHT CLICK" = 2
    Set command: TAKE
    Set cursor: TAKE
    else
    If value "RIGHT CLICK" = 3
    Set command: LOOK
    Set cursor: LOOK
    Set value "RIGHT CLICK" 0
    End if
    


    - Cursor leaves object area
    Set command: WALK
    Set cursor: WALK
    Value "RIGHT CLICK" = 0
    

    Newbie

    97 Posts

  • #4, by afrlmeFriday, 22. March 2013, 17:04 12 years ago
    looks ok to me smile

    you don't actually have to use if value = 3 though as it is the last value so it could be included in the part after the final else

    !important: you should add the same amount of end if's as if's!

    was the cycle option not ok for what you needed?
    & in regards to my bit about the final else if: ignore if you plan on adding other actions & if else queries to the action list for right click.

    Imperator

    7285 Posts

  • #5, by smac96Friday, 22. March 2013, 17:11 12 years ago
    Do you mean I should change the right click action to this?

    If value "RIGHT CLICK" = 1
     Set command: TALK
     Set cursor: TALK
    
    else
    
    If value "RIGHT CLICK" = 2
     Set command: TAKE
     Set cursor: TAKE
    
    else
    
     Set command: LOOK
     Set cursor: LOOK
     Set value "RIGHT CLICK" = 0
    
    End if
    


    What do you mean about "the same amount of end if/if"? Can you edit the code above to explain me?

    About the cycle option, I just wanted it inside an action area. Like the "Runaway" interface. Now it works smile

    Newbie

    97 Posts

  • #6, by smac96Friday, 22. March 2013, 17:13 12 years ago
    PS: What do you suggest me to do in this case:

    The command "TAKE" should appear only if the variable "XYZ" is TRUE, else the command/cursor should be the next one of the list.

    Newbie

    97 Posts

  • #7, by afrlmeFriday, 22. March 2013, 17:20 12 years ago
    ah well use the method you wrote then smile

    I take it you only want the right click cycle to work when the user is hovering over an object?
    if so create a condition or value which will be set on mouse over an object & reset on mouse out.
    then wrap the right click mouse button actions inside of the condition or value.
    each time you call the right click command it will automatically check if it is one of the values & skip all the rest which is what the if else query is for wink

    remember you can wrap as many if queries inside of other if queries as you like but you should add end if after them.

    personally I prefer using LUA for the if else queries as it's much simpler to keep track of & write out as we can use various options such as and, or etc.

    Imperator

    7285 Posts

  • #8, by smac96Friday, 22. March 2013, 17:43 12 years ago
    Thank you again.

    So, I solved this way:

    If value "RIGHT CLICK" = 1
     Set cursor "TALK"
     Set command "TALK"
    End if
    
    If value "RIGHT CLICK" = 2
     If condizion "XYZ" is TRUE
      Set cursor "TAKE"
      Set command "TAKE"
     Else
      If condizion "XYZ" is FALSE
       Set cursor "LOOK"
       Set command "LOOK"
       Set Value "RIGHT CLICK" = 0
      End if
     End if
    End if
    
    If value "RIGHT CLICK" = 3
     Set cursor "LOOK"
     Set command "LOOK"
     Set Value "RIGHT CLICK" = 0
    End if
    


    PS: About LUA, I will write a new post in future about it. I really need some help about this feature but... not now ;-)

    Newbie

    97 Posts

  • #9, by afrlmeFriday, 22. March 2013, 18:03 12 years ago
    hmm having them in individual if else queries is not always the best idea as sometimes if you change a value or condition then it ends up getting performed in queries listed afterwards.

    if condition[cond_right_click] is true
     if value[val_right_click] = 0
      set value[val_right_click] to 1
      set cursor "talk"
      set command "talk"
     else
     if value[val_right_click] = 1
      if condition[cond_xyz] is true
       set value[val_right_click] to 2
       set cursor "take"
       set command "take"
      else
       set value[val_right_click] to 0
       set cursor "look"
       set command "look"
      end if
     else
      set value[val_right_click] to 0
      set cursor "look"
      set command "look"
     end if
     end if
    end if 
    


    I think? (off the top of my head)

    as for the LUA; if I can help then sure smile

    Imperator

    7285 Posts

  • #10, by smac96Friday, 22. March 2013, 18:54 12 years ago
    Perfect!

    Thank you again :-)

    Newbie

    97 Posts

  • #11, by afrlmeFriday, 22. March 2013, 19:15 12 years ago
    de na!
    you're welcome wink

    Imperator

    7285 Posts