Zeldaboy111

Skript #224 - test

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