Advertisement
LukeLC

wait_get_time (GameMaker Studio)

Dec 19th, 2018
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// @function   wait_get_time(index);
  2. /// @param      {int|string}    index
  3. /// @author     Lucas Chasteen <lucas.chasteen@xgasoft.com>
  4. /// @copyright  XGASOFT 2018, All Rights Reserved
  5.  
  6. /*
  7. Returns the current time remaining in the specified timer as a value of seconds.
  8.  
  9. If the timer does not exist, 0 will be returned instead.
  10.  
  11. Example usage:
  12.     var time_remaining = wait_get_time("my_timer")
  13.     draw_text(x, y, string(time_remaining));
  14. */
  15.  
  16. //If timer data exists...
  17. if (ds_exists(global.ds_wait, ds_type_map)) {
  18.     if (ds_map_exists(global.ds_wait, argument[0])) {
  19.         //... return the remaining time
  20.         return global.ds_wait[? argument[0]];
  21.     }
  22. }
  23.  
  24. //Otherwise return 0
  25. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement