Advertisement
DaxSoft

wait command

Jul 11th, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1.  
  2. class << Kernel
  3.  
  4. @@BLOCK_WAIT ||= {}
  5.  
  6. def block_wait(time, repeat=false, &block)
  7. return unless block_given?
  8. if @@BLOCK_WAIT[block.__id__]
  9. block.call
  10. @@BLOCK_WAIT[block.__id__] = false
  11. else
  12. if time <= 0
  13. @@BLOCK_WAIT[block.__id__] = true
  14. end
  15. end
  16. end
  17.  
  18. end
  19.  
  20.  
  21.  
  22.  
  23. class Scene_Title < Scene_Base
  24.  
  25. alias :testi :start
  26. def start
  27. @time = 10
  28. testi
  29. end
  30.  
  31. alias :test :update
  32. def update
  33. test
  34. @time -= 1 while @time >= 0
  35. Kernel::block_wait(@time) {
  36. msgbox "ok"
  37. }
  38. end
  39.  
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement