Zeldaboy111

Skript #222 - test

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