Giter Club home page Giter Club logo

rbot's Introduction

rbot

NPM version

A minecraft bot that can do many things.

Supports minecraft 1.11.2

Youtube demos :

Features

  • dig
  • move to any not too far away position thanks to mineflayer-navigate
  • repeat
  • sequence
  • dig a spiral staircase
  • inventory management : equip,toss,list
  • attack : mobs, players
  • build
  • find and get a block
  • activate an item (shoot and arrow for example)
  • follow
  • build a shelter
  • dig a tunnel
  • raise chicken
  • move by building and digging
  • building things : watch then replicate
  • craft

Roadmap

  • Doing more complicated things :
  • crafting things : get or craft the needed items
  • getting anywhere even if it's hard (lava, water)
  • building more things
  • Integrate other mineflayer functionnality :
  • using chests, dispensers and enchantment tables
  • use vehicle
  • activate block
  • React to the world : for example if a mob attack the bot, the bot should defend itself
  • Improve/simplify the code

Installation

First, you need to install node , you might want to read this

  • npm install -g rbot

or

Usage

  • If you specify a master the bot will only obey to him
  • rbot <host> <port> <name> <password> [<master>]

If you cloned the repo, run node rbot.js instead.

Commands

Syntax

  • repeat <action> done
  • stop repeat <action> done
  • do <action1> then <action2> done : do first action then do the second one
  • if <condition> do <task> done
  • if <condition> do <task1> else <task2> done
  • repeat <task> until <condition> done

Base commands

  • dig <position>
  • move <position>
  • look for <entity>
  • look for <block>
  • pos <player> : say the position of the other player if he is not too far away
  • move to <position> : use mineflayer-navigate to get to <position>
  • stop move to
  • equip <emplacement> <item> : equip item at emplacement (for example hand)
  • unequip <emplacement>
  • toss <number> <nameItem>
  • toss everything
  • list : list all items of the bot
  • attack <entity>
  • say <message>.
  • activate item
  • deactivate item
  • wait <milliseconds>
  • stop raise chicken
  • look at <position>
  • build <position> : build at position with the equipped block
  • craft <number> <nameItem> : will craft this item if you have the required items
  • up : jump and build under the bot (but doesn't dig the bot above the bot unlike sup)
  • jump
  • nothing
  • watch <entity> : start watching what <entity> is building and digging
  • stop watch : stop watching and save what has been done
  • replicate : redo the building and digging that has just been done (the position of the action are calculated from the position of the bot)

Alias

  • x+ x- z+ z-
  • dig forward <position> : dig the two block in front of the bot then move, works if there is gravel that fall
  • spiral up : dig an ascending spiral staircase
  • spiral down : dig a descending spiral staircase
  • raise chicken : get an egg then throw it
  • shoot <entity> : if it has a bow and arrows, shoot <entity>
  • follow <position> : go to <position> every 2 sec
  • get <nameBlock> : go to a position next to nearest <nameBlock> then dig it
  • build shelter : build a very simple shelter with the equipped block (need 25 blocks)
  • destroy shelter : destroy this shelter
  • come : move to me
  • attack everymob : kill any close mob
  • scome : move to you by digging and building
  • down : move down of one block
  • sup : move up of one block
  • sget <blockName> : get a block by building and digging
  • smove <position> : repeat ssumove <position> until at <position> done : if the position is too far ssumove can't calculate it because it doesn't know the blocks that far
  • ssumove <position> : get to the position by building and digging using a-star to avoid bedrock
  • sumove <position> : move of 1 in the direction of the position by building and digging
  • immure <position>
  • cget <number> <nameItem> : get the item using sget and craft commands
  • give <position> <number> <item>
  • give <position> everything
  • sdig <position> : repeat ssdig until it's done
  • ssdig <position> : dig safely
  • achieve <condition> : achieve <condition> using the related action

Parameters

  • <item> can be :
  • item to build
  • tool to break <nameBlock>
  • <nameItem>
  • <position> can be :
  • rx,y,z : relative position
  • <absolute position>
  • rx,y,z+<absolute position>
  • nearest reachable position <position>
  • <absolute position> can be :
  • x,y,z : absolute position
  • adapted <entity> : adapted position for shooting with a bow
  • <entity>
  • <block>
  • <block> can be :
  • nearest block <nameBlock>
  • nearest block *: any nearest block
  • <entity> can be :
  • nearest mob <mob>
  • nearest mob * : any nearest mob
  • nearest visible mob <mob>
  • nearest visible mob * : any nearest visible mob
  • nearest reachable mob <mob>
  • nearest reachable mob * : any nearest reachable mob
  • nearest object <object>
  • nearest object * : any nearest object
  • nearest reachable object <object>
  • nearest reachable object * : any nearest reachable object
  • me
  • bot
  • player <playerName>
  • <mob> can be :
  • spider
  • enderman
  • creeper
  • ...
  • <condition> can be :
  • at <position>
  • have <number> <nameItem>
  • close of <blockName>
  • <position> is empty
  • <position> is not empty

Interesting use of commands

  • repeat spiral down done : build a spiral staircase from y=64 to y=0
  • attack everymob : attack mobs close from the mob
  • repeat dig forward r0,0,1 done : if you want to build a tunnel (not stopped by gravel, but can die from drowning)
  • come
  • scome
  • repeat do raise chicken then wait 1000 done done
  • stop repeat do raise chicken then wait 1000 done done
  • repeat look at me done
  • repeat shoot nearest reachable mob done : kill close mobs
  • repeat shoot me done : kill you
  • move to nearest reachable position nearest block log
  • follow me
  • stop follow me
  • get log
  • repeat do build shelter then destroy shelter done done : fun

rbot's People

Contributors

rom1504 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rbot's Issues

Log In

Please support login with a live servers, so you can use a Mojang Email.

outdated client

I got kicked for {"extra":[{"color":"red","text":"Kicked whilst connecting to bl
ue: "},{"color":"white","text":"Outdated client! Please use 1.11.2"}],"text":""}
lol

A few errors that I've run into (w/ error messages)

## Specs: Node Version: v6.9.5
Server Version: CraftBukkit 1.11.2
OS: ElementaryOS Loki (based off of Ubuntu 16.04).

I finally got the bot working, but there are a few crashes that I've run into. Here are the commands I've done and the error codes that comes with them. I can provide a video if needed:

1) Anything building related only places one block and then freezes:

For a test, I placed 6 blocks down with the bot watching me, then stopped watching and asked for it to replicate. It placed down one block, but outputted this to the terminal. It never displayed any chat messages about it completing the replicate task.

replicate
["replicate",[]]
I'm going to achieve task ["replicate",[]]
do build r-1,0,-4 then build r0,0,-4 then build r1,0,-4 then build r-2,0,-4 then dig r-2,0,-4 then dig r-1,0,-4 then dig r0,0,-4 done
["taskList",[["taskList",[["exp",["build",[["position","r-1,0,-4"]]]],["exp",["build",[["position","r0,0,-4"]]]],["exp",["build",[["position","r1,0,-4"]]]],["exp",["build",[["position","r-2,0,-4"]]]],["exp",["dig",[["position","r-2,0,-4"]]]],["exp",["dig",[["position","r-1,0,-4"]]]],["exp",["dig",[["position","r0,0,-4"]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["build",[["position","r-1,0,-4"]]]],["exp",["build",[["position","r0,0,-4"]]]],["exp",["build",[["position","r1,0,-4"]]]],["exp",["build",[["position","r-2,0,-4"]]]],["exp",["dig",[["position","r-2,0,-4"]]]],["exp",["dig",[["position","r-1,0,-4"]]]],["exp",["dig",[["position","r0,0,-4"]]]]]]]]
I'm going to achieve task ["build",[["position","r-1,0,-4"]]]
I achieved task ["build",[["position","r-1,0,-4"]]]
I'm going to achieve task ["build",[["position","r0,0,-4"]]]
I achieved task ["build",[["position","r0,0,-4"]]]
I'm going to achieve task ["build",[["position","r1,0,-4"]]]
I achieved task ["build",[["position","r1,0,-4"]]]
I'm going to achieve task ["build",[["position","r-2,0,-4"]]]
I achieved task ["build",[["position","r-2,0,-4"]]]
I'm going to achieve task ["dig",[["position","r-2,0,-4"]]]
I achieved task ["dig",[["position","r-2,0,-4"]]]
I'm going to achieve task ["dig",[["position","r-1,0,-4"]]]
I achieved task ["dig",[["position","r-1,0,-4"]]]
I'm going to achieve task ["dig",[["position","r0,0,-4"]]]
I achieved task ["dig",[["position","r0,0,-4"]]]
I achieved task ["taskList",[["taskList",[["exp",["build",[["position","r-1,0,-4"]]]],["exp",["build",[["position","r0,0,-4"]]]],["exp",["build",[["position","r1,0,-4"]]]],["exp",["build",[["position","r-2,0,-4"]]]],["exp",["dig",[["position","r-2,0,-4"]]]],["exp",["dig",[["position","r-1,0,-4"]]]],["exp",["dig",[["position","r0,0,-4"]]]]]]]]
I achieved task ["replicate",[]]

2) build shelter, replicate, or anything that has to do with building on Snow

/home/unity/rbot/node_modules/minecraft-protocol/dist/transforms/framing.js:112
          } else throw e;
                 ^

Error: No block has been placed : the block is still air
    at Bot.onBlockUpdate (/home/unity/rbot/node_modules/mineflayer/lib/plugins/inventory.js:367:14)
    at emitTwo (events.js:106:13)
    at Bot.emit (events.js:191:7)
    at emitBlockUpdate (/home/unity/rbot/node_modules/mineflayer/lib/plugins/blocks.js:110:22)
    at updateBlock (/home/unity/rbot/node_modules/mineflayer/lib/plugins/blocks.js:129:5)
    at Client.<anonymous> (/home/unity/rbot/node_modules/mineflayer/lib/plugins/blocks.js:187:5)
    at emitTwo (events.js:106:13)
    at Client.emit (events.js:191:7)
    at Parser.<anonymous> (/home/unity/rbot/node_modules/minecraft-protocol/dist/client.js:101:16)
    at emitOne (events.js:96:13)
    at Parser.emit (events.js:188:7)

3) down (or anything that involves breaking blocks) (temporary fix is to comment out lines 17-50 and 96 in /lib/Inventory.js and also comment out line 146 in /lib/stringTo.js):

/home/unity/rbot/lib/inventory.js:18
    var okTools = block.harvestTools;
                       ^

TypeError: Cannot read property 'harvestTools' of undefined
    at canHarvest (/home/unity/rbot/lib/inventory.js:18:24)
    at Object.toolToBreak (/home/unity/rbot/lib/inventory.js:31:7)
    at stringToItem (/home/unity/rbot/lib/stringTo.js:146:76)
    at item (/home/unity/rbot/lib/stringTo.js:21:38)
    at /home/unity/rbot/lib/stringTo.js:39:119
    at /home/unity/rbot/node_modules/async/lib/async.js:356:13
    at async.forEachOf.async.eachOf (/home/unity/rbot/node_modules/async/lib/async.js:233:13)
    at _asyncMap (/home/unity/rbot/node_modules/async/lib/async.js:355:9)
    at Object.map (/home/unity/rbot/node_modules/async/lib/async.js:337:20)
    at Object.stringTo (/home/unity/rbot/lib/stringTo.js:39:8)

4) come command just doesn't work. Bot says it accomplished task but doesn't move.

5) Anything with the repeat command just repeats a blank command over and over until I force kill the bot.

