This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
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 freelocal 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")