Zeldaboy111

Skript #221 - test

Aug 5th, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 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 firstChar({_xa}) is "-";
  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. send firstChar({_za2}) to {_p}
  32. if firstChar("%{_za2}%") is "-":
  33. send "&6%{_za2}%" to {_p}
  34. #replace first "-" in {_za2} with ""
  35. #Remove eerste karakter van {_za2} functie (remFirstChar)
  36.  
  37. else:
  38. set {_za2} to "-%{_za2}%"
  39.  
  40. if {_xa2} contains "-":
  41. replace all "-" in {_xa2} with ""
  42. else:
  43. set {_xa2} to "-%{_xa2}%"
  44.  
  45. set {_za2} to {_za2} parsed as a number
  46. set {_xa2} to {_xa2} parsed as a number
  47.  
  48.  
  49. set {_loc1} to location addDir({_d}, {_xa}, {_x1}), addDir({_d}, {_ya}, {_y1}), addDir({_d}, {_za}, {_z1}) of world "%{_world}%"
  50. set {_loc2} to location addDir({_d}, {_xa2}, {_x1}), addDir({_d}, {_ya2}, {_y1}), addDir({_d}, {_za2}, {_z1}) of world "%{_world}%"
  51.  
  52. else:
  53. if {_za} contains "-":
  54. replace all "-" in {_za} with ""
  55. else:
  56. set {_za} to "-%{_za}%"
  57.  
  58. if {_xa} contains "-":
  59. replace all "-" in {_xa} with ""
  60. else:
  61. set {_xa} to "-%{_xa}%"
  62.  
  63. set {_za} to {_za} parsed as a number
  64. set {_xa} to {_xa} parsed as a number
  65.  
  66. if {_za2} contains "-":
  67. replace all "-" in {_za2} with ""
  68. else:
  69. set {_za2} to "-%{_za2}%"
  70.  
  71. if {_xa2} contains "-":
  72. replace all "-" in {_xa2} with ""
  73. else:
  74. set {_xa2} to "-%{_xa2}%"
  75.  
  76. set {_za2} to {_za2} parsed as a number
  77. set {_xa2} to {_xa2} parsed as a number
  78.  
  79.  
  80. set {_loc1} to location addDir({_d}, {_za}, {_x1}), addDir({_d}, {_ya}, {_y1}), addDir({_d}, {_xa}, {_z1}) of world "%{_world}%"
  81. set {_loc2} to location addDir({_d}, {_za2}, {_x1}), addDir({_d}, {_ya2}, {_y1}), addDir({_d}, {_xa2}, {_z1}) of world "%{_world}%"
  82.  
  83. loop blocks between block at {_loc1} and block at {_loc2}:
  84. add "%location of loop-block%$%loop-block%" to {scematic::block::%{_p}%::types::*}
  85.  
  86. if loop-block is air:
  87. set block at location of loop-block to green glass block
  88.  
  89. else:
  90. set block at location of loop-block to red glass block
  91.  
  92.  
  93. function addDir(final: direction, rem: number, n: number) :: number:
  94. if {_final} is north:
  95. add {_rem} to {_n}
  96.  
  97. if {_final} is east:
  98. remove {_rem} from {_n}
  99.  
  100. if {_final} is south:
  101. remove {_rem} from {_n}
  102.  
  103. if {_final} is west:
  104. add {_rem} to {_n}
  105.  
  106. return {_n}
  107.  
  108. function firstChar(s: String) :: string:
  109. add {_s} to {_s::*}
  110.  
  111. loop {_s::*}:
  112. set {_fc} to first character of loop-value
  113.  
  114. if {_fc} isn't set:
  115. return null
  116.  
  117. else:
  118. return {_fc}
Add Comment
Please, Sign In to add comment