6) get block (grass in this case):

/home/unity/rbot/lib/nearest.js:39
	return blocks[blockName].id;
	                        ^

TypeError: Cannot read property 'id' of undefined
    at blockNameToBlockType (/home/unity/rbot/lib/nearest.js:39:26)
    at Object.nearestBlock (/home/unity/rbot/lib/nearest.js:84:17)
    at stringToBlock (/home/unity/rbot/lib/stringTo.js:44:68)
    at stringToAbsolutePosition (/home/unity/rbot/lib/stringTo.js:105:2)
    at stringToPosition (/home/unity/rbot/lib/stringTo.js:121:7)
    at stringToPosition (/home/unity/rbot/lib/stringTo.js:118:72)
    at /home/unity/rbot/lib/stringTo.js:39:119
    at /home/unity/rbot/node_modules/async/lib/async.js:356:13
    at async.forEachOf.async.eachOf (/home/unity/rbot/node_modules/async/lib/async.js:233:13)
    at _asyncMap (/home/unity/rbot/node_modules/async/lib/async.js:355:9)

7) toss command doesn't drop anything but the bot still thinks it completed the command (I think the bot can't see it's inventory?)

I'll update this issue if I find more errors and/or temporary fixes.

How do I run it?

Hello. I'm very new to javascript and it seems that I can't run rbot. Error says that it cannot find mineflayer module, but where do I get it?
Thank You.

bot fails at the command of stop watch

/home/......./rbot/task/blockTask.js:96
bot.removeListener('blockUpdate',wa[1]);
^

TypeError: Cannot read property '1' of undefined
at stopWatch (/home/......./rbot/task/blockTask.js:96:37)
at /home/......./rbot/achieve.js:53:11
at /home/......./rbot/lib/stringTo.js:39:192
at /home/......./rbot/node_modules/async/lib/async.js:232:13
at async.each (/home/......./rbot/node_modules/async/lib/async.js:107:20)
at _asyncMap (/home/......./rbot/node_modules/async/lib/async.js:226:9)
at Object.map (/home/......./rbot/node_modules/async/lib/async.js:204:23)
at Object.stringTo (/home/......./rbot/lib/stringTo.js:39:8)
at applyAction (/home/......./rbot/achieve.js:52:12)
at Immediate._onImmediate (/home/......./rbot/achieve.js:87:28)

new stock command

How about a command like "stock [] []".

If the bot sees that the chest doesn't have enough resources, it can get them instead of idling. If chest isn't specified, maybe it can use the combined chest inventories.

Cannot find module './grammar/grammar' and BOT doesn't do anything when connected to server

Hi, when I launch the script I get this error:

<< Cannot find module './grammar/grammar' >>

I did /npm install grammar though and it has been successfully installed

EDIT:
I replaced the missing grammar.js file by index.js file from grammar module, and it worked !

However, my bot doesn't do anything when I ask him to. eg when I tell him 'pos Ganondorf629' he won't answer anything...

