Zeldaboy111

Skript #206 - f

Jul 14th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. function fill(x: String, y: String, z: String, loc2: location, world: String, block: String):
  2. set {_loc1} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
  3. #set {_loc2} to location ({_x2} parsed as a number), ({_y2} parsed as a number), ({_z2} parsed as a number) of world "%{_world}%"
  4. if {_block} is "scematic_dirt_machine":
  5. loop blocks between block at {_loc1} and block at {_loc2}:
  6. set {block::%location of loop-block%::type} to loop-block
  7. send "L-b: %{block::%location of loop-block%::type}%" to console
  8.  
  9. if loop-block is air:
  10. set block at location of loop-block to green glass block
  11.  
  12.  
  13. else:
  14. set {_block::%location of loop-block%} to loop-block
  15. set block at location of loop-block to red glass block
  16.  
  17.  
  18.  
  19. function getDirectionalBlock(i: item, d: direction) :: item:
  20. set {_block::north} to 1
  21. set {_block::south} to 3
  22. set {_block::west} to 4
  23. set {_block::east} to 5
  24. return "%{_i}%:%{_block::%{_d}%}%" parsed as an item
  25.  
  26.  
  27. function getOppositeDirection(direction: direction) :: direction:
  28. loop split "%{_direction}%" by "and":
  29. if {_dir} is not set:
  30. set {_dir} to numbersIn(loop-value)
  31. set {_final} to loop-value
  32.  
  33. else if numbersIn(loop-value) > {_dir}:
  34. set {_dir} to numbersIn(loop-value)
  35. set {_final} to loop-value
  36.  
  37. if {_final} contains "north":
  38. return north
  39. if {_final} contains "east":
  40. return east
  41. if {_final} contains "south":
  42. return south
  43. if {_final} contains "west":
  44. return west
  45.  
  46. function getOppositeDirection(direction: direction) :: direction:
  47. loop split "%{_direction}%" by "and":
  48. if {_dir} is not set:
  49. set {_dir} to numbersIn(loop-value)
  50. set {_final} to loop-value
  51.  
  52. else if numbersIn(loop-value) > {_dir}:
  53. set {_dir} to numbersIn(loop-value)
  54. set {_final} to loop-value
  55.  
  56. if {_final} contains "north":
  57. return north
  58. if {_final} contains "east":
  59. return east
  60. if {_final} contains "south":
  61. return south
  62. if {_final} contains "west":
  63. return west
  64.  
  65.  
  66.  
  67. function numbersIn(s: String) :: number:
  68. set {_return} to ""
  69. loop {_s} split at "":
  70. set {_num} to loop-value parsed as a number
  71. if {_num} is set:
  72. "%{_num}%" = "%loop-value%"
  73. set {_return} to "%{_return}%%{_num}%"
  74.  
  75. return {_return} parsed as a number
  76.  
  77. function addNumber(x: number, y: number, z: number, w: world, dir: direction, num: number) :: location:
  78. if {_dir} is north:
  79. #send "%{_z}%"
  80. remove {_num} from {_z}
  81.  
  82. if {_dir} is east:
  83. add {_num} to {_x}
  84.  
  85. if {_dir} is south:
  86. add {_num} to {_z}
  87.  
  88. if {_dir} is west:
  89. remove {_num} from {_x}
  90.  
  91. set {_return} to location {_x}, {_y}, {_z} of world "%{_w}%"
  92. return {_return}
  93.  
  94. function remove(x: String, y: String, z: String, loc2: location, world: String, block: String):
  95. set {_loc1} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
  96. #set {_loc2} to location ({_x2} parsed as a number), ({_y2} parsed as a number), ({_z2} parsed as a number) of world "%{_world}%"
  97. send "Loc1: %{_loc1}%" to console
  98. send "Loc2: %{_loc2}%" to console
  99. if {_block} is "scematic_dirt_machine":
  100. loop blocks between block at {_loc1} and block at {_loc2}:
  101. #set {block::%location of loop-block%::type} to loop-block
  102. send "Loop-block: %{block::%location of loop-block%::type}%" to console
  103. set block at location of loop-block to air
Add Comment
Please, Sign In to add comment