{"action":"opened","issue":{"url":"https://api.github.com/repos/andrewrk/mineflayer/issues/275","labels_url":"https://api.github.com/repos/andrewrk/mineflayer/issues/275/labels{/name}","comments_url":"https://api.github.com/repos/andrewrk/mineflayer/issues/275/comments","events_url":"https://api.github.com/repos/andrewrk/mineflayer/issues/275/events","html_url":"https://github.com/andrewrk/mineflayer/issues/275","id":71577517,"number":275,"title":"Combining multiple tasks","user":{"login":"rom1504","id":2346494,"avatar_url":"https://avatars.githubusercontent.com/u/2346494?v=3","gravatar_id":"","url":"https://api.github.com/users/rom1504","html_url":"https://github.com/rom1504","followers_url":"https://api.github.com/users/rom1504/followers","following_url":"https://api.github.com/users/rom1504/following{/other_user}","gists_url":"https://api.github.com/users/rom1504/gists{/gist_id}","starred_url":"https://api.github.com/users/rom1504/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rom1504/subscriptions","organizations_url":"https://api.github.com/users/rom1504/orgs","repos_url":"https://api.github.com/users/rom1504/repos","events_url":"https://api.github.com/users/rom1504/events{/privacy}","received_events_url":"https://api.github.com/users/rom1504/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-28T12:33:42Z","updated_at":"2015-04-28T12:33:42Z","closed_at":null,"body":"When creating a bot, you usually want to combine many different methods and information to accomplish tasks.\r\nMineflayer provides unit action (digging, simple movements, building, ...) and information.\r\n\r\nThere are many ways to combine these actions to produce useful behavior : \r\n* the [pyramid of doom](https://github.com/andrewrk/mineflayer/blob/094a9510cb514ca56f9ce8f888aa4c6d0d7ac7d4/test/externalTests/useChests.js#L28)  (anti-)pattern\r\n* defining case specific functions to combine functions ([this](https://github.com/andrewrk/mineflayer/blob/5675cbd0dab18bd019771327f9ab8c40b4c9536f/test/externalTests/plugins/testCommon.js#L21) for example)\r\n* state machines (in [mineflayer-scaffold](https://github.com/andrewrk/mineflayer-scaffold/blob/master/index.js#L65))\r\n* iterators (in [helperbot](https://github.com/Darthfett/helperbot/blob/8a9ca118d2e9e21a79091034040e304f4256f2a6/lib/plugins/stripmine.js#L197))\r\n* meta programming (in [rbot](https://github.com/rom1504/rbot/blob/master/task/syntaxTask.js))\r\n* a task manager (see [dutie](https://github.com/demipixel/dutie) and [dutieflayer](https://github.com/demipixel/dutieflayer) but also [duties](https://github.com/wtfaremyinitials/duties))\r\n\r\nThere are also some stuff provided by the js community that might be useful : \r\n* [async](https://github.com/caolan/async)\r\n* [promises](https://github.com/kriskowal/q)\r\n\r\nIn this issue I'd like to talk about whether we can find some common ways on how to combine mineflayer tasks to get useful mineflayer. That doesn't mean these ways should be included in mineflayer, but since mineflayer is the common factor in all this, it seems a good place to talk about.\r\n\r\nI think criteria to know whether one of these ways works or not are : \r\n* do you need to write a lot of code to use it ?\r\n* is that code complicated to read ?\r\n* how much was done with that method ? does it work to actually get useful bots ?\r\n\r\nIt might be interesting to make a table to compare all these methods (with the pros and the cons).\r\n\r\nThe discussion has also started there https://github.com/andrewrk/mineflayer/issues/182 and there https://github.com/demipixel/dutie/wiki/Example-task-scenarios."}}