Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function numbersIn(s: String) :: number:
- set {_return} to ""
- loop {_s} split at "":
- set {_num} to loop-value parsed as a number
- if {_num} is set:
- "%{_num}%" = "%loop-value%"
- set {_return} to "%{_return}%%{_num}%"
- return {_return} parsed as a number
- function getDirectionalBlock(i: item, d: direction) :: item:
- set {_block::north} to 1
- set {_block::south} to 3
- set {_block::west} to 4
- set {_block::east} to 5
- return "%{_i}%:%{_block::%{_d}%}%" parsed as an item
- function getOppositeDirection(direction: direction) :: direction:
- loop split "%{_direction}%" by "and":
- if {_dir} is not set:
- set {_dir} to numbersIn(loop-value)
- set {_final} to loop-value
- else if numbersIn(loop-value) > {_dir}:
- set {_dir} to numbersIn(loop-value)
- set {_final} to loop-value
- if {_final} contains "north":
- return north
- if {_final} contains "east":
- return east
- if {_final} contains "south":
- return south
- if {_final} contains "west":
- return west
- command /test [<item>]:
- trigger:
- if arg 1 is set:
- set {_direction} to direction from targeted block to player
- set {_opposite} to getOppositeDirection({_direction})
- set {_block} to getDirectionalBlock(arg 1, {_opposite})
- set targeted block to {_block}
Add Comment
Please, Sign In to add comment