Skyline Lua API  Version 1.0
Lua Script Reference for Skyline Game Engine.
time Class Reference

#include <LUA_API_Time.h>

Public Member Functions

void startTimer (int gameState, int object_id, float interval)
 When called this function it creates a new managed timer set to trigger at an interval(ms) specified by the variable interval. More...
 
void stopTimer (int gameState, int object_id)
 This function stops the timer named timer_id. More...
 
void startMultiTimer (int timerID, int object_id, float interval)
 When called this function it creates a new managed Multi Timer set to trigger at an interval(ms) specified by the variable interval. More...
 
void stopMultiTimer (int timerID, int object_id)
 This function stops the Multi Timer named timer_id. More...
 

Detailed Description

This area covers time functions. The current timer system alows each script to have one timer for the available states.
Use as time.function()
For more information on how these functions can be used please visit the User Manual - https://home.aurasoft-skyline.co.uk

Member Function Documentation

void time::startMultiTimer ( int  timerID,
int  object_id,
float  interval 
)

When called this function it creates a new managed Multi Timer set to trigger at an interval(ms) specified by the variable interval.

Parameters
timerID:Set the timer ID that this timer is to be associated with.
object_id:Set the object containing the timer
interval:The timers tick rate in ms

Multi Timers can have more than one timer running per script or micro script but do not respond to the
current game state. Once started these timers will run until a call to stopMultiTimer is made.

The following is a Small Example on how to use this function:

obj         = 0 -- | Define a variable for our object ID
count       = 0
function onInit(objID)
    obj = objID;
    time.startMultiTimer(1,obj,1000);
    time.startMultiTimer(2,obj,2000);
    time.startMultiTimer(3,obj,3000);
end

function onMultiTimer(timerID)
    if(timerID==1)then
        time.stopMultiTimer(1, obj);
        sky.lprint("STOPPING TIMER ID 1");
    end

    if(timerID==2)then
        time.stopMultiTimer(2, obj);
        sky.lprint("STOPPING TIMER ID 2");
    end

    if(timerID==3)then
        time.stopMultiTimer(3, obj);
        sky.lprint("STOPPING TIMER ID 3");
    end
end
void time::startTimer ( int  gameState,
int  object_id,
float  interval 
)

When called this function it creates a new managed timer set to trigger at an interval(ms) specified by the variable interval.

Parameters
gameState:Set the game state that this timer is to be associated with.
object_id:Set the object containing the timer
interval:The timers tick rate in ms

The following is a Small Example on how to use this function:

obj         = 0 -- | Define a variable for our object ID
count       = 0
function onInit(objID)
    obj = objID;
    time.startTimer(1, obj, 1000);
    sky.trace();
end

function onTimer()
    sky.lprint( count );
    count = count + 1;
end

function onStop()
    time.stopTimer(1, obj);
end
void time::stopMultiTimer ( int  timerID,
int  object_id 
)

This function stops the Multi Timer named timer_id.

Parameters
timerID:Set the Timer ID that this timer is associated with.
object_id:Set the object containing the timer

Multi Timers can have more than one timer running per script or micro script but do not respond to the
current game state. Once started these timers will run until a call to stopMultiTimer is made.

The following is a Small Example on how to use this function:

obj         = 0 -- | Define a variable for our object ID
count       = 0
function onInit(objID)
    obj = objID;
    time.startMultiTimer(1,obj,1000);
    time.startMultiTimer(2,obj,2000);
    time.startMultiTimer(3,obj,3000);
end

function onMultiTimer(timerID)
    if(timerID==1)then
        time.stopMultiTimer(1, obj);
        sky.lprint("STOPPING TIMER ID 1");
    end

    if(timerID==2)then
        time.stopMultiTimer(2, obj);
        sky.lprint("STOPPING TIMER ID 2");
    end

    if(timerID==3)then
        time.stopMultiTimer(3, obj);
        sky.lprint("STOPPING TIMER ID 3");
    end
end
void time::stopTimer ( int  gameState,
int  object_id 
)

This function stops the timer named timer_id.

Parameters
gameState:Set the game state that this timer is associated with.
object_id:Set the object containing the timer

The following is a Small Example on how to use this function:

obj         = 0 -- | Define a variable for our object ID
count       = 0
function onInit(objID)
    obj = objID;
    time.startTimer(1, obj, 1000);
    sky.trace();
end

function onTimer()
    sky.lprint( count );
    count = count + 1;
end

function onStop()
    time.stopTimer(1, obj);
end

The documentation for this class was generated from the following file: