Function; Rule_AddInterval - HWRM/KarosGraveyard GitHub Wiki

Rule_AddInterval(<function_name>, <interval>)

Description

Calls a named function periodically. The name of the function is case-sensitive.

⚠️ The named function needs to be globally defined in the same scope as the code using Rule_AddInterval. The easiest ways to do this are to just write these functions in the same file as the usage of Rule_AddInterval, or to seperate them into other files and import them via dofilepath/doscanpath.

Arguments

Param Type Description
function_name string The name of a function. This function needs to be globally available. Casing DOES matter.
interval string The interval (in seconds) between calls to the named function.

Example

function printTheTime()
 print("current gametime: " .. tostring(Universe_GameTime()));
end

-- elsewhere...
-- calls our 'printTheTime' function every 1.25 seconds:
Rule_AddInterval("printTheTime", 1.25);

Related Pages

⚠️ **GitHub.com Fallback** ⚠️