Zeldaboy111

Skript #219 - test

Jul 16th, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 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. clear {scematic::block::%{_p}%::types::*}
  5.  
  6. set {_x1} to {_x} parsed as a number
  7. set {_y1} to {_y} parsed as a number
  8. set {_z1} to {_z} parsed as a number
  9.  
  10. if {_d} is north OR south:
  11. if {_za} contains "-":
  12. replace all "-" in {_za} with ""
  13. else:
  14. set {_za} to "-%{_za}%"
  15.  
  16. if {_xa} contains "-":
  17. replace all "-" in {_xa} with ""
  18. else:
  19. set {_xa} to "-%{_xa}%"
  20.  
  21. set {_za} to {_za} parsed as a number
  22. set {_xa} to {_xa} parsed as a number
  23.  
  24. if {_za2} contains "-":
  25. replace all "-" in {_za2} with ""
  26. else:
  27. set {_za2} to "-%{_za2}%"
  28.  
  29. if {_xa2} contains "-":
  30. replace all "-" in {_xa2} with ""
  31. else:
  32. set {_xa2} to "-%{_xa2}%"
  33.  
  34. set {_za2} to {_za2} parsed as a number
  35. set {_xa2} to {_xa2} parsed as a number
  36.  
  37.  
  38. set {_loc1} to location addDir({_d}, {_xa}, {_x1}), addDir({_d}, {_ya}, {_y1}), addDir({_d}, {_za}, {_z1}) of world "%{_world}%"
  39. set {_loc2} to location addDir({_d}, {_xa2}, {_x1}), addDir({_d}, {_ya2}, {_y1}), addDir({_d}, {_za2}, {_z1}) of world "%{_world}%"
  40.  
  41. else:
  42. if {_za} contains "-":
  43. replace all "-" in {_za} with ""
  44. else:
  45. set {_za} to "-%{_za}%"
  46.  
  47. if {_xa} contains "-":
  48. replace all "-" in {_xa} with ""
  49. else:
  50. set {_xa} to "-%{_xa}%"
  51.  
  52. set {_za} to {_za} parsed as a number
  53. set {_xa} to {_xa} parsed as a number
  54.  
  55. if {_za2} contains "-":
  56. replace all "-" in {_za2} with ""
  57. else:
  58. set {_za2} to "-%{_za2}%"
  59.  
  60. if {_xa2} contains "-":
  61. replace all "-" in {_xa2} with ""
  62. else:
  63. set {_xa2} to "-%{_xa2}%"
  64.  
  65. set {_za2} to {_za2} parsed as a number
  66. set {_xa2} to {_xa2} parsed as a number
  67.  
  68.  
  69. set {_loc1} to location addDir({_d}, {_za}, {_x1}), addDir({_d}, {_ya}, {_y1}), addDir({_d}, {_xa}, {_z1}) of world "%{_world}%"
  70. set {_loc2} to location addDir({_d}, {_za2}, {_x1}), addDir({_d}, {_ya2}, {_y1}), addDir({_d}, {_xa2}, {_z1}) of world "%{_world}%"
  71.  
  72. loop blocks between block at {_loc1} and block at {_loc2}:
  73. add "%location of loop-block%$%loop-block%" to {scematic::block::%{_p}%::types::*}
  74.  
  75. if loop-block is air:
  76. set block at location of loop-block to green glass block
  77.  
  78. else:
  79. set block at location of loop-block to red glass block
  80.  
  81.  
  82. function addDir(final: direction, rem: number, n: number) :: number:
  83. if {_final} is north:
  84. add {_rem} to {_n}
  85.  
  86. if {_final} is east:
  87. remove {_rem} from {_n}
  88.  
  89. if {_final} is south:
  90. remove {_rem} from {_n}
  91.  
  92. if {_final} is west:
  93. add {_rem} to {_n}
  94.  
  95. return {_n}
Add Comment
Please, Sign In to add comment