Zeldaboy111

Skript #210 - f

Jul 15th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 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.  
  44. function getUpStairDirection(i: item, d: direction, j: number) :: item:
  45. set {_block::north} to 3
  46. set {_block::south} to 2
  47. set {_block::west} to 1
  48. set {_block::east} to 8
  49. set {_rblock} to {_block::%{_d}%}
  50.  
  51. return "%{_i}%:%{_block::%{_d}%}%" parsed as an item
  52.  
  53. function getDownStairDirection(i: item, d: direction, j: number) :: item:
  54. set {_block::north} to 7
  55. set {_block::south} to 6
  56. set {_block::west} to 5
  57. set {_block::east} to 4
  58. set {_rblock} to {_block::%{_d}%}
  59.  
  60. return "%{_i}%:%{_block::%{_d}%}%" parsed as an item
  61.  
  62.  
  63.  
  64.  
  65. function getOppositeDirection(direction: direction) :: direction:
  66. loop split "%{_direction}%" by "and":
  67. if {_dir} is not set:
  68. set {_dir} to numbersIn(loop-value)
  69. set {_final} to loop-value
  70.  
  71. else if numbersIn(loop-value) > {_dir}:
  72. set {_dir} to numbersIn(loop-value)
  73. set {_final} to loop-value
  74.  
  75. if {_final} contains "north":
  76. return north
  77. if {_final} contains "east":
  78. return east
  79. if {_final} contains "south":
  80. return south
  81. if {_final} contains "west":
  82. return west
  83.  
  84.  
  85.  
  86. function numbersIn(s: String) :: number:
  87. set {_return} to ""
  88. loop {_s} split at "":
  89. set {_num} to loop-value parsed as a number
  90. if {_num} is set:
  91. "%{_num}%" = "%loop-value%"
  92. set {_return} to "%{_return}%%{_num}%"
  93.  
  94. return {_return} parsed as a number
  95.  
  96. function addNumber(x: number, y: number, z: number, w: world, dir: direction, num: number) :: location:
  97. if {_dir} is north:
  98. remove {_num} from {_z}
  99.  
  100. if {_dir} is east:
  101. add {_num} to {_x}
  102.  
  103. if {_dir} is south:
  104. add {_num} to {_z}
  105.  
  106. if {_dir} is west:
  107. remove {_num} from {_x}
  108.  
  109. set {_return} to location {_x}, {_y}, {_z} of world "%{_w}%"
  110. return {_return}
  111.  
  112. function remove(x: String, y: String, z: String, loc2: location, world: String, block: String, p: player):
  113. set {_loc1} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
  114. if {_block} is "scematic_dirt_machine":
  115. loop {scematic::block::%{_p}%::types::*}:
  116. set {_list} to loop-value
  117. set {_list::*} to {_list} split at "$"
  118.  
  119. set {_loc} to {_list::1}
  120. set {_type} to {_list::2}
  121. set {_loc::*} to {_loc} split at ","
  122.  
  123. set {_x} to {_loc::1}
  124. set {_y} to {_loc::2}
  125. set {_z} to {_loc::3}
  126. replace "x: " in {_x} with ""
  127. replace " y: " in {_y} with ""
  128. replace " z: " in {_z} with ""
  129.  
  130. 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