rbot crashing in timers.js:358:17

Windows 7/64, Node v0.12.4, npm 2.11.3, Python 2.7, openssl 1.0.2.c

Problem: rbot crashes on commands such as smove r1,0,0

With: typeError: undefined is not a function

See crash dump below:

c:\Users\gap\rbot>node rbot.js localhost 25565 my_id my_password

I have 20 health and 20 food

Received New Command: smove r2,0,0

["smove",[["position","r2,0,0"]]]

["repeatUntil",[["exp",["ssumove",[["position","-144,79,-69"]]]],["condition",["at",[["position","-144,79,-69"]]]]]]
I'm going to achieve task ["repeatUntil",[["exp",["ssumove",[["position","-144,79,-69"]]]],["condition",["at",[["position","-144,79,-69"]]]]]]
{ x: -146, y: 79, z: -69 }
{ status: 'success',
path:
[ { x: -145.5, y: 79, z: -68.5 },
{ x: -144.5, y: 79, z: -68.5 },
{ x: -143.5, y: 79, z: -68.5 } ] }
["taskList",[["taskList",[["exp",["sumove",[["position","-145.5,79,-68.5"]]]],["exp",["sumove",[["position","-144.5,79,-68.5"]]]],["exp",["sumove",[["position","-143.5,79,-68.5"]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["sumove",[["position","-145.5,79,-68.5"]]]],["exp",["sumove",[["position","-144.5,79,-68.5"]]]],["exp",["sumove",[["position","-143.5,79,-68.5"]]]]]]]]

["nothing",[]]
I'm going to achieve task ["nothing",[]]
I achieved task ["nothing",[]]

["dig forward",[["position","r1,0,0"]]]

["taskList",[["taskList",[["exp",["sdig",[["position","r1,0,0"]]]],["exp",["sdig",[["position","-145,80,-69"]]]],["exp",["sbuild",[["position","-145,78,-69"]]]],["exp",["move to",[["position","r1,0,0"]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["sdig",[["position","r1,0,0"]]]],["exp",["sdig",[["position","-145,80,-69"]]]],["exp",["sbuild",[["position","-145,78,-69"]]]],["exp",["move to",[["position","r1,0,0"]]]]]]]]

["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r1,0,0"]]]]]]]]],["condition",["is empty",[["position","r1,0,0"]]]]]]
I'm going to achieve task ["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r1,0,0"]]]]]]]]],["condition",["is empty",[["position","r1,0,0"]]]]]]
I achieved task ["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r1,0,0"]]]]]]]]],["condition",["is empty",[["position","r1,0,0"]]]]]]

["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","-145,80,-69"]]]]]]]]],["condition",["is empty",[["position","-145,80,-69"]]]]]]
I'm going to achieve task ["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","-145,80,-69"]]]]]]]]],["condition",["is empty",[["position","-145,80,-69"]]]]]]
I achieved task ["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","-145,80,-69"]]]]]]]]],["condition",["is empty",[["position","-145,80,-69"]]]]]]

["ifThen",[["condition",["is empty",[["position","-145,78,-69"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","item to build"]]]],["exp",["build",[["position","-145,78,-69"]]]]]]]]]]]
I'm going to achieve task ["ifThen",[["condition",["is empty",[["position","-145,78,-69"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","itemto build"]]]],["exp",["build",[["position","-145,78,-69"]]]]]]]]]]]
I achieved task ["ifThen",[["condition",["is empty",[["position","-145,78,-69"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","item to build"]]]],["exp",["build",[["position","-145,78,-69"]]]]]]]]]]]

I'm going to achieve task ["move to",[["position","r1,0,0"]]]
success 2
I achieved task ["move to",[["position","r1,0,0"]]]

I achieved task ["taskList",[["taskList",[["exp",["sdig",[["position","r1,0,0"]]]],["exp",["sdig",[["position","-145,80,-69"]]]],["exp",["sbuild",[["position","-145,78,-69"]]]],["exp",["move to",[["position","r1,0,0"]]]]]]]]

timers.js:358
immediate._onImmediate();
^
TypeError: undefined is not a function
at processImmediate as _immediateCallback

c:\Users\gap\rbot>

Needs a crash fall-back

I don't know is it just me but it's still very 'crashy'. I think that you should add something like crash fall-back so it would say something like 'Sorry...I had to stop doing this because I've messed up' instead of crashing. It's pretty annoying to start it again and again every minute.

Unhandled error?

So I'm trying to login to pvp.desteria.com, and I keep getting an unhandled error. This is what I get
I logged in.
settings { chat: 'enabled',
colorsEnabled: true,
viewDistance: 'far',
difficulty: 2,
showCape: true }
events.js:160
throw er; // Unhandled 'error' event
^

Error: unexpected end of file
at Zlib._handle.onerror (zlib.js:370:17)

crash report: TypeError: Cannot read property 'entity' of undefined

this is for rbot 0.0.4

/home/andy/dev/mc-bot-server/node_modules/rbot/task.js:349
v=new RegExp("^player (.+)$").exec(s))!=null) return bot.players[v[1]].entity;
^
TypeError: Cannot read property 'entity' of undefined
at stringToEntity (/home/andy/dev/mc-bot-server/node_modules/rbot/task.js:349:76)
at attack (/home/andy/dev/mc-bot-server/node_modules/rbot/task.js:294:10)
at /home/andy/dev/mc-bot-server/node_modules/rbot/achieve.js:70:18
at listAux (/home/andy/dev/mc-bot-server/node_modules/rbot/achieve.js:119:7)
at /home/andy/dev/mc-bot-server/node_modules/rbot/achieve.js:117:22
at /home/andy/dev/mc-bot-server/node_modules/rbot/achieve.js:47:3
at Bot. (/home/andy/dev/mc-bot-server/node_modules/rbot/achieve.js:70:171)
at Bot.g (events.js:192:14)
at Bot.EventEmitter.emit (events.js:126:20)
at EventEmitter. (/home/andy/dev/mc-bot-server/node_modules/rbot/task.js:22:40)

full source?

Could you post a translated source by any chance? I'm still learning how to make the bot do things and would like to learn from this.

a protect me command

using something like the nearest reachable mob but with the player as a reference to calculate distance.
plus repeat attack.
it should attack mob only if there are close enough

Crashes when it encounters an error

Every time it can't do something, the bot just leaves the game, and the console appears to have exited the script. I guess it's too buggy on my computer... :\

TypeError: Cannot read property 'harvestTools' of undefined

When using rbot and running any command which reuires to to dig, I get this message:

down
["taskList",[["taskList",[["exp",["tcc",[]]],["exp",["sbuild",[["position","r0,-2,0"]]]],["exp",["sdig",[["position","r0,-1,0"]]]],["exp",["wait",[["int","400"]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["tcc",[]]],["exp",["sbuild",[["position","r0,-2,0"]]]],["exp",["sdig",[["position","r0,-1,0"]]]],["exp",["wait",[["int","400"]]]]]]]]
I'm going to achieve task ["tcc",[]]
I achieved task ["tcc",[]]
["ifThen",[["condition",["is empty",[["position","r0,-2,0"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","item to build"]]]],["exp",["build",[["position","r0,-2,0"]]]]]]]]]]]
I'm going to achieve task ["ifThen",[["condition",["is empty",[["position","r0,-2,0"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","item to build"]]]],["exp",["build",[["position","r0,-2,0"]]]]]]]]]]]
I achieved task ["ifThen",[["condition",["is empty",[["position","r0,-2,0"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","item to build"]]]],["exp",["build",[["position","r0,-2,0"]]]]]]]]]]]
["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r0,-1,0"]]]]]]]]],["condition",["is empty",[["position","r0,-1,0"]]]]]]
I'm going to achieve task ["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r0,-1,0"]]]]]]]]],["condition",["is empty",[["position","r0,-1,0"]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["ssdig",[["position","r0,-1,0"]]]]]]]]
["ifThen",[["condition",["is not empty",[["position","r0,-1,0"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","tool to break stone"]]]],["exp",["dig",[["position","r0,-1,0"]]]]]]]]]]]
I'm going to achieve task ["ifThen",[["condition",["is not empty",[["position","r0,-1,0"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","tool to break stone"]]]],["exp",["dig",[["position","r0,-1,0"]]]]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","tool to break stone"]]]],["exp",["dig",[["position","r0,-1,0"]]]]]]]]
I'm going to achieve task ["equip",[["destination","hand"],["item","tool to break stone"]]]
/home/woverton/Documents/CodingTest/minebot/rbot/lib/inventory.js:18
    var okTools = block.harvestTools;
                       ^

TypeError: Cannot read property 'harvestTools' of undefined
    at canHarvest (/home/woverton/Documents/CodingTest/minebot/rbot/lib/inventory.js:18:24)
    at Object.toolToBreak (/home/woverton/Documents/CodingTest/minebot/rbot/lib/inventory.js:31:7)
    at stringToItem (/home/woverton/Documents/CodingTest/minebot/rbot/lib/stringTo.js:146:76)
    at item (/home/woverton/Documents/CodingTest/minebot/rbot/lib/stringTo.js:21:38)
    at /home/woverton/Documents/CodingTest/minebot/rbot/lib/stringTo.js:39:119
    at /home/woverton/Documents/CodingTest/minebot/rbot/node_modules/async/lib/async.js:356:13
    at async.forEachOf.async.eachOf (/home/woverton/Documents/CodingTest/minebot/rbot/node_modules/async/lib/async.js:233:13)
    at _asyncMap (/home/woverton/Documents/CodingTest/minebot/rbot/node_modules/async/lib/async.js:355:9)
    at Object.map (/home/woverton/Documents/CodingTest/minebot/rbot/node_modules/async/lib/async.js:337:20)
    at Object.stringTo (/home/woverton/Documents/CodingTest/minebot/rbot/lib/stringTo.js:39:8)

I am using spigot-1.11.2.jar

a craft command / cget

should be a generated task : if it doesn't have the needed block, it should go get them (or craft them), so it needs to generate dependencies.

new links between commands : when, until, ...

It would be nice to be able to do this kind of thing :

  • when <event> do <task>
  • repeat <task> until <condition>
  • if <condition> do <task>

The syntax of these things might change, I'm not sure what would be really useful.
It would be useful to add examples, to know what is really useful.

mineflayer.createBot() fails silently in Windows

I had to add "password:process.argv[5]" to bot=mineflayer.createBot({}) to log in to 1.8.3 server.

The bot.chat("/login "+process.argv[5]) seems to fail - instead of logging in, node drops back to the command line with no error message at all.

Adding the password parameter back to createBot allows me to log in.

process:
versions:
{ http_parser: '2.3',
node: '0.12.6',
v8: '3.28.71.19',
uv: '1.6.1',
zlib: '1.2.8',
modules: '14',
openssl: '1.0.1o' },
arch: 'x64',
platform: 'win32', (Windows 7)

Kicked for Outdated Client.

The error message was:
I got kicked for {"text":"Outdated client! Please use 1.11.2"} lol

I thought this was updated to 1.11.2?

Simplify listAux

Romain, this amazing piece of code absolutely freezes my brain!

Is there any way to break down the complexity a bit, such as getting rid of the function in a function in a function in a function?

if(i<taskNameList.length) setImmediate(function(){achieve(taskNameList[i][1],username(function(taskNameList,i,username,done) {
return function() {
        setImmediate(function(){listAux(taskNameList,i+1,username,done);});
    };
})(taskNameList,i,username,done))});

Needs testing

Any kind of testing would be useful.

It currently isn't very reliable...

build things

it would be interesting to have a command to build a small house for example.
Can be done once the build command will be done

Handle errors better

For example if someone say "cget 1 oreStone" it will make an error in the console since oreStone is not the right block name. Instead it should say the problem to the player in the chat.

This happens for various other commands.

Setting up Rbot

wrt our thread at http://www.youtube.com/watch?v=0cQxg9uDnzA:

I am running a vanilla minecraft server. I built/installed rbot using:

sudo /usr/local/bin/npm install -g rbot

Apart from the following compiler warning, that went fine.

...
npm http 304 https://registry.npmjs.org/callsite
  CXX(target) Release/obj.target/ursaNative/src/ursaNative.o
In file included from ../src/ursaNative.cc:3:
../src/ursaNative.h:6:9: warning: 'BUILDING_NODE_EXTENSION' macro redefined
#define BUILDING_NODE_EXTENSION
        ^
<command line>:4:9: note: previous definition is here
#define BUILDING_NODE_EXTENSION 1
        ^
1 warning generated.
  CXX(target) Release/obj.target/ursaNative/src/asprintf.o
  SOLINK_MODULE(target) Release/ursaNative.node
  SOLINK_MODULE(target) Release/ursaNative.node: Finished
/usr/local/bin/rbot -> /usr/local/lib/node_modules/rbot/rbot.js
[email protected] /usr/local/lib/node_modules/rbot
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])

But I'm not sure how to get it running as part of my server. I tried this:

$ ./rbot.js localhost 25565 flame321 <my pwd> 
I got kicked for Failed to verify username! lol

The username and password are mine and were typed correctly. Am I suposed to use some other port? Or what?

Thanks.

Feature Request - Automatic Farming

Ok, so my idea is for a bot that farms. When you activate it with a command, it will find crops, break them, replant, and deposit the crops in a chest. These crops could be carrots, potatoes, wheat and or beetroot.

make a really move to <position> command

It would be a command that get to the position even if it's :

  • very far away : it could go in the general direction until it's near enough then try using the move to command
  • underground : it could use repeat spiral down until it's underground enough then use repeat dig forward to get to the position
  • in a close space : it could use repeat dig forward to get inside
  • in the air : it could use the (not yet implemented) build command to get there (and possibly use the get command to get enough block)
  • under water : one way is to build a descending ladder down the water (after getting at the right x and z with the build command)
  • under lava : maybe the same way than water, but it will probably be harder for the bot not to get killed

Implement complicated commands in JS ?

Some complicated commands (for example cget and smove) are currently implemented in "rbot language" resulting in stack problem sometimes, approximate behavior and not so easy to read code.

Would it be possible to implement these commands directly in JS ?

spigot 1.11.2 Support?

I'm trying to connect to Spigot 1.11.2 Server and I get wrong server client, it can't connect.
Why?

rbot crashes in timers.js Node v0.12.6

Another log of a timers.js crash, this time in node v0.12.6

Command: dig forward r0,0,1

["dig forward",[["position","r0,0,1"]]]
["taskList",[["taskList",[["exp",["sdig",[["position","r0,0,1"]]]],["exp",["sdig",[["position","-211,73,264"]]]],["exp",["sbuild",[["position","-211,71,264"]]]],["exp",["move to",["position","r0,0,1"]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["sdig",[["position","r0,0,1"]]]],["exp",["sdig",[["position","-211,73,264"]]]],["exp",["sbuild",[["position","-211,71,264"]]]],["exp",["move to",[["position","r0,0,1"]]]]]]]]
["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r0,0,1"]]]]]]]]],["condition",["is empty",[["position","r0,0,1"]]]]]]
I'm going to achieve task ["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r0,0,1"]]]]]]]]],["condition",["is empty",[["position","r0,0,1"]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["ssdig",[["position","r0,0,1"]]]]]]]]
["ifThen",[["condition",["is not empty",[["position","r0,0,1"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","tool to break grass"]]]],["exp",["dig",[["position","r0,0,1"]]]]]]]]]]]
I'm going to achieve task ["ifThen",[["condition",["is not empty",[["position","r0,0,1"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","tool to break grass"]]]],["exp",["dig",[["position","r0,0,1"]]]]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","tool to break grass"]]]],["exp",["dig",[["position","r0,0,1"]]]]]]]]
I'm going to achieve task ["equip",[["destination","hand"],["item","tool to break grass"]]]
I'm going to achieve task ["dig",[["position","r0,0,1"]]]
I dig position (-211, 72, 264)

timers.js:367 immediate._onImmediate();
TypeError: undefined is not a function at processImmediate [as _immediateCallback] timers.js:367:17

repeat spiral down done <--- Error

game { levelType: 'default',
gameMode: 'survival',
hardcore: false,
dimension: 'overworld',
difficulty: 'easy',
maxPlayers: 20 }
repeat spiral down done
["repeat",[["exp",["taskList",[["taskList",[["exp",["smove",[["position","r1,-1,0"]]]],["exp",["smove",[["position","r0,-1,1"]]]],["exp",["smove",[["position","r-1,-1,0"]]]],["exp",["smove",[["position","r0,-1,-1"]]]]]]]]]]]
I'm going to achieve task ["repeat",[["exp",["taskList",[["taskList",[["exp",["smove",[["position","r1,-1,0"]]]],["exp",["smove",[["position","r0,-1,1"]]]],["exp",["smove",[["position","r-1,-1,0"]]]],["exp",["smove",[["position","r0,-1,-1"]]]]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["smove",[["position","r1,-1,0"]]]],["exp",["smove",[["position","r0,-1,1"]]]],["exp",["smove",[["position","r-1,-1,0"]]]],["exp",["smove",[["position","r0,-1,-1"]]]]]]]]
["repeatUntil",[["exp",["ssumove",[["position","444,64,1783"]]]],["condition",["at",[["position","444,64,1783"]]]]]]
I'm going to achieve task ["repeatUntil",[["exp",["ssumove",[["position","444,64,1783"]]]],["condition",["at",[["position","444,64,1783"]]]]]]
Vec3 { x: 443, y: 65, z: 1783 }
{ status: 'success',
path:
[ Vec3 { x: 443.5, y: 65, z: 1783.5 },
Vec3 { x: 444.5, y: 65, z: 1783.5 },
Vec3 { x: 444.5, y: 64, z: 1783.5 } ] }
["taskList",[["taskList",[["exp",["sumove",[["position","443.5,65,1783.5"]]]],["exp",["sumove",[["position","444.5,65,1783.5"]]]],["exp",["sumove",[["position","444.5,64,1783.5"]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["sumove",[["position","443.5,65,1783.5"]]]],["exp",["sumove",[["position","444.5,65,1783.5"]]]],["exp",["sumove",[["position","444.5,64,1783.5"]]]]]]]]
["nothing",[]]
I'm going to achieve task ["nothing",[]]
I achieved task ["nothing",[]]
["dig forward",[["position","r1,0,0"]]]
["taskList",[["taskList",[["exp",["sdig",[["position","r1,0,0"]]]],["exp",["sdig",[["position","444,66,1783"]]]],["exp",["sbuild",[["position","444,64,1783"]]]],["exp",["move to",[["position","r1,0,0"]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["sdig",[["position","r1,0,0"]]]],["exp",["sdig",[["position","444,66,1783"]]]],["exp",["sbuild",[["position","444,64,1783"]]]],["exp",["move to",[["position","r1,0,0"]]]]]]]]
["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r1,0,0"]]]]]]]]],["condition",["is empty",[["position","r1,0,0"]]]]]]
I'm going to achieve task ["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r1,0,0"]]]]]]]]],["condition",["is empty",[["position","r1,0,0"]]]]]]
I achieved task ["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r1,0,0"]]]]]]]]],["condition",["is empty",[["position","r1,0,0"]]]]]]
["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","444,66,1783"]]]]]]]]],["condition",["is empty",[["position","444,66,1783"]]]]]]
I'm going to achieve task ["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","444,66,1783"]]]]]]]]],["condition",["is empty",[["position","444,66,1783"]]]]]]
I achieved task ["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","444,66,1783"]]]]]]]]],["condition",["is empty",[["position","444,66,1783"]]]]]]
["ifThen",[["condition",["is empty",[["position","444,64,1783"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","item to build"]]]],["exp",["build",[["position","444,64,1783"]]]]]]]]]]]
I'm going to achieve task ["ifThen",[["condition",["is empty",[["position","444,64,1783"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","item to build"]]]],["exp",["build",[["position","444,64,1783"]]]]]]]]]]]
I achieved task ["ifThen",[["condition",["is empty",[["position","444,64,1783"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","item to build"]]]],["exp",["build",[["position","444,64,1783"]]]]]]]]]]]
I'm going to achieve task ["move to",[["position","r1,0,0"]]]
success 2
I achieved task ["move to",[["position","r1,0,0"]]]
I achieved task ["taskList",[["taskList",[["exp",["sdig",[["position","r1,0,0"]]]],["exp",["sdig",[["position","444,66,1783"]]]],["exp",["sbuild",[["position","444,64,1783"]]]],["exp",["move to",[["position","r1,0,0"]]]]]]]]
["taskList",[["taskList",[["exp",["tcc",[]]],["exp",["sbuild",[["position","r0,-2,0"]]]],["exp",["sdig",[["position","r0,-1,0"]]]],["exp",["wait",[["int","400"]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["tcc",[]]],["exp",["sbuild",[["position","r0,-2,0"]]]],["exp",["sdig",[["position","r0,-1,0"]]]],["exp",["wait",[["int","400"]]]]]]]]
I'm going to achieve task ["tcc",[]]
I achieved task ["tcc",[]]
["ifThen",[["condition",["is empty",[["position","r0,-2,0"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","item to build"]]]],["exp",["build",[["position","r0,-2,0"]]]]]]]]]]]
I'm going to achieve task ["ifThen",[["condition",["is empty",[["position","r0,-2,0"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","item to build"]]]],["exp",["build",[["position","r0,-2,0"]]]]]]]]]]]
I achieved task ["ifThen",[["condition",["is empty",[["position","r0,-2,0"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","item to build"]]]],["exp",["build",[["position","r0,-2,0"]]]]]]]]]]]
["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r0,-1,0"]]]]]]]]],["condition",["is empty",[["position","r0,-1,0"]]]]]]
I'm going to achieve task ["repeatUntil",[["exp",["taskList",[["taskList",[["exp",["ssdig",[["position","r0,-1,0"]]]]]]]]],["condition",["is empty",[["position","r0,-1,0"]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["ssdig",[["position","r0,-1,0"]]]]]]]]
["ifThen",[["condition",["is not empty",[["position","r0,-1,0"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","tool to break stone"]]]],["exp",["dig",[["position","r0,-1,0"]]]]]]]]]]]
I'm going to achieve task ["ifThen",[["condition",["is not empty",[["position","r0,-1,0"]]]],["exp",["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","tool to break stone"]]]],["exp",["dig",[["position","r0,-1,0"]]]]]]]]]]]
I'm going to achieve task ["taskList",[["taskList",[["exp",["equip",[["destination","hand"],["item","tool to break stone"]]]],["exp",["dig",[["position","r0,-1,0"]]]]]]]]
I'm going to achieve task ["equip",[["destination","hand"],["item","tool to break stone"]]]
/Users/bshuler/Downloads/rbot/lib/inventory.js:18
var okTools = block.harvestTools;
^

TypeError: Cannot read property 'harvestTools' of undefined
at canHarvest (/Users/bshuler/Downloads/rbot/lib/inventory.js:18:24)
at Object.toolToBreak (/Users/bshuler/Downloads/rbot/lib/inventory.js:31:7)
at stringToItem (/Users/bshuler/Downloads/rbot/lib/stringTo.js:146:76)
at item (/Users/bshuler/Downloads/rbot/lib/stringTo.js:21:38)
at /Users/bshuler/Downloads/rbot/lib/stringTo.js:39:119
at /Users/bshuler/Downloads/rbot/node_modules/async/lib/async.js:356:13
at async.forEachOf.async.eachOf (/Users/bshuler/Downloads/rbot/node_modules/async/lib/async.js:233:13)
at _asyncMap (/Users/bshuler/Downloads/rbot/node_modules/async/lib/async.js:355:9)
at Object.map (/Users/bshuler/Downloads/rbot/node_modules/async/lib/async.js:337:20)
at Object.stringTo (/Users/bshuler/Downloads/rbot/lib/stringTo.js:39:8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.