Zeldaboy111

Skript #220 - test

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