DE EN FR ES IT CZ
Back Back to top

Rechte-Maustaste-gehalten-Aktion?

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  • #1, by Cross 14 years ago Quote
    Gibt es eine Möglichkeit, jeweils eine Rechte-Maustaste-gehalten- und -losgelassen-Aktion zu erstellen, die genauso funktionieren, wie die bei den Mauseinstellungen vorgegebenen für die linke Maustaste?

    Is there any way to create a "hold-right-mousebutton-action" that works similar to the hold-left-mousebutton-action-preset?

    Wäre für jeden Hinweis dankbar.
  • New to Visionaire Studio?

    Create point and click adventures without coding. The free version covers up to 25 scenes per project. For more scenes or to earn money with your game, you need a license.

    See the Indie Bundle Try it for free
  • #2, by afrlme 14 years ago Quote
    hmm not via the editor & the event handler only supports right button down, up, double click but not hold or holding...

    I suppose you could create a work around with Lua & the event handler possibly...

    something like on right button down set state/condition for pressed & then create some kind of timer thing maybe with the get time function & then if time has passed perform some action & on right button up set condition/state back to default.


    local timer = getTime() -- create the initial timer variable
    local tState = 0 -- set the initial state of the timer (mainLoop only checks if state = "1")
    local tHoldTime = 500 -- time value is in ms
    
    -- let's create the function for the mainLoop handler!
    function onMainLoop()
     if tState == 1 and timer >= tHoldTime then
      tState = 0 -- reset state back to default...
      -- do some action
     end
    end
    
    -- let's create the function for the mouseEvent listener!
    function onMouseEvent(eventType, mousePosition)
     if eventType == eEvtRightButtonDown then timer = getTime({flags=1, reset=true}); tState = 1 end
     if eventType == eEvtRightButtonUp then tState = 0 end
    end
    
    -- let's create the mouseEvent listener!
    registerEventHandler("mouseEvent", "onMouseEvent", {eEvtMouseMove, eEvtMouseLeftButtonDoubleClick, eEvtMouseLeftButtonDown, eEvtMouseLeftButtonUp, eEvtMouseLeftButtonHold, eEvtMouseLeftButtonHolding, eEvtMouseRightButtonDoubleClick, eEvtMouseRightButtonDown, eEvtMouseRightButtonUp, eEvtMouseMiddleButtonDown, eEvtMouseMiddleButtonUp, eEvtMouseWheelUp, eEvtMouseWheelDown})
    
    -- let's create the loop handler!
    registerEventHandler("mainLoop", "onMainLoop")
    


    this is just a rough example of something you could probably do...
    this is mostly written off the top of my head, so I'm not 100% sure if it's correct or not.
  • #3, by Cross 14 years ago Quote
    Thanks a lot. I'll give it a try.