This site has been archived and made available for preservation purposes. No edits can be made.

CreateTimer

(Difference between revisions)
Return to current revision
  1.  
    Creates a timer.
    [h="2"] Declaration [/h]
    [highlight=cpp]
    VAULTSCRIPT VAULTSPACE Timer (*VAULTAPI(CreateTimer))(VAULTSPACE RawFunction(), VAULTSPACE Interval) _CPP(noexcept);
    [/highlight]
    [highlight=c]
    native CreateTimer(const func{}, interval);
    [/highlight]
    [h="2"] Parameters [/h]
  2. -
    [b][wiki="Function"]vaultmp::Function[/wiki][/b] (C++ only) - the function of the timer
    [b]func[/b] (PAWN only) - the name of the timer's function
    [b][wiki="Interval"]vaultmp::Interval[/wiki][/b] - the timer interval in milliseconds
  3. +
    [b][wiki="Function"]Function[/wiki][/b] - the function of the timer
    [b][wiki="Interval"]Interval[/wiki][/b] - the timer interval in milliseconds
  4.  
    [h="2"] Return value [/h]
  5. -
    Returns a [wiki="Timer"]vaultmp::Timer[/wiki] referring to the newly created timer.
  6. +
    Returns a [wiki="Timer"]Timer[/wiki] referring to the newly created timer.
  7.  
    [h="2"] Usage example (C++) [/h]
    [highlight=cpp]
  8. -
    vaultmp::Result VAULTSCRIPT MyTimer()
  9. +
    Result VAULTSCRIPT MyTimer()
  10.  
    {
    // Timer function
  11. -
    return 0;
  12. +
    return static_cast<Result>(0);
  13.  
    }
  14. -
    vaultmp::Void VAULTSCRIPT exec()
  15. +
    Void VAULTSCRIPT exec() noexcept
  16.  
    {
  17. -
    CreateTimer(&MyTimer, 5000);
  18. +
    CreateTimer(MyTimer, static_cast<Interval>(5000));
  19.  
    }
    [/highlight]
    [h="2"] Usage example (PAWN) [/h]
    [highlight=c]
    forward MyTimer();
    public MyTimer()
    {
    // Timer function
    return 0;
    }
    main()
    {
    CreateTimer("MyTimer", 5000);
    }
    [/highlight]
    [h="2"] Related pages [/h]
    [list][*][wiki]CreateTimerEx[/wiki]
    [*][wiki]KillTimer[/wiki]
    [/LIST]
    [category]VaultMP interface[/category]
    [category]Scripting functions[/category]
    [category]Misc functions[/category]