added follow, collect, attack commands

This commit is contained in:
MaxRobinsonTheGreat 2024-01-11 18:04:59 -06:00
parent 0decd272f3
commit 0eba82951b
3 changed files with 33 additions and 52 deletions

View file

@ -81,7 +81,7 @@ export async function executeCommand(agent, message) {
export function getCommandDocs() {
let docs = `\n*COMMAND DOCS\n You can use the following commands to perform actions and get information about the world.
Use the commands with the syntax: !commandName or !commandName("arg1", 1.2, ...) if the command takes arguments.\n
Do not use codeblocks. Only use one command in each response, trailing commands will be ignored. Use these commands frequently in your responses!\n`;
Do not use codeblocks. Only use one command in each response, trailing commands and comments will be ignored. Use these commands frequently in your responses!\n`;
for (let command of commandList) {
docs += command.name + ': ' + command.description + '\n';
if (command.params) {

View file

@ -40,50 +40,31 @@ export const actionsList = [
return await skills.goToPlayer(agent.bot, player_name);
})
},
// {
// name: '!followPlayer',
// description: 'Follow the nearest player.',
// perform: wrapExecution(async (agent, player_name) => {
// await skills.followPlayer(agent.bot, player_name);
// })
// },
// {
// name: '!collectwood',
// description: 'Collect 3 wood logs of any type.',
// perform: wrapExecution(async (agent) => {
// let blocks = world.getNearbyBlockTypes(agent.bot);
// for (let block of blocks) {
// if (block.includes('log')) {
// await skills.collectBlock(agent.bot, block, 3);
// return;
// }
// }
// return 'No wood nearby.';
// })
// },
// {
// name: '!collectstone',
// description: 'Collect 3 cobblestone blocks.',
// perform: wrapExecution(async (agent) => {
// let inventory = world.getInventoryCounts(agent.bot);
// for (const item in inventory) {
// if (inventory[item] && inventory[item] > 0 && item.includes('pickaxe')) {
// if (await skills.equip(agent.bot, 'pickaxe'))
// await skills.collectBlock(agent.bot, 'stone', 3);
// return;
// }
// }
// return 'No pickaxe in inventory.';
// })
// },
// {
// name: '!fightmob',
// description: 'Fight the nearest mob.',
// perform: wrapExecution(async (agent) => {
// let mobs = world.getNearbyMobTypes(agent.bot);
// if (mobs.length == 0)
// return 'No mobs nearby.';
// await skills.attackMob(agent.bot, mobs[0], true);
// })
// }
{
name: '!followPlayer',
description: 'Endlessly follow the nearest player. Ex: !followPlayer("stevie")',
params: {'player_name': '(string) The name of the player to follow.'},
perform: wrapExecution(async (agent, player_name) => {
await skills.followPlayer(agent.bot, player_name);
})
},
{
name: '!collectBlocks',
description: 'Collect the nearest blocks of a given type.',
params: {
'type': '(string) The block type to collect. Ex: !collectBlocks("stone", 10)',
'num': '(number) The number of blocks to collect.'
},
perform: wrapExecution(async (agent, type, num) => {
await skills.collectBlock(agent.bot, type, num);
})
},
{
name: '!attack',
description: 'Attack and kill the nearest entity of a given type.',
params: {'type': '(string) The type of entity to attack.'},
perform: wrapExecution(async (agent, type) => {
await skills.attackMob(agent.bot, type, true);
})
}
];

View file

@ -15,7 +15,7 @@
{"role": "user", "content": "greg: Collect 10 wood"},
{"role": "assistant", "content": "Let me see what's nearby... !blocks"},
{"role": "system", "content": "NEARBY_BLOCKS\n- oak_log\n- dirt\n- cobblestone"},
{"role": "assistant", "content": "I see some oak logs, dirt, and cobblestone. I'll collect oak logs. !newAction"}
{"role": "assistant", "content": "I see some oak logs, dirt, and cobblestone. I'll collect oak logs. !collectBlocks('oak_log', 10)"}
],
[
@ -27,7 +27,7 @@
[
{"role": "user", "content": "zZZn98: come here"},
{"role": "assistant", "content": "!goToPlayer('sumixam0')"},
{"role": "assistant", "content": "On my way! !goToPlayer('zZZn98')"},
{"role": "system", "content": "Code execution finished successfully."},
{"role": "assistant", "content": "Here!"}
],
@ -41,19 +41,19 @@
[
{"role": "user", "content": "joe: Follow me!"},
{"role": "assistant", "content": "Sure! !newAction"}
{"role": "assistant", "content": "Sure! !followPlayer('joe')"}
],
[
{"role": "user", "content": "hanky: kill that zombie!"},
{"role": "assistant", "content": "I'm attacking! !newAction"},
{"role": "assistant", "content": "I'm attacking! !attack('zombie')"},
{"role": "system", "content": "Code Output:\nNo zombie nearby"},
{"role": "assistant", "content": "I could not find a zombie nearby."}
],
[
{"role": "user", "content": "billybob: stop"},
{"role": "assistant", "content": "!newAction"}
{"role": "assistant", "content": "Sure. !stop"}
],
[