Jump to content

need help coding


Recommended Posts

local function StopBookTimer(inst_book)
    if inst_book.onreadtimer ~= nil
    then
        inst_book.onreadtimer:Cancel()
        inst_book.onreadtimer = nil
    end
end
local function OnReadTimerTick(inst_book)
    inst_book.onreadtimercounter = inst_book.onreadtimercounter + 1
    -- Do whatever you want here
    if inst_book.onreadtimercounter == 4 -- 4 times to do this function before stopping it.
    then
        StopBookTimer(inst_book)
    end
end
local function OnRead(inst_book)
    StopBookTimer(inst_book)
    inst_book.onreadtimercount = 0
    OnReadTimerTick(inst_book) -- Call it once immediately.
    inst_book.onreadtimer = inst_book:DoPeriodicTask(
        3, -- Repeat every 3 seconds after waiting 3 seconds.
        OnReadTimerTick
    )
end

Perhaps this may help you further.

Edited by CarlZalph
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...