Перейти к содержанию

SignsBot

Материал из Luanti НашиТут

Из инструментов есть робот signs_bot:box, управляемый программой, записанной на знаках signs_bot:sign_cmnd. Робот требует электропитания, и поэтому работает в комплексе с модом Techage. Также есть датчики и таймер.

Программа управления роботом пишется на своём несложном языке управления, чем-то похожем на язык Turtle/Черепашка

Основные команды:   
move <steps> один или <steps> шагов вперёд
cond_move go to the nearest obstacle or sign
turn_left повернуться влево
turn_right повернуться вправо
turn_around развернуться
backward шаг назад
turn_off выключение и возврат робота в бокс
pause <sec> одижать одну или <sec> секунд
move_up подняться вверх (максимум 2 раза)
move_down опустится вниз
fall_down fall into a hole/chasm (up to 10 blocks)
take_item <num> <slot> взять <num> объектов из слота номер <slot> из ящика
add_item <num> <slot> put one or more items in a box
add_fuel <num> <slot> put fuel in a furnace
place_front <slot> <lvl> place the block in front of the bot
place_left <slot> <lvl> place the block to the left of the bot
place_right <slot> <lvl> place the block to the right of the bot
place_below <slot> lift the robot and put the block under the robot
place_above <slot> set block above the robot
dig_front <slot> <lvl> remove block in front of the robot
dig_left <slot> <lvl> remove block on the left
dig_right <slot> <lvl> remove block on the right
dig_below <slot> remove block under the robot
dig_above <slot> remove block above the robot
rotate_item <lvl> <steps> rotate a block in front of the robot
set_param2 <lvl> <param2> set param2 of the block in front of the robot
place_sign <slot> set sign
place_sign_behind <slot> put a sign behind the bot
dig_sign <slot> remove the sign
trash_sign <slot> Remove the sign, clear data and add to the item Inventory
stop Bot stops until the shield is removed
pickup_items <slot> pickup items (in a 3x3 field)
drop_items <num> <slot> drop items
harvest harvest a 3x3 field (farming)
cutting cut flowers in a 3x3 field
sow_seed <slot> see/plant a 3x3 field
plant_sapling <slot> plant a sapling in front of the robot
pattern save the block properties behind the sign (3x3x3 cube) as a template
copy <size> make a 3x3x3 copy of the stored template
punch_cart bump a mine cart
add_compost <slot> Put 2 leaves into the compost barrel
take_compost <slot> Take a compost item from the barrel
print <text> Output chat message for debug purposes
take_water <slot> Take water with empty bucket
fill_cauldron <slot> Fill the xdecor cauldron for a soup
take_soup <slot> Take boiling soup into empty bowl from cauldron
flame_on Make fire
flame_off Put out the fire
Взаимодействие с Techage:   
ignite Ignite the techage charcoal lighter
low_batt <percent> Turn the bot off if the battery power is below the given value in percent (1..99)
jump_low_batt <percent> <label> Jump to <label> if the battery power is below the given value in percent (1..99) (see "Flow control commands")
send_cmnd <receiver> <command> Send a techage command to a given node. Receiver is addressed by the techage node number. For commands with two or more words, use the '*' character instead of spaces, e.g.:
send_cmnd 3465 pull*default:dirt*2 
Управление порядком исполнения:   
jump <label> jump command, <label> is a word from the characters a-z or A-Z
<label>: jump label / start of a function
return return from a function
repeat <num> start of a loop block, <num> is a number 1..999
end end of a loop block
call <label> call of a function (with return via the command 'return')
jump_check_item <num> <slot> <label> Check if there are <num> items in the chest like node.

-- If not, jump to <label>. -- <slot> is the bot inventory slot (1..8) to -- specify the item, or 0 for any item.

jump_low_batt <percent> <label> See "Techage specific commands"