Advertisement
RedstoneKing106

Untitled

Sep 14th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.69 KB | None | 0 0
  1. Command /bl [<text>] [<text>] [<text>]:
  2. trigger:
  3. arg-1 is "reload":
  4. arg-2 is set:
  5. reloadLink(arg-2, ("%world of player%" parsed as text), player)
  6. else:
  7. send "&8[&6&lBINLANG&8] &7/bl (reload) (RAW pastebin link)"
  8. else if arg-1 is "info":
  9. send "&8[&6&lBINLANG&8] &7Information:"
  10. send "&8[&6&lBINLANG&8] &7Version: 0.1.5"
  11. send "&8[&6&lBINLANG&8] &7Developer: Nutts"
  12. send "&8[&6&lBINLANG&8] &7Latest release date: June 30th, 2019"
  13. else if arg-1 is "addon":
  14. arg-2 is "import":
  15. send "&8[&6&lBINLANG&8] &7Importing addon..."
  16. set {_name} to getAddonFromName(arg-3)
  17. {_name} is "Error":
  18. send "&8[&6&lBINLANG&8] &cERROR IMPORTING ADDON!"
  19. else:
  20. send "&8[&6&lBINLANG&8] &7Successfully imported addon with name %{_name}%"
  21. else:
  22. send "&8[&6&lBINLANG&8] &7/bl (reload|info)"
  23.  
  24. function reloadLink(t: text, world: text, player: player):
  25. send "&8[&6&lBINLANG&8] &7Beginning parse of &e%{_t}%&7" to {_player}
  26. clear {onbreak.%{_world}%::*}, {onchat.%{_world}%::*} and {onplace.%{_world}%::*}
  27. set {_next} to ""1
  28. set {_lines::*} to text from url "%{_t}%"
  29. size of {_lines::*} < 401:
  30. loop {_lines::*}:
  31. set {_c} to {_lines::%loop-index%} #get the line of code
  32. {_next} is not "":
  33. {_c} is not "}"
  34. {_c} starts with " ":
  35. set {_c} to subtext of {_c} from characters 5 to length of {_c}
  36. else:
  37. send "&8[&6&lBINLANG&8] &7Error on line %loop-index%: Indentation expected because action takes place in the scope of an event block" to {_player}
  38. {_c} is "event::break {":
  39. {_next} is not "":
  40. send "&8[&6&lBINLANG&8] &7Error on line %loop-index%: Cannot place event inside another event" to {_player}
  41. else:
  42. set {_next} to "break"
  43. else if {_c} is "event::place {":
  44. {_next} is not "":
  45. send "&8[&6&lBINLANG&8] &7Error on line %loop-index%: Cannot place event inside another event" to {_player}
  46. else:
  47. set {_next} to "place"
  48. else if {_c} is "event::chat {":
  49. {_next} is not "":
  50. send "&8[&6&lBINLANG&8] &7Error on line %loop-index%: Cannot place event inside another event" to {_player}
  51. else:
  52. set {_next} to "chat"
  53. else if {_c} is "":
  54.  
  55. else if {_c} is "}":
  56. {_next} is not "":
  57. set {_next} to ""
  58. else:
  59. send "&8[&6&lBINLANG&8] &7Error on line %loop-index%: Unnecessary closing brace" to {_player}
  60. else if {_c} starts with "chat::broadcast """:
  61. checkNext({_next}, {_c}, {_world})
  62. else if {_c} starts with "chat::send """:
  63. checkNext({_next}, {_c}, {_world})
  64. else if {_c} is "cancel event" or "cancel the event" or "undo event" or "undo the event":
  65. checkNext({_next}, {_c}, {_world})
  66. else if {_c} starts with "set variable ":
  67. checkNext({_next}, {_c}, {_world})
  68. else if {_c} starts with "do player command":
  69. checkNext({_next}, {_c}, {_world})
  70.  
  71. else:
  72. send "&8[&6&lBINLANG&8] &7Error on line %loop-index%: Unrecognized action. '%{_c}%'" to {_player}
  73. else:
  74. send "&8[&6&lBINLANG&8] &7There was an error loading your script." to {_player}
  75. send "&8[&6&lBINLANG&8] &7Ended parse of &e%{_t}%&7" to {_player}
  76.  
  77. function checkNext(next: text, c: text, world: text):
  78. {_next} is "break":
  79. add {_c} to {onbreak.%{_world}%::*}
  80. else if {_next} is "place":
  81. add {_c} to {onplace.%{_world}%::*}
  82. else if {_next} is "join":
  83. add {_c} to {onjoin.%{_world}%::*}
  84. else if {_next} is "chat":
  85. add {_c} to {onchat.%{_world}%::*}
  86. else if {_next} is "firstJoin":
  87. add {_c} to {onfirstjoin.%{_world}%::*}
  88. else if {_next} is "quit":
  89. add {_c} to {onquit.%{_world}%::*}
  90. else:
  91. send "&8[&6&lBINLANG&8] &7Error: Event was not defined for action. '%{_c}%'" to {_player}
  92. on break:
  93. loop {onbreak.%world of player%::*}:
  94. set {_c} to {onbreak.%world of player%::%loop-index%}
  95. replace every "%%player%%" in {_c} with "%player%"
  96. set {_t} to check({_c}, player)
  97. {_t} is "cancel"
  98. cancel event
  99. on place:
  100. loop {onplace.%world of player%::*}:
  101. set {_c} to {onplace.%world of player%::%loop-index%}
  102. replace every "%%player%%" in {_c} with "%player%"
  103. set {_t} to check({_c}, player)
  104. {_t} is "cancel"
  105. cancel event
  106. on chat:
  107. loop {onchat.%world of player%::*}:
  108. set {_c} to {onchat.%world of player%::%loop-index%}
  109. replace every "%%message%%" in {_c} with message
  110. replace every "%%player%%" in {_c} with "%player%"
  111. set {_t} to check({_c}, player)
  112. {_t} is "cancel"
  113. cancel event
  114. function check(t: text, p: player) :: text:
  115. {_t} starts with "chat::broadcast """:
  116. replace every "chat::broadcast """ in {_t} with ""
  117. replace every "<" in {_t} with ""
  118. replace every "%%player%%" in {_t} with {_p}
  119. loop {variables.%{_uuid}%::*}:
  120. replace every "%%%loop-index%%%" in {_t} with loop-value
  121. broadcast colored subtext of {_t} from characters 1 to (length of {_t} - 1) to world of {_p}
  122. else if {_t} starts with "chat::send """:
  123. replace every "chat::send """ in {_t} with ""
  124. replace every "<" in {_t} with ""
  125. replace every "%%player%%" in {_t} with {_p}
  126. loop {variables.%{_uuid}%::*}:
  127. replace every "%%%loop-index%%%" in {_t} with loop-value
  128. send colored subtext of {_t} from characters 1 to (length of {_t} - 1) to {_p}
  129. else if {_t} is "cancel event" or "cancel the event" or "undo event":
  130. return "cancel"
  131. else if {_t} starts with "set variable ":
  132. replace every "set variable " in {_t} with ""
  133. replace every " to" in {_t} with ""
  134. set {_variable} to {_t}
  135. replace every "[" in {_variable} with ""
  136. replace every "]" in {_variable} with ""
  137. set {_parts::*} to {_variable} split at " "
  138. set {_variable} to {_parts::1}
  139. set {_value} to {_parts::2}
  140. replace every """" in {_value} with ""
  141. replace every "%%player%%" in {_value} with {_p}
  142. loop {variables.%{_uuid}%::*}:
  143. replace every "%%%loop-index%%%" in {_value} with loop-value
  144. set {variables.%{_uuid}%::%{_variable}%} to {_value}
  145. else if {_t} starts with "do player command":
  146. replace every "do player command """ in {_t} with ""
  147. loop {variables.%{_uuid}%::*}:
  148. replace every "%%%loop-index%%%" in {_t} with loop-value
  149. execute {_p} command subtext of {_t} from characters 1 to (length of {_t} - 1)
  150. else if {_t} starts with "add ":
  151. replace every "add " in {_t} with ""
  152. replace every "to " in {_t} with ""
  153. loop {variables.%{_uuid}%::*}:
  154. replace every "%%%loop-index%%%" in {_t} with loop-value
  155. set {_parts::*} to {_t} split at " "
  156. add ({_parts::1} parsed as number) to {variables.%{_uuid}%::%{_parts::2}%}
  157.  
  158. function getAddonFromName(t: text) :: text:
  159. set {_lines::*} to text from url "%{_t}%"
  160. loop {_lines::*}:
  161. if {_lines::1} != "##{addon options}":
  162. return "Error"
  163. set {_addonName} to {_lines::2}
  164. replace every "## addon_name: " in {_addonName} with ""
  165. return {_addonName}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement