Zeldaboy111

Skript #205 - f

Jul 11th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 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. if loop-block is air:
  8. set block at location of loop-block to green glass block
  9.  
  10.  
  11. else:
  12. set {_block::%location of loop-block%} to loop-block
  13. set block at location of loop-block to red glass block
  14.  
  15.  
  16.  
  17. function getDirectionalBlock(i: item, d: direction) :: item:
  18. set {_block::north} to 1
  19. set {_block::south} to 3
  20. set {_block::west} to 4
  21. set {_block::east} to 5
  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. function getOppositeDirection(direction: direction) :: direction:
  45. loop split "%{_direction}%" by "and":
  46. if {_dir} is not set:
  47. set {_dir} to numbersIn(loop-value)
  48. set {_final} to loop-value
  49.  
  50. else if numbersIn(loop-value) > {_dir}:
  51. set {_dir} to numbersIn(loop-value)
  52. set {_final} to loop-value
  53.  
  54. if {_final} contains "north":
  55. return north
  56. if {_final} contains "east":
  57. return east
  58. if {_final} contains "south":
  59. return south
  60. if {_final} contains "west":
  61. return west
  62.  
  63.  
  64.  
  65. function numbersIn(s: String) :: number:
  66. set {_return} to ""
  67. loop {_s} split at "":
  68. set {_num} to loop-value parsed as a number
  69. if {_num} is set:
  70. "%{_num}%" = "%loop-value%"
  71. set {_return} to "%{_return}%%{_num}%"
  72.  
  73. return {_return} parsed as a number
  74.  
  75. function addNumber(x: number, y: number, z: number, w: world, dir: direction, num: number) :: location:
  76. if {_dir} is north:
  77. #send "%{_z}%"
  78. remove {_num} from {_z}
  79.  
  80. if {_dir} is east:
  81. add {_num} to {_x}
  82.  
  83. if {_dir} is south:
  84. add {_num} to {_z}
  85.  
  86. if {_dir} is west:
  87. remove {_num} from {_x}
  88.  
  89. set {_return} to location {_x}, {_y}, {_z} of world "%{_w}%"
  90. return {_return}
  91.  
  92. function remove(x: String, y: String, z: String, loc2: location, world: String, block: String):
  93. set {_loc1} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
  94. #set {_loc2} to location ({_x2} parsed as a number), ({_y2} parsed as a number), ({_z2} parsed as a number) of world "%{_world}%"
  95. if {_block} is "scematic_dirt_machine":
  96. loop blocks between block at {_loc1} and block at {_loc2}:
  97. #set {block::%location of loop-block%::type} to loop-block
  98. set block at location of loop-block to {block::%location of loop-block%::type}
Add Comment
Please, Sign In to add comment