Zeldaboy111

Skript #218 - test

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