Zeldaboy111

Skript #217 - test

Jul 16th, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 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. set {_loc1} to location addDir({_d}, {_xa}, {_x1}), addDir({_d}, {_ya}, {_y1}), addDir({_d}, {_za}, {_z1}) of world "%{_world}%"
  15. set {_loc2} to location addDir({_d}, {_xa2}, {_x1}), addDir({_d}, {_ya2}, {_y1}), addDir({_d}, {_za2}, {_z1}) of world "%{_world}%"
  16.  
  17. #send "Loc1: %{_loc1}%" to console
  18. #send "Loc2: %{_loc2}%" to console
  19. loop blocks between block at {_loc1} and block at {_loc2}:
  20. add "%location of loop-block%$%loop-block%" to {scematic::block::%{_p}%::types::*}
  21.  
  22. if loop-block is air:
  23. set block at location of loop-block to green glass block
  24.  
  25. else:
  26. set block at location of loop-block to red glass block
  27.  
  28.  
  29. #function fillDir(x: String, y: String, z: String, loc2: location, world: String, block: String, p: player):
  30. #set {_loc1} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
  31. #if {_block} is "scematic_dirt_machine":
  32. # clear {scematic::block::%{_p}%::types::*}
  33. # loop blocks between block at {_loc1} and block at {_loc2}:
  34. # add "%location of loop-block%$%loop-block%" to {scematic::block::%{_p}%::types::*}
  35.  
  36. # if loop-block is air:
  37. # set block at location of loop-block to green glass block
  38.  
  39. # else:
  40. # set block at location of loop-block to red glass block
  41.  
  42. function addDirs(world: String, final: direction, rem: number, yrem: number, l: location) :: number:
  43. send "&6%{_l}%" to console
  44. loop split "%{_l}%" by ",":
  45.  
  46. if loop-value contains "x:":
  47. set {_x} to loop-value
  48. replace "x: " in {_x} with ""
  49. if loop-value contains "y:":
  50. set {_y} to loop-value
  51. replace " y: " in {_y} with ""
  52. if loop-value contains "z:":
  53. set {_z} to loop-value
  54. replace " z: " in {_z} with ""
  55.  
  56. set {_z} to ({_z} parsed as a number)
  57. set {_x} to ({_x} parsed as a number)
  58. set {_z} to ({_z} parsed as a number)
  59.  
  60. if {_final} is north:
  61. send "Before: %{_z}%" to console
  62. send "%{_rem}%" to console
  63.  
  64. add {_rem} to {_z}
  65. send "After: %{_z}%" to console
  66.  
  67. if {_final} is east:
  68. send "Before: %{_x}%" to console
  69. send "%{_rem}%" to console
  70.  
  71. add {_rem} to {_x}
  72. send "After: %{_x}%" to console
  73.  
  74. if {_final} is south:
  75. send "Before: %{_z}%" to console
  76. send "%{_rem}%" to console
  77.  
  78. add {_rem} to {_z}
  79. send "After: %{_z}%" to console
  80.  
  81. if {_final} is west:
  82. send "Before: %{_x}%" to console
  83. send "%{_rem}%" to console
  84.  
  85. remove {_rem} from {_x}
  86. send "After: %{_x}%" to console
  87.  
  88.  
  89. add {_yrem} to {_y}
  90.  
  91. set {_x} to "x: %{_x}%"
  92. set {_y} to "y: %{_y}%"
  93. set {_z} to "z: %{_z}%"
  94.  
  95. set {_loc} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
  96. send "%{_x}%, %{_y}%, %{_z}%, %{_world}%" to console
  97. send "&5%{_loc}%" to console
  98. return {_loc}
  99.  
  100.  
  101. function addDir(final: direction, rem: number, n: number) :: number:
  102. send "Before: %{_n}%" to console
  103. if {_final} is north:
  104. add {_rem} to {_n}
  105.  
  106. if {_final} is east:
  107. add {_rem} to {_n}
  108.  
  109. if {_final} is south:
  110. remove {_rem} from {_n}
  111.  
  112. if {_final} is west:
  113. remove {_rem} from {_n}
  114.  
  115. send "After: %{_n}%" to console
  116.  
  117. return {_n}
Add Comment
Please, Sign In to add comment