Community Forum

delay on a gate trigger

Forum Overview >> Scripting

CategoryScripting
Created13.05.2019 16:46


John Pako (logic321) 13.05.2019 16:46
can you have a time on how long a gate keeps open once you hit the trigger

Bilbo Beutlin (BBeutlin) 13.05.2019 18:18
See LUADOC -> Objects -> AnimatedObject
I'd assume the attribute 'duration' determines the time.

John Pako (logic321) 13.05.2019 18:37
where is LUADOC -> Objects -> AnimatedObject

Bilbo Beutlin (BBeutlin) 13.05.2019 22:24
Click on top of this site -> Documentation

Viper Gts (ViperGTS96) 27.05.2019 16:20
AnimatedObject : https://gdn.giants-software.com/documentation_scripting_fs19.php?version=script&category=65&class=10321

For a general purpose delay in Lua you can use a variable (that equals your desired time in frames) then decrease it by 1 every update(frame) until it is <= 0...


primitive eg.

myScript = {}
myScript.delayTime = 20;

function myScript:update(dt)

    if myScript.delayTime <= 0 then
        --Run your code
    else
        myScript.delayTime = myScript.delayTime - 1;
    end;

end;


*to post spaces(tabs) in this forum: alt+255


Note: Log in to post. Create a new account here.