Zeldaboy111

Skript #227 - test

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