Advertisement
LukeLC

wait_reset (GameMaker Studio)

Dec 19th, 2018
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// @function   wait_reset([index]);
  2. /// @param      {int|string}    index
  3. /// @author     Lucas Chasteen <lucas.chasteen@xgasoft.com>
  4. /// @copyright  XGASOFT 2018, All Rights Reserved
  5.  
  6. /*
  7. Resets a timer created with "wait".
  8.  
  9. If no timer index is specified, all timers will be reset.
  10.  
  11. Example usage:
  12.     wait_reset("my_timer");
  13.     wait_reset();
  14. */
  15.  
  16. //If timer data exists...
  17. if (ds_exists(global.ds_wait, ds_type_map)) {
  18.     if (argument_count > 0) {
  19.         //Reset individual timer, if specified
  20.         if (ds_map_exists(global.ds_wait, argument[0])) {
  21.             ds_map_delete(global.ds_wait, argument[0]);
  22.         }
  23.     } else {
  24.         //Otherwise reset all timers
  25.         ds_map_destroy(global.ds_wait);
  26.         global.ds_wait = -1;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement