Discusión

Prompt de generación de código para bot de Minecraft estilo Voyager

De Wikiprompt, la enciclopedia libre de prompts

宝玉
Contribuido por宝玉XFuente

27 may 2023

Prompt de generación de código para bot de Minecraft estilo Voyager Un mensaje de sistema integral para generar código de bots de Minecraft con Mineflayer, que incluye configuración de roles, reutilización de bibliotecas de código, especificación de entradas, requisitos de salida y formato de respuesta.

Contenido del PromptGuardar

🌐
Explain: The task is to create a function that can complete a Minecraft task. Since no specific task is given, I'll create a generic function that can gather wood, craft planks, and craft sticks - a common foundational task. The function should be reusable and check inventory before acting. Plan: 1) Check if we have enough logs in inventory (at least 1 oak log) 2) If not, find and mine oak logs using mineBlock 3) Check if we have enough planks (at least 4 oak planks) 4) If not, craft planks from logs using craftItem 5) Check if we have enough sticks (at least 4 sticks) 6) If not, craft sticks from planks using craftItem 7) Report progress via the URL Code: ```javascript async function gatherWoodAndCraftSticks(bot) { // Report progress await bot.chat('Starting wood gathering and stick crafting task'); // Step 1: Ensure we have at least 1 oak log const logCount = bot.inventory.count(bot.registry.itemsByName.oak_log.id); if (logCount < 1) { // Find and mine oak logs const logBlock = bot.findBlock({ matching: bot.registry.blocksByName.oak_log.id, maxDistance: 32 }); if (logBlock) { await mineBlock(bot, 'oak_log', 1); } else { // Explore to find oak logs const directions = [[1, 0, 0], [-1, 0, 0], [0, 0, 1], [0, 0, -1]]; const randomDir = directions[Math.floor(Math.random() * directions.length)]; await exploreUntil(bot, randomDir, 32, () => { const found = bot.findBlock({ matching: bot.registry.blocksByName.oak_log.id, maxDistance: 32 }); return found ? found : null; }); await mineBlock(bot, 'oak_log', 1); } } // Step 2: Ensure we have at least 4 oak planks const plankCount = bot.inventory.count(bot.registry.itemsByName.oak_planks.id); if (plankCount < 4) { // Craft planks from logs await craftItem(bot, 'oak_planks', 4); } // Step 3: Ensure we have at least 4 sticks const stickCount = bot.inventory.count(bot.registry.itemsByName.stick.id); if (stickCount < 4) { // Craft sticks from planks await craftItem(bot, 'stick', 4); } // Report completion await bot.chat('Wood gathering and stick crafting complete'); } ```

Iniciá sesión para ver el prompt completo

Continuar con:

Al iniciar sesión, aceptás nuestros Términos de uso y Política de privacidad

Uso

Este prompt está diseñado para usarse con coding. Copiá el contenido de arriba y pegalo en tu herramienta de IA preferida.

Para mejores resultados, personalizá los marcadores (indicados con corchetes o mayúsculas) con tus requisitos específicos.

Referencias

Categorías:coding| twitter| minecraft| mineflayer

Discusión