Zeldaboy111

Skript #206 - f

Jul 15th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 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::types::*}
  5. loop blocks between block at {_loc1} and block at {_loc2}:
  6. add "%location of loop-block%$%loop-block%" to {scematic::block::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. return "%{_i}%:%{_block::%{_d}%}%" parsed as an item
  22.  
  23.  
  24. function getOppositeDirection(direction: direction) :: direction:
  25. loop split "%{_direction}%" by "and":
  26. if {_dir} is not set:
  27. set {_dir} to numbersIn(loop-value)
  28. set {_final} to loop-value
  29.  
  30. else if numbersIn(loop-value) > {_dir}:
  31. set {_dir} to numbersIn(loop-value)
  32. set {_final} to loop-value
  33.  
  34. if {_final} contains "north":
  35. return north
  36. if {_final} contains "east":
  37. return east
  38. if {_final} contains "south":
  39. return south
  40. if {_final} contains "west":
  41. return west
  42.  
  43. function getOppositeDirection(direction: direction) :: direction:
  44. loop split "%{_direction}%" by "and":
  45. if {_dir} is not set:
  46. set {_dir} to numbersIn(loop-value)
  47. set {_final} to loop-value
  48.  
  49. else if numbersIn(loop-value) > {_dir}:
  50. set {_dir} to numbersIn(loop-value)
  51. set {_final} to loop-value
  52.  
  53. if {_final} contains "north":
  54. return north
  55. if {_final} contains "east":
  56. return east
  57. if {_final} contains "south":
  58. return south
  59. if {_final} contains "west":
  60. return west
  61.  
  62.  
  63.  
  64. function numbersIn(s: String) :: number:
  65. set {_return} to ""
  66. loop {_s} split at "":
  67. set {_num} to loop-value parsed as a number
  68. if {_num} is set:
  69. "%{_num}%" = "%loop-value%"
  70. set {_return} to "%{_return}%%{_num}%"
  71.  
  72. return {_return} parsed as a number
  73.  
  74. function addNumber(x: number, y: number, z: number, w: world, dir: direction, num: number) :: location:
  75. if {_dir} is north:
  76. #send "%{_z}%"
  77. remove {_num} from {_z}
  78.  
  79. if {_dir} is east:
  80. add {_num} to {_x}
  81.  
  82. if {_dir} is south:
  83. add {_num} to {_z}
  84.  
  85. if {_dir} is west:
  86. remove {_num} from {_x}
  87.  
  88. set {_return} to location {_x}, {_y}, {_z} of world "%{_w}%"
  89. return {_return}
  90.  
  91. function remove(x: String, y: String, z: String, loc2: location, world: String, block: String, p: player):
  92. set {_loc1} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
  93. if {_block} is "scematic_dirt_machine":
  94. loop {scematic::block::types::*}:
  95. set {_list} to loop-value
  96. set {_list::*} to {_list} split at "$"
  97.  
  98. set {_loc} to {_list::1}
  99. set {_type} to {_list::2}
  100. set {_loc::*} to {_loc} split at ","
  101.  
  102. set {_x} to {_loc::1}
  103. set {_y} to {_loc::2}
  104. set {_z} to {_loc::3}
  105. replace "x: " in {_x} with ""
  106. replace " y: " in {_y} with ""
  107. replace " z: " in {_z} with ""
  108.  
  109. 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