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

CreateTimerEx

(Difference between revisions)
Return to current revision
  1.  
    Creates a timer with an argument list.
    [h="2"] Declaration [/h]
    [highlight=cpp]
  2. -
    VAULTSCRIPT vaultmp::Timer (*CreateTimerEx)(vaultmp::Function, vaultmp::Interval, vaultmp::String, ...);
  3. +
    VAULTSCRIPT VAULTSPACE Timer (*VAULTAPI(CreateTimerEx))(VAULTSPACE RawFunction(), VAULTSPACE Interval, VAULTSPACE cRawString, ...) _CPP(noexcept);
    [/highlight]
    [highlight=c]
  4.  
    native CreateTimerEx(const func{}, interval, const def{}, {Fixed,Float,_}:...);
    [/highlight]
    [h="2"] Parameters [/h]
  5. -
    [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
    [b]def[/b] - the parameter list of the function. This is a string containing a sequence of:
  6. +
    [b][wiki="Function"]Function[/wiki][/b] - the function of the timer
    [b][wiki="Interval"]Interval[/wiki][/b] - the timer interval in milliseconds
    [b][wiki]cRawString[/wiki][/b] - the parameter list of the function. This is a string containing a sequence of:
  7.  
    [list][*]i - Integer (4 byte)
    [*]l - Long integer (8 byte)
    [*]f - Floating-point (8 byte)
    [*]p - Pointer (4 byte)
    [*]s - String (const char*)
    [/LIST]
    [b]...[/b] - the arguments. Must match the previously defined definition.
    [h="2"] Return value [/h]
  8. -
    Returns a [wiki="Timer"]vaultmp::Timer[/wiki] referring to the newly created timer.
  9. +
    Returns a [wiki="Timer"]Timer[/wiki] referring to the newly created timer.
  10.  
    [h="2"] Usage example (C++) [/h]
    [highlight=cpp]
  11. -
    vaultmp::Result VAULTSCRIPT MyTimer(unsigned int a, unsigned int b, const char* c)
  12. +
    Result VAULTSCRIPT MyTimer(int a, int b, const char* c)
  13.  
    {
    // Timer function
  14. -
    return 0;
  15. +
    return static_cast<Result>(0);
  16.  
    }
  17. -
    vaultmp::Void VAULTSCRIPT exec()
  18. +
    Void VAULTSCRIPT exec() noexcept
  19.  
    {
  20. -
    CreateTimerEx(reinterpret_cast<Function>(&MyTimer), 5000, "iis", 1, 2, "www.vaultmp.com");
  21. +
    // C++ template version (type-safe, deduces type string)
    CreateTimerEx(MyTimer, static_cast<Interval>(5000), 1, 2, "www.vaultmp.com");
  22.  
    }
    [/highlight]
    [h="2"] Usage example (PAWN) [/h]
    [highlight=c]
    forward MyTimer(a, b, const c{});
    public MyTimer(a, b, const c{})
    {
    // Timer function
    return 0;
    }
    main()
    {
    CreateTimerEx("MyTimer", 5000, "iis", 1, 2, "www.vaultmp.com");
    }
    [/highlight]
    [h="2"] Related pages [/h]
    [list][*][wiki]CreateTimer[/wiki]
    [*][wiki]KillTimer[/wiki]
    [/LIST]
    [category]VaultMP interface[/category]
    [category]Scripting functions[/category]
    [category]Misc functions[/category]