Zeldaboy111

Skript #225 - test

Aug 14th, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. #Directions etc.
  2.  
  3. #Make all strings!
  4. function fillDir(p: player, block: String, world: String, d: direction, x: String, y: String, z: String, xa: String, ya: String, za: String, xa2: String, ya2: String, za2: String):
  5. clear {scematic::block::%{_p}%::types::*}
  6.  
  7. set {_x1} to {_x} parsed as a number
  8. set {_y1} to {_y} parsed as a number
  9. set {_z1} to {_z} parsed as a number
  10.  
  11. if {_d} is north OR south:
  12.  
  13. if firstChar({_za}) is "-":
  14. replace all "-" in {_za} with ""
  15. else:
  16. set {_za} to "-%{_za}%"
  17.  
  18. #set {_f} to firstChar({_xa})
  19. #set {_str} to "10"
  20. #send "&4%firstChar({_str})%" to console
  21. #send "&8%{_f}%" to {_p}
  22. if firstChar({_xa}) is "-":
  23. replace all "-" in {_xa} with ""
  24.  
  25. else:
  26. set {_xa} to "-%{_xa}%"
  27.  
  28. #send "&c%{_za2}%" to {_p}
  29. #set {_za} to {_za} parsed as a number
  30. #set {_xa} to {_xa} parsed as a number
  31.  
  32. #firstChar function maken om te kijken of het eerste karakter een '-' is.
  33. #send firstChar({_za2}) to {_p}
  34. send firstChar({_za2}) to console
  35.  
  36. if firstChar("%{_za2}%") is "-":
  37. send "&6%{_za2}%" to {_p}
  38. replace all "-" in {_za2} with ""
  39. #Remove eerste karakter van {_za2} functie (remFirstChar)
  40.  
  41. else:
  42. set {_za2} to "-%{_za2}%"
  43.  
  44.  
  45. if firstChar({_xa2}) is "-":
  46. replace all "-" in {_xa2} with ""
  47.  
  48. else:
  49. set {_xa2} to "-%{_xa2}%"
  50.  
  51. #set {_za2} to {_za2} parsed as a number
  52. #set {_xa2} to {_xa2} parsed as a number
  53.  
  54. send "&9%{_xa2}%" to console
  55. send "%{_ya2}%" to console
  56. send "%{_za2}%" to console
  57. send "%{_xa}%" to console
  58. send "%{_ya}%" to console
  59. send "&9%{_za}%" to console
  60.  
  61. set {_loc1} to location addDir({_d}, {_xa}, {_x1}), addDir({_d}, {_ya}, {_y1}), addDir({_d}, {_za}, {_z1}) of world "%{_world}%"
  62. set {_loc2} to location addDir({_d}, {_xa2}, {_x1}), addDir({_d}, {_ya2}, {_y1}), addDir({_d}, {_za2}, {_z1}) of world "%{_world}%"
  63.  
  64. else:
  65. if {_za} contains "-":
  66. replace all "-" in {_za} with ""
  67. else:
  68. set {_za} to "-%{_za}%"
  69.  
  70. if {_xa} contains "-":
  71. replace all "-" in {_xa} with ""
  72. else:
  73. set {_xa} to "-%{_xa}%"
  74.  
  75. set {_za} to {_za} parsed as a number
  76. set {_xa} to {_xa} parsed as a number
  77.  
  78. if {_za2} contains "-":
  79. replace all "-" in {_za2} with ""
  80. else:
  81. set {_za2} to "-%{_za2}%"
  82.  
  83. if {_xa2} contains "-":
  84. replace all "-" in {_xa2} with ""
  85. else:
  86. set {_xa2} to "-%{_xa2}%"
  87.  
  88. set {_za2} to {_za2} parsed as a number
  89. set {_xa2} to {_xa2} parsed as a number
  90.  
  91.  
  92. set {_loc1} to location addDir({_d}, {_za}, {_x1}), addDir({_d}, {_ya}, {_y1}), addDir({_d}, {_xa}, {_z1}) of world "%{_world}%"
  93. set {_loc2} to location addDir({_d}, {_za2}, {_x1}), addDir({_d}, {_ya2}, {_y1}), addDir({_d}, {_xa2}, {_z1}) of world "%{_world}%"
  94.  
  95. loop blocks between block at {_loc1} and block at {_loc2}:
  96. add "%location of loop-block%$%loop-block%" to {scematic::block::%{_p}%::types::*}
  97.  
  98. if loop-block is air:
  99. set block at location of loop-block to green glass block
  100.  
  101. else:
  102. set block at location of loop-block to red glass block
  103.  
  104.  
  105. function addDir(final: direction, rem: string, n: number) :: number:
  106. send "&c%{_n}%" to console
  107. #set {_rem} to {_rem} parsed as a number
  108. send {_rem} to console
  109. if firstChar({_rem}) is "-":
  110. replace all "-" in {_rem} with ""
  111. set {_rem} to {_rem} parsed as a number
  112. send "&6%{_rem}%" to console
  113. send "&e%{_n} - {_rem}%" to console
  114. if {_final} is north:
  115. remove {_rem} from {_n}
  116.  
  117. if {_final} is east:
  118. add {_rem} to {_n}
  119.  
  120. if {_final} is south:
  121. add {_rem} to {_n}
  122.  
  123. if {_final} is west:
  124. remove {_rem} from {_n}
  125.  
  126. else:
  127. set {_rem} to {_rem} parsed as a number
  128. if {_final} is north:
  129. add {_rem} to {_n}
  130.  
  131. if {_final} is east:
  132. remove {_rem} from {_n}
  133.  
  134. if {_final} is south:
  135. remove {_rem} from {_n}
  136.  
  137. if {_final} is west:
  138. add {_rem} to {_n}
  139.  
  140. send "%{_n}%" to console
  141. return {_n}
  142.  
  143. function firstChar(s: String) :: String:
  144. add {_s} to {_s::*}
  145.  
  146. loop {_s::*}:
  147. set {_fc} to first character of loop-value
  148.  
  149. if {_fc} is "-":
  150. return {_fc}
  151.  
  152. else:
  153. return "<none>"
  154.  
  155. #send ({_fc} parsed as a string) to console
  156. set {_fc} to {_fc} parsed as a String
  157. return {_fc}
Add Comment
Please, Sign In to add comment