Zeldaboy111

Skript #209 - f

Jul 15th, 2019
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.00 KB | None | 0 0
  1. function fill(x: String, y: String, z: String, loc2: location, world: String, block: String, p: player):
  2. set {_loc1} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
  3. if {_block} is "scematic_dirt_machine":
  4. clear {scematic::block::%{_p}%::types::*}
  5. loop blocks between block at {_loc1} and block at {_loc2}:
  6. add "%location of loop-block%$%loop-block%" to {scematic::block::%{_p}%::types::*}
  7.  
  8. if loop-block is air:
  9. set block at location of loop-block to green glass block
  10.  
  11. else:
  12. set block at location of loop-block to red glass block
  13.  
  14.  
  15.  
  16. function getDirectionalBlock(i: item, d: direction) :: item:
  17. set {_block::north} to 1
  18. set {_block::south} to 3
  19. set {_block::west} to 4
  20. set {_block::east} to 5
  21. send "%{_i}%:%{_block::%{_d}%}%" to console
  22. return "%{_i}%:%{_block::%{_d}%}%" parsed as an item
  23.  
  24.  
  25. function getOppositeDirection(direction: direction) :: direction:
  26. loop split "%{_direction}%" by "and":
  27. if {_dir} is not set:
  28. set {_dir} to numbersIn(loop-value)
  29. set {_final} to loop-value
  30.  
  31. else if numbersIn(loop-value) > {_dir}:
  32. set {_dir} to numbersIn(loop-value)
  33. set {_final} to loop-value
  34.  
  35. if {_final} contains "north":
  36. return north
  37. if {_final} contains "east":
  38. return east
  39. if {_final} contains "south":
  40. return south
  41. if {_final} contains "west":
  42. return west
  43.  
  44.  
  45. function getUpStairDirection(i: item, d: direction, j: number) :: item:
  46. set {_block::north} to 3
  47. set {_block::south} to 2
  48. set {_block::west} to 1
  49. set {_block::east} to 8
  50. set {_rblock} to {_block::%{_d}%}
  51.  
  52. send "&6%{_i}%:%{_rblock}%" to console
  53. return "%{_i}%:%{_block::%{_d}%}%" parsed as an item
  54.  
  55. function getDownStairDirection(i: item, d: direction, j: number) :: item:
  56. set {_block::north} to 3
  57. set {_block::south} to 2
  58. set {_block::west} to 1
  59. set {_block::east} to 8
  60. set {_rblock} to {_block::%{_d}%}
  61.  
  62. send "&6%{_i}%:%{_rblock}%" to console
  63. return "%{_i}%:%{_block::%{_d}%}%" parsed as an item
  64.  
  65.  
  66.  
  67.  
  68. function getOppositeDirection(direction: direction) :: direction:
  69. loop split "%{_direction}%" by "and":
  70. if {_dir} is not set:
  71. set {_dir} to numbersIn(loop-value)
  72. set {_final} to loop-value
  73.  
  74. else if numbersIn(loop-value) > {_dir}:
  75. set {_dir} to numbersIn(loop-value)
  76. set {_final} to loop-value
  77.  
  78. if {_final} contains "north":
  79. return north
  80. if {_final} contains "east":
  81. return east
  82. if {_final} contains "south":
  83. return south
  84. if {_final} contains "west":
  85. return west
  86.  
  87.  
  88.  
  89. function numbersIn(s: String) :: number:
  90. set {_return} to ""
  91. loop {_s} split at "":
  92. set {_num} to loop-value parsed as a number
  93. if {_num} is set:
  94. "%{_num}%" = "%loop-value%"
  95. set {_return} to "%{_return}%%{_num}%"
  96.  
  97. return {_return} parsed as a number
  98.  
  99. function addNumber(x: number, y: number, z: number, w: world, dir: direction, num: number) :: location:
  100. if {_dir} is north:
  101. remove {_num} from {_z}
  102.  
  103. if {_dir} is east:
  104. add {_num} to {_x}
  105.  
  106. if {_dir} is south:
  107. add {_num} to {_z}
  108.  
  109. if {_dir} is west:
  110. remove {_num} from {_x}
  111.  
  112. set {_return} to location {_x}, {_y}, {_z} of world "%{_w}%"
  113. return {_return}
  114.  
  115. function remove(x: String, y: String, z: String, loc2: location, world: String, block: String, p: player):
  116. set {_loc1} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
  117. if {_block} is "scematic_dirt_machine":
  118. loop {scematic::block::%{_p}%::types::*}:
  119. set {_list} to loop-value
  120. set {_list::*} to {_list} split at "$"
  121.  
  122. set {_loc} to {_list::1}
  123. set {_type} to {_list::2}
  124. set {_loc::*} to {_loc} split at ","
  125.  
  126. set {_x} to {_loc::1}
  127. set {_y} to {_loc::2}
  128. set {_z} to {_loc::3}
  129. replace "x: " in {_x} with ""
  130. replace " y: " in {_y} with ""
  131. replace " z: " in {_z} with ""
  132.  
  133. set block at location at ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) in world "%{_world}%" to ({_type} parsed as an item)
Add Comment
Please, Sign In to add comment