Advertisement
Guest User

FrewtyLang

a guest
Mar 19th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.02 KB | None | 0 0
  1. options:
  2. watermark: &3[&bFREWTY LANG&3] &4-&7
  3. on load:
  4. clear {effects::*}
  5. clear {events::*}
  6. clear {Execution order::*}
  7. #TEMP
  8. loop {integers::*}:
  9. deleteint(loop-value)
  10. clear {integers::*}
  11. #TEMP
  12. createeffect("+ ")
  13. createeffect("- ")
  14. createeffect("broadcast ")
  15. createeffect("tp plr ")
  16. createeffect("cool effect man")
  17. createexpression("plr")
  18. createevent("chat")
  19. createevent("die")
  20. createevent("join")
  21. createevent("left click")
  22. createevent("right click")
  23. if dir "plugins/FrewtyLang/scripts" doesn't exist:
  24. create dir "plugins/FrewtyLang/scripts"
  25. broadcast "{@watermark} &c""V1.0.0"" &8IS RUNNING"
  26. function reload(filename: text):
  27. clear {lines::*}
  28. set {linescount} to line count of file "plugins/FrewtyLang/scripts/%{_filename}%.txt"
  29. loop {linescount} times:
  30. set {_linecontent} to line loop-num in file "plugins/FrewtyLang/scripts/%{_filename}%.txt"
  31. add {_linecontent} to {lines::*}
  32. broadcast "{@watermark} Loaded line &8%loop-num%&7>&d'&5%{_linecontent}%&d'"
  33. loop {linescount} times:
  34. if {eventline} = 0:
  35. variablefunction({lines::%loop-num%})
  36. # if {lines::%loop-num-1%} starts with "!":
  37. # stop
  38. function createexpression(expressionname: text):
  39. add {_expressionname} to {expressions::*}
  40. function createevent(eventname: text):
  41. add {_eventname} to {events::*}
  42. function createeffect(effectname: text):
  43. add {_effectname} to {effects::*}
  44. function createint(intname: text , intval: integer ):
  45. set {int-%{_intname}%} to {_intval}
  46. function deleteint(intname: text):
  47. delete {int-%{_intname}%}
  48.  
  49.  
  50. function read(eventname: text,arg1: text,arg2: text):
  51. set {eventline} to 0
  52. set {eventend} to 0
  53. loop {linescount} times:
  54. # if {eventline} = 0:
  55. # variablefunction({lines::%loop-num%})
  56. if {eventline} != 0:
  57. if {lines::%loop-num%} starts with "X" or "x" or "cancel" or "Cancel" or "cancel event" or "cancel Event" or "Cancel Event" or "Cancel event":
  58. stop
  59. if {lines::%loop-num%} starts with "_":
  60. continue
  61. loop {events::*}:
  62. if {lines::%loop-num-1%} starts with "%{_eventname}%:":
  63. #broadcast "this is %{_eventname}%:"
  64. #set {Current Event} to {_eventname}
  65. set {eventline} to loop-num-1
  66. loop {linescount} times:
  67. exit 1 loop
  68. else:
  69. if {eventline} != 0:
  70. loop {events::*}:
  71. if {lines::%loop-num-1%} starts with "!":
  72. if loop-num-1 > {eventline}:
  73. set {eventline} to 0
  74. stop
  75.  
  76. if {lines::%loop-num-1%} does not contain loop-value-2:
  77. loop {effects::*}:
  78. #broadcast {effects::%loop-index%}
  79. if {lines::%loop-num-1%} starts with "%{effects::%loop-index-1%}%":
  80. if loop-num-1 >= {eventline}:
  81. effectfunction({effects::%loop-index-1%},{lines::%loop-num-1%},{_arg1},{_arg2})
  82. exit 1 loops
  83. #fold
  84. command /fl [<text>] [<text>]:
  85. permission: fl
  86. trigger:
  87. if arg-1 is not set:
  88. broadcast "{@watermark}"
  89. broadcast " &1/fl &c[1<reload/r/load/l>,2<debug/d>]"
  90. broadcast " &c[1<script name>,2<event/events>]"
  91. broadcast "&4&lONLY USE DEBUG IF YOU KNOW WHAT YOU ARE DOING"
  92. if arg-1 = "reload" or "r" or "load" or "l":
  93. if file "plugins/FrewtyLang/scripts/%arg-2%.txt" exists:
  94. broadcast "{@watermark} &4RELOADING -%arg-2%-"
  95. reload(arg-2)
  96. if arg-1 = "debug" or "d":
  97. if arg-2 = "events" or "event":
  98. broadcast "{@watermark} &4EVENTS:&7 %{events::*}%"
  99. #EFFECT FUNCTION
  100. function effectfunction(effectname: text,line: text,arg1: text,arg2: text):
  101. if {_effectname} is "broadcast ":
  102. set {_message} to {_line}
  103. set {_colored chat::*} to {_message} split at " "
  104. if {_colored chat::2} is "colored" or "clrd" or "color" or "clr":
  105. if {_line} contains "~i@":
  106. loop {_colored chat::*}:
  107. loop {integers::*}:
  108. if {_message} contains "~i@%loop-value-2%~":
  109. replace "~i@%loop-value-2%~" in {_message} with "%{int-%loop-value-2%}%"
  110. replace "%{_colored chat::2}% " in {_message} with ""
  111. replace {_effectname} in {_message} with ""
  112. loop {expressions::*}:
  113. if {_message} contains "~%loop-value-2%~":
  114. replace "~%loop-value-2%~" in {_message} with {_arg1}
  115. broadcast colored {_message}
  116. else:
  117. replace "%{_colored chat::2}% " in {_message} with ""
  118. replace {_effectname} in {_message} with ""
  119. loop {integers::*}:
  120. if {_message} contains "~i@%loop-value%~":
  121. replace "~i@%loop-value%~" in {_message} with "%{int-%loop-value%}%"
  122. loop {expressions::*}:
  123. if {_message} contains "~%loop-value%~":
  124. replace "~%loop-value%~" in {_message} with {_arg1}
  125. broadcast colored {_message}
  126. else if {_colored chat::2} is not "colored" or "clrd" or "color" or "clr":
  127. if {_line} contains "~i@":
  128. loop {_colored chat::*}:
  129. replace {_effectname} in {_message} with ""
  130. loop {integers::*}:
  131. if {_message} contains "~i@%loop-value-2%~":
  132. replace "~i@%loop-value-2%~" in {_message} with "%{int-%loop-value-2%}%"
  133. loop {expressions::*}:
  134. if {_message} contains "~%loop-value-2%~":
  135. replace "~%loop-value-2%~" in {_message} with {_arg1}
  136. broadcast {_message}
  137. else:
  138. replace {_effectname} in {_message} with ""
  139. loop {integers::*}:
  140. if {_message} contains "~i@%loop-value%~":
  141. replace "~i@%loop-value%~" in {_message} with "%{int-%loop-value%}%"
  142. loop {expressions::*}:
  143. if {_message} contains "~%loop-value%~":
  144. replace "~%loop-value%~" in {_message} with {_arg1}
  145. # loop {expressions::*}:
  146. # if {_message} contains "~%loop-value%~":
  147. # set {_plrmsg::*} to {_message} split at "~"
  148. # loop {_plrmsg::*}:
  149. # if {_plrmsg::%loop-index-2%} is loop-value-1:
  150. # set {_loopindex} to loop-index-2
  151. # subtract 1 from {_loopindex}
  152. # if {_plrmsg::%{_loopindex}%} is not loop-value-1:
  153. # set {_loopindex} to loop-index-2
  154. # subtract 1 from {_loopindex}
  155. # if {_plrmsg::%{_loopindex}%} is not loop-value-1:
  156. # replace {_plrmsg::%loop-index-2%} in {_message} with {_arg1}
  157. broadcast {_message}
  158.  
  159.  
  160. if {_effectname} is "tp plr ":
  161. set {_message} to {_line}
  162. replace {_effectname} in {_message} with ""
  163. set {_tppositions::*} to {_message} split at " "
  164. loop {_tppositions::*}:
  165. loop {expressions::*}:
  166. if {_tppositions::%loop-index-1%} contains "~%loop-value-2%~":
  167. replace "~%loop-value-2%~" in {_tppositions::%loop-index-1%} with {_arg1}
  168. teleport ({_tppositions::1} parsed as a player) to ({_tppositions::2} parsed as a player)
  169. #broadcast "&3%{_tppositions::1}%%{_tppositions::2}%"
  170. if {_effectname} is "+ ":
  171. set {_message} to {_line}
  172. replace {_effectname} in {_message} with ""
  173. set {_added numbers::*} to {_message} split at " "
  174. if {_added numbers::2} contains "0" or "1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9":
  175. add ({_added numbers::2} parsed as a number) to {int-%{_added numbers::1}%}
  176. else:
  177. add {int-%{_added numbers::2}%} to {int-%{_added numbers::1}%}
  178. if {_effectname} is "- ":
  179. set {_message} to {_line}
  180. replace {_effectname} in {_message} with ""
  181. set {_subtracted numbers::*} to {_message} split at " "
  182. if {_subtracted numbers::2} contains "0" or "1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9":
  183. subtract ({_subtracted numbers::2} parsed as a number) from {int-%{_subtracted numbers::1}%}
  184. else:
  185. subtract {int-%{_subtracted numbers::2}%} from {int-%{_subtracted numbers::1}%}
  186.  
  187. #VARIABLE FUNCTION
  188. function variablefunction(line: text):
  189. set {_message} to {_line}
  190. if {_line} starts with "@":
  191. replace "@" in {_message} with ""
  192. if {_message} starts with "int.":
  193. replace "int." in {_message} with ""
  194. set {_intcomponents::*} to {_message} split at "="
  195. add {_intcomponents::1} to {integers::*}
  196. #broadcast {_message}
  197. createint({_intcomponents::1},({_intcomponents::2} parsed as an integer))
  198.  
  199. on left click:
  200. read("left click","%player%","%clicked block%")
  201. on join:
  202. read("join","%player%","")
  203. on chat:
  204. read("chat","%player%","%message%")
  205. on right click:
  206. read("right click","%player%","%clicked block%")
  207. on death:
  208. read("die","%victim%","%attacker%")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement