-
Notifications
You must be signed in to change notification settings - Fork 18
Bot Code Examples
JoeStrout edited this page Jan 9, 2022
·
4 revisions
You can extend the bot module by simply assigning new functions to it. If you do this in /usr/startup.ms, then they will automatically be loaded when any bot (or the Home Computer) is booted up.
This adds a .till method that selects the Hoe and applies it to the tile in front of the bot. (Of course the bot must actually have a Hoe in its inventory for this to work.)
bot.till = function
bot.use "Hoe"
bot.useTool
end function
Similar to the above example, but instead uses the watering can to water whatever is in front of the bot.
bot.water = function
bot.use "Watering Can"
bot.useTool
end function
This example selects a seed packet by name. Again, the bot must of course have such a seed packet. You would call this, for example, as bot.plant "Parsnip"
bot.plant = function(seedName)
bot.use seedName
bot.placeItem
end function