This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Need Help with Lua Script for Group Object Control
#7
Thanks for the reply!

This one is working

Code:
-- Define the group object
local myobject = grp.find('0/0/21')

-- Define the time duration in seconds
local fiveMinutesInSeconds = 5 * 60
local threeMinutesInSeconds = 3 * 60

-- Check the last update time of the group object
local lastUpdateTime = myobject.updatetime

-- Check if the group object has not been updated for at least 5 minutes
if os.time() - lastUpdateTime >= fiveMinutesInSeconds then
    -- Turn on the group object
    myobject:write(true)

    -- Wait for 3 minutes
    os.sleep(threeMinutesInSeconds)

    -- Turn off the group object
    myobject:write(false)
end
Reply


Messages In This Thread
RE: Need Help with Lua Script for Group Object Control - by josdegroot - 18.07.2023, 19:27

Forum Jump: