DaxSoft

Block Variables & Switches 1.0

Mar 6th, 2014
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. #==============================================================================
  2. # • Block Variables & Switche
  3. #==============================================================================
  4. # Autor: Dax
  5. # Versão: 1.0
  6. # Site: www.dax-soft.weebly.com
  7. # Requerimento: Dax Core
  8. #==============================================================================
  9. # • Descrição:
  10. #------------------------------------------------------------------------------
  11. # Quando a variável ou switche estiver com um determinado valor um bloco(que você
  12. # define) irá executar.
  13. #==============================================================================
  14. # • Como usar: CHAMAR SCRIPT|Ou numa classe ou método.
  15. #------------------------------------------------------------------------------
  16. # ************************ Variáveis ******************************************
  17. # var_block(id, value) { command }
  18. # * id : ID da variável.
  19. # * value : Quando ela estiver com esse valor.
  20. # * command : Comando que irá executar.
  21. # Exemplo:
  22. # var_block(1, 50) { $game_variables[2] = 100 }
  23. # ************************ Switches ******************************************
  24. # sw_block(id, value) { command }
  25. # * id : ID da switche.
  26. # * value : Quando ela estiver com esse valor.
  27. # * command : Comando que irá executar.
  28. # Exemplo:
  29. # sw_block(1, false) { msgbox("Ativar Switche")
  30. # $game_switches[1] = true
  31. # }
  32. #==============================================================================
  33. Dax.register(:block_variables_and_switches, "Dax", 1.0, "06/03/14")
  34. #==============================================================================
  35. # • Object
  36. #==============================================================================
  37. class Object
  38. #----------------------------------------------------------------------------
  39. # • Variáveis.
  40. #----------------------------------------------------------------------------
  41. def var_block(id, value, &block)
  42. return unless block_given?
  43. block.call if $game_variables[id] == value
  44. end
  45. #----------------------------------------------------------------------------
  46. # • Switches.
  47. #----------------------------------------------------------------------------
  48. def sw_block(id, value, &block)
  49. return unless block_given?
  50. block.call if $game_switches[id] == value
  51. end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment