{"action":"created","issue":{"url":"https://api.github.com/repos/leMaik/RpgPlus/issues/19","labels_url":"https://api.github.com/repos/leMaik/RpgPlus/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/leMaik/RpgPlus/issues/19/comments","events_url":"https://api.github.com/repos/leMaik/RpgPlus/issues/19/events","html_url":"https://github.com/leMaik/RpgPlus/issues/19","id":113412833,"number":19,"title":"Dialog system","user":{"login":"leMaik","id":5544859,"avatar_url":"https://avatars.githubusercontent.com/u/5544859?v=3","gravatar_id":"","url":"https://api.github.com/users/leMaik","html_url":"https://github.com/leMaik","followers_url":"https://api.github.com/users/leMaik/followers","following_url":"https://api.github.com/users/leMaik/following{/other_user}","gists_url":"https://api.github.com/users/leMaik/gists{/gist_id}","starred_url":"https://api.github.com/users/leMaik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leMaik/subscriptions","organizations_url":"https://api.github.com/users/leMaik/orgs","repos_url":"https://api.github.com/users/leMaik/repos","events_url":"https://api.github.com/users/leMaik/events{/privacy}","received_events_url":"https://api.github.com/users/leMaik/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/leMaik/RpgPlus/labels/scripting","name":"scripting","color":"0052cc"}],"state":"closed","locked":false,"assignee":{"login":"leMaik","id":5544859,"avatar_url":"https://avatars.githubusercontent.com/u/5544859?v=3","gravatar_id":"","url":"https://api.github.com/users/leMaik","html_url":"https://github.com/leMaik","followers_url":"https://api.github.com/users/leMaik/followers","following_url":"https://api.github.com/users/leMaik/following{/other_user}","gists_url":"https://api.github.com/users/leMaik/gists{/gist_id}","starred_url":"https://api.github.com/users/leMaik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leMaik/subscriptions","organizations_url":"https://api.github.com/users/leMaik/orgs","repos_url":"https://api.github.com/users/leMaik/repos","events_url":"https://api.github.com/users/leMaik/events{/privacy}","received_events_url":"https://api.github.com/users/leMaik/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/leMaik/RpgPlus/milestones/1","html_url":"https://github.com/leMaik/RpgPlus/milestones/MS1:%20Basic%20functionality%20and%20API","labels_url":"https://api.github.com/repos/leMaik/RpgPlus/milestones/1/labels","id":1341239,"number":1,"title":"MS1: Basic functionality and API","description":"Some basic functionality is done. Scripting a simple RPG should already be possible, but more complicated (and more awesome) features are still missing.\r\nDialogs, shopping and mob interaction is implemented.","creator":{"login":"leMaik","id":5544859,"avatar_url":"https://avatars.githubusercontent.com/u/5544859?v=3","gravatar_id":"","url":"https://api.github.com/users/leMaik","html_url":"https://github.com/leMaik","followers_url":"https://api.github.com/users/leMaik/followers","following_url":"https://api.github.com/users/leMaik/following{/other_user}","gists_url":"https://api.github.com/users/leMaik/gists{/gist_id}","starred_url":"https://api.github.com/users/leMaik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leMaik/subscriptions","organizations_url":"https://api.github.com/users/leMaik/orgs","repos_url":"https://api.github.com/users/leMaik/repos","events_url":"https://api.github.com/users/leMaik/events{/privacy}","received_events_url":"https://api.github.com/users/leMaik/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":10,"state":"open","created_at":"2015-10-06T19:57:34Z","updated_at":"2015-10-29T23:16:39Z","due_on":"2015-10-30T23:00:00Z","closed_at":null},"comments":1,"created_at":"2015-10-26T17:51:26Z","updated_at":"2015-10-29T23:16:39Z","closed_at":"2015-10-29T23:16:39Z","body":"We need a dialog system. The syntax might be like this:\r\n```lua\r\nlocal dialog = requrie 'rpgplus.dialog'\r\ndialog.ask(entity, player, \"What's the answer?\", function(response, respond)\r\n   if response == 42 then\r\n      respond(\"That's it!\")\r\n   else\r\n      respond(\"Nope, it's 42.\")\r\n   end\r\nend)\r\n```\r\nThe question can also be a list, then a random item will be sent to the player. This is useful for multiple variants of a question. The response may also be a string or a list of strings.\r\n\r\nTo simply say something:\r\n```lua\r\ndialog.tell(entity, player, \"Hi!\")\r\ndialog.tell(entity, player, {\"Hi!\", \"Howdy!\", \"Yo!\"}, \"How are you?\", {\"I'm fine.\", \"I'm allright.\"})\r\n```\r\n\r\n```lua\r\ndialog.askUntil(\r\n   function(answer) return answer == 42 end, \r\n   \"What's the answer?\",\r\n   {\"Nah, try again.\", \"No, try again! What's the answer?\"}, \r\n   {\"Great!\", \"Awesome!\"}\r\n)\r\n```\r\n~~`askUntil` waits repeats the question until the predicate function returns `true`. Also, the question and responses may be strings or string lists, as before. The responses may also be functions, as above.~~ `askUntil` won't be implemented. You can reproduce its behaviour easily. Instead, if the callback of `ask` returns false, the question will be sent again."},"comment":{"url":"https://api.github.com/repos/leMaik/RpgPlus/issues/comments/152354145","html_url":"https://github.com/leMaik/RpgPlus/issues/19#issuecomment-152354145","issue_url":"https://api.github.com/repos/leMaik/RpgPlus/issues/19","id":152354145,"user":{"login":"leMaik","id":5544859,"avatar_url":"https://avatars.githubusercontent.com/u/5544859?v=3","gravatar_id":"","url":"https://api.github.com/users/leMaik","html_url":"https://github.com/leMaik","followers_url":"https://api.github.com/users/leMaik/followers","following_url":"https://api.github.com/users/leMaik/following{/other_user}","gists_url":"https://api.github.com/users/leMaik/gists{/gist_id}","starred_url":"https://api.github.com/users/leMaik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leMaik/subscriptions","organizations_url":"https://api.github.com/users/leMaik/orgs","repos_url":"https://api.github.com/users/leMaik/repos","events_url":"https://api.github.com/users/leMaik/events{/privacy}","received_events_url":"https://api.github.com/users/leMaik/received_events","type":"User","site_admin":false},"created_at":"2015-10-29T23:16:39Z","updated_at":"2015-10-29T23:16:39Z","body":"Helpers for maintaining state while in conversations are not really needed as any state can be put into a closure. Everything else can be handled with the storage.\r\n\r\nOther functions to make dialogs easier will be added when they are needed."}}