Zeldaboy111

Skript #207 - f

Jul 15th, 2019
65
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::%{_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. 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. remove {_num} from {_z}
  77.  
  78. if {_dir} is east:
  79. add {_num} to {_x}
  80.  
  81. if {_dir} is south:
  82. add {_num} to {_z}
  83.  
  84. if {_dir} is west:
  85. remove {_num} from {_x}
  86.  
  87. set {_return} to location {_x}, {_y}, {_z} of world "%{_w}%"
  88. return {_return}
  89.  
  90. function remove(x: String, y: String, z: String, loc2: location, world: String, block: String, p: player):
  91. set {_loc1} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
  92. if {_block} is "scematic_dirt_machine":
  93. loop {scematic::block::%{_p}%::types::*}:
  94. set {_list} to loop-value
  95. set {_list::*} to {_list} split at "$"
  96.  
  97. set {_loc} to {_list::1}
  98. set {_type} to {_list::2}
  99. set {_loc::*} to {_loc} split at ","
  100.  
  101. set {_x} to {_loc::1}
  102. set {_y} to {_loc::2}
  103. set {_z} to {_loc::3}
  104. replace "x: " in {_x} with ""
  105. replace " y: " in {_y} with ""
  106. replace " z: " in {_z} with ""
  107.  
  108. 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