DayZ Enforce
Script API
Private Member Functions | Private Attributes | List of all members
Timer Class Reference

Timer class. Use when you want call function after some time, or repeatedly in time intervals. Call is not executed after the Timer object is deleted.
usage: More...

#include <tools.h>

Inheritance diagram for Timer:

Private Member Functions

void  Timer (int category=CALL_CATEGORY_SYSTEM)
void  Run (float duration, class obj, string fn_name, Param params=NULL, bool loop=false)
  Starts timer. More...
protected void  OnTimer ()

Private Attributes

protected string  m_function
protected Param  m_params

Detailed Description

Timer class. Use when you want call function after some time, or repeatedly in time intervals. Call is not executed after the Timer object is deleted.

class MyObject
autoptr Timer myTimer1;
autoptr Timer myTimer2;
autoptr Timer myTimer3;
void MyObject()
myTimer1 = new Timer();
myTimer1.Run(10, this, "Refresh"); // calls "Refresh" on "this" after 10 seconds
myTimer2 = new Timer();
myTimer2.Run(10, this, "Refresh", NULL, true); // calls "Refresh" on "this" every 10 seconds, until Pause or Stop is called
myTimer3 = new Timer();
myTimer3.Run(15, this, "Show", new Param1<bool>(false)); // calls "Show" on "this" with one bool argument after 15 seconds
void Refresh();
void Show(bool visible);

Constructor & Destructor Documentation

void Timer::Timer ( int  category = CALL_CATEGORY_SYSTEM )

References OnInit().

Member Function Documentation

void Timer::Run ( float  duration,
class obj  ,
string  fn_name,
Param  params = NULL,
bool  loop = false 

Starts timer.

duration function is executed after this time (in seconds).
obj target object on which function will be executed
fn_name name of function (on object "obj") which will be executed
params function arguments see Param for usage, default NULL (no arguments)
loop when true, timer is looped endlessly and function is executed after every loop.

References m_function, m_params, and OnStart().

Referenced by TrapBase::AddDamageToVictim(), EN5C_FishingRod_Base::Catching(), DayZIntroScene::CreateDefaultCharacter(), EntityDebugSync::EnableUpdate(), EnergyItem_Base::EnergyItem_Base(), EN5C_PlantBase::GiveWater(), EN5C_PlantBase::GrowthTimerTick(), ManBase::HideBodyStart(), HudDebug::Init(), ScriptConsole::Init(), SceneEditorMenu::Init(), IngameHud::Init(), EN5C_FishingRod_Base::Init(), EnergyItem_Base::Light(), MissionBase::MissionBase(), MissionServer::MissionServer(), ModifierPoolDisease::ModifierPoolDisease(), ModifierPoolEnvironment::ModifierPoolEnvironment(), ModifierPoolMain::ModifierPoolMain(), ModifierPoolPlayer::ModifierPoolPlayer(), NotifiersManager::NotifiersManager(), Testing::OnAttach(), ChatInputMenu::OnChange(), PlayerBase::OnCheckPlugRange(), PlayerBase::OnContinuousStart(), MissionGameplay::OnEvent(), InventoryMenu::OnShow(), ActionRepositionPluggedItem::OnStart(), PowerGenerator::OnWorkStart(), PlayerBase::PlayerBase(), ChatLine::Set(), TrapSpawnBase::SetActive(), EN5C_PlantBase::SetSpoiled(), Hologram::Setup(), Hologram::SetupCustom(), NotificationMessage::Show(), TrapSpawnBase::SpawnCatch(), TrapBase::StartActivate(), EN5C_FireplaceBase::StartCooling(), EN5C_PlantBase::StartGrowing(), EN5C_FireplaceBase::StartHeating(), PlayerBase::StartPlugInMode(), ComponentElectricDevice::StartUpdates(), DayZIntroScene::TakeToHands(), InventoryManager::TakeToHands(), InventoryViewBase::UpdateLock(), InventoryViewGrid::UpdateLock(), InventoryView::UpdateLock(), MainMenu::UpdateStats(), and ActionMenu::UpdateWidgets().

void Timer::OnTimer ( )

Member Data Documentation

protected string Timer::m_function

Referenced by OnTimer(), and Run().

protected Param Timer::m_params

Referenced by OnTimer(), and Run().

The documentation for this class was generated from the following files:
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)