Zeldaboy111

Skript #208 - f

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