Zeldaboy111

Skript #223 - test

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