{"action":"created","issue":{"url":"https://api.github.com/repos/inkle/ink/issues/493","repository_url":"https://api.github.com/repos/inkle/ink","labels_url":"https://api.github.com/repos/inkle/ink/issues/493/labels{/name}","comments_url":"https://api.github.com/repos/inkle/ink/issues/493/comments","events_url":"https://api.github.com/repos/inkle/ink/issues/493/events","html_url":"https://github.com/inkle/ink/issues/493","id":379191998,"node_id":"MDU6SXNzdWUzNzkxOTE5OTg=","number":493,"title":"procedurally generated choice text ","user":{"login":"darbotron","id":2547584,"node_id":"MDQ6VXNlcjI1NDc1ODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/2547584?v=4","gravatar_id":"","url":"https://api.github.com/users/darbotron","html_url":"https://github.com/darbotron","followers_url":"https://api.github.com/users/darbotron/followers","following_url":"https://api.github.com/users/darbotron/following{/other_user}","gists_url":"https://api.github.com/users/darbotron/gists{/gist_id}","starred_url":"https://api.github.com/users/darbotron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darbotron/subscriptions","organizations_url":"https://api.github.com/users/darbotron/orgs","repos_url":"https://api.github.com/users/darbotron/repos","events_url":"https://api.github.com/users/darbotron/events{/privacy}","received_events_url":"https://api.github.com/users/darbotron/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-09T14:52:06Z","updated_at":"2018-11-09T15:18:11Z","closed_at":null,"author_association":"NONE","body":"Hi\r\n\r\nI have a very specific thing and edge-casey thing I'm trying to do with choices.\r\n\r\nIt feels like it *should* be possible and it *almost* works but not quite & I'm wondering if I'm just missing something tiny, or whether it's impossible...\r\n\r\nI uses a custom markup to insert commands inline into ink's output text which is then used in-game to drive various systems - things like tracking who is currently talking, making characters' heads turn toward whoever is talking, setting animation triggers etc.\r\n\r\nAnyway, the system I have hits an edge case when dealing with commands inside option text. It's entirely possible to work around it, but the specific ordering of the commands and ink script operators is super precise and I'd like to automate it so that I can reduce the risk of our writer introducing bugs \r\n\r\nConsider the following:\r\n\r\n```\r\n// commands are processed at the point the text containing them is read by the game\r\n// this means commands in option text are processed as soon as the game sees the option text rather \r\n// than when the options are chosen\r\n//\r\n// our commands have the syntax: command:param1@param2...@paramN>>\r\n// any command without the ':' is assumed to be a \"SpeakTo\"\r\n// @ is a separator the 'D1' and 'ST' are IDs of specific characters\r\n// D1@ST>> means \"D1 speaking to ST\"\r\n// ST>>means \"ST speaking\"\r\n//\r\n// -> NEXT -> is a \"utility tunnel\" which inserts a default \"next...\" choice which we will probably \r\n// eventually handle automatically for UX reasons, maybe with text which appears over time or \r\n// something. whatever. :)\r\n\r\n// in this case the game acts as if ST is talking before they choose the options\r\nD1@ST>> Hello? -> NEXT ->       \r\n    + ST>> Hi. Is Mr. Tong in?\r\n    + ST>> Good morning. We're here to see Mr Tong.\r\n    - -> NEXT ->\r\n    D1>> I'm afraid he's out right now.\r\n\r\n// it's work-aroundable by doing this ...\r\nD1@ST>> Hello? -> NEXT ->               \r\n    + [Hi. Is Mr. Tong in?] ST>> Hi. Is Mr. Tong in?\r\n    + [Good morning. We're here to see Mr Tong.] ST>> Good morning. We're here to see Mr Tong.\r\n    - -> NEXT ->\r\n    D1>> I'm afraid he's out right now.\r\n\r\n// or, by doing this ...\r\nD1@ST>> Hello?        \r\n    + Hi. Is Mr. Tong in?\r\n    + Good morning. We're here to see Mr Tong.\r\n    - ST>> -> NEXT ->\r\n    D1>> I'm afraid he's out right now.\r\n\r\n// but neither of these are ideal - one duplicates loads of text, increasing the chance of mistakes; the \r\n// other puts the command in a super unintuitive place\r\n```\r\n\r\nAnyway I thought maybe I could do the first workaround ( the one with the text duplication problem) programatically - either with a function or a thread:\r\n\r\n```\r\n// generate a spoken option so it works with the in-game ui\r\n=== function SpokenOption( postChoiceCommand, optionText )\r\n    ~return \"[<>\" + optionText + \"<>] <>\" +postChoiceCommand +\"<>\" + optionText\r\n\r\n    // the <> are necessary or the { SpokenOption(..) } is treated as a condition to include the option\r\n    // however - I guess because it's inserting a string at run time rather than compile time\r\n    // this generates the option text \"[Hi. Is Mr. Tong in?] ST>>Hi. Is Mr. Tong in?\"\r\n    D1@ST>> Hello? -> NEXT ->        \r\n    +<>{SpokenOption( \"ST>>\", \"Hi. Is Mr. Tong in?\" )}\r\n    +<>{SpokenOption( \"ST>>\", \"Good morning. We're here to see Mr Tong.\" )}\r\n    - -> NEXT ->\r\n\r\n// generate a spoken option so it works with the in-game ui\r\n=== ThreadSpokenOption( postChoiceCommand, optionText, ->ReturnTo )\r\n    + [{optionText}]{postChoiceCommand}{optionText} ->ReturnTo\r\n\r\n    // this generates the correct option text and works, but is totally non-scaleable\r\n    // as the divert target used by the thread would need to be unique for every branch it was used for..\r\n    D1@ST>> Hello? -> NEXT ->        \r\n    <- ThreadSpokenOption( \"ST>>\", \"Hi. Is Mr. Tong in?\", ->OptionReturn )\r\n    <- ThreadSpokenOption( \"ST>>\", \"Good morning. We're here to see Mr Tong.\", ->OptionReturn )\r\n    -(OptionReturn) -> NEXT ->\r\n```\r\n\r\nI guess what I really need is a sort of text insertion macro thing like the C++ pre-processor?\r\n```\r\n#define SpokenOption( postChoiceCommand, optionText )\\\r\n    \"[\" #optionText \"]\" #postChoiceCommand \"\" #optionText\r\n```\r\n\r\nor is there some other way of achieving this which I missed?\r\n\r\nAs I was typing this I also realised I can fix my specific issue by just processing commands in option text when the option is selected rather than when the option text is processed so I guess it's moot, but I still think something allowing this sort of thing would be a very helpful feature"},"comment":{"url":"https://api.github.com/repos/inkle/ink/issues/comments/437390769","html_url":"https://github.com/inkle/ink/issues/493#issuecomment-437390769","issue_url":"https://api.github.com/repos/inkle/ink/issues/493","id":437390769,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzM5MDc2OQ==","user":{"login":"joningold","id":930979,"node_id":"MDQ6VXNlcjkzMDk3OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/930979?v=4","gravatar_id":"","url":"https://api.github.com/users/joningold","html_url":"https://github.com/joningold","followers_url":"https://api.github.com/users/joningold/followers","following_url":"https://api.github.com/users/joningold/following{/other_user}","gists_url":"https://api.github.com/users/joningold/gists{/gist_id}","starred_url":"https://api.github.com/users/joningold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joningold/subscriptions","organizations_url":"https://api.github.com/users/joningold/orgs","repos_url":"https://api.github.com/users/joningold/repos","events_url":"https://api.github.com/users/joningold/events{/privacy}","received_events_url":"https://api.github.com/users/joningold/received_events","type":"User","site_admin":false},"created_at":"2018-11-09T15:18:11Z","updated_at":"2018-11-09T15:18:11Z","author_association":"MEMBER","body":"So:\n\n- sounds like processing the option text at time of choosing makes sense,\nsince if you had three choices with different people talking to different\npeople, or whatever, you wouldn't want all of them of to fire off. We\nbasically do exactly this in Heaven's Vault, where options take the form\n\n* El (to Six): What's going on here?\n\nThe option printed on screen is \"What's going on here\"; on choosing, the\ndialogue is given to El, and directed at Six.\n\n- a syntax for allowing variations in the beginnings of choice texts would\nbe super-useful for dialogue-type stuff (a lot of people have asked for the\nability to do\n\n* [\"Tell me something.\"] John: Tell me something.\n\n... in a more compact way. At the moment, that's not something we're\nconsidering because, while the current use of []'s is a bit specific, at\nleast its straightforward - cases like this should probably just be handled\nby game-code transforming the text as you want it to. (And you could invent\nyour own markup for this, if you wanted it; as the >> you're using\nbasically is.)\n\nOn Fri, Nov 9, 2018 at 2:52 PM darbotron <notifications@github.com> wrote:\n\n> Hi\n>\n> I have a very specific thing and edge-casey thing I'm trying to do with\n> choices.\n>\n> It feels like it *should* be possible and it *almost* works but not quite\n> & I'm wondering if I'm just missing something tiny, or whether it's\n> impossible...\n>\n> I uses a custom markup to insert commands inline into ink's output text\n> which is then used in-game to drive various systems - things like tracking\n> who is currently talking, making characters' heads turn toward whoever is\n> talking, setting animation triggers etc.\n>\n> Anyway, the system I have hits an edge case when dealing with commands\n> inside option text. It's entirely possible to work around it, but the\n> specific ordering of the commands and ink script operators is super precise\n> and I'd like to automate it so that I can reduce the risk of our writer\n> introducing bugs\n>\n> Consider the following:\n>\n> `\n> // commands are processed at the point the text containing them is read by\n> the game\n> // this means commands in option text are processed as soon as the game\n> sees the option text rather\n> // than when the options are chosen\n> //\n> // our commands have the syntax: command:param1@param2...@paramn\n> <https://github.com/paramn>>>\n> // any command without the ':' is assumed to be a \"SpeakTo\"\n> // @ is a separator the 'D1' and 'ST' are IDs of specific characters\n> // D1@ST>> means \"D1 speaking to ST\"\n> // ST>>means \"ST speaking\"\n> //\n> // -> NEXT -> is a \"utility tunnel\" which inserts a default \"next...\"\n> choice which we will probably\n> // eventually handle automatically for UX reasons, maybe with text which\n> appears over time or\n> // something. whatever. :)\n>\n> // in this case the game acts as if ST is talking before they choose the\n> options\n> D1@ST>> Hello? -> NEXT ->\n> + ST>> Hi. Is Mr. Tong in?\n> + ST>> Good morning. We're here to see Mr Tong.\n> - -> NEXT ->\n> D1>> I'm afraid he's out right now.\n>\n> // it's work-aroundable by doing this ...\n> D1@ST>> Hello? -> NEXT ->\n> + [Hi. Is Mr. Tong in?] ST>> Hi. Is Mr. Tong in?\n> + [Good morning. We're here to see Mr Tong.] ST>> Good morning. We're here\n> to see Mr Tong.\n> - -> NEXT ->\n> D1>> I'm afraid he's out right now.\n>\n> // or, by doing this ...\n> D1@ST>> Hello?\n> + Hi. Is Mr. Tong in?\n> + Good morning. We're here to see Mr Tong.\n> - ST>> -> NEXT ->\n> D1>> I'm afraid he's out right now.\n>\n> // but neither of these are ideal - one duplicates loads of text,\n> increasing the chance of mistakes; the\n> // other puts the command in a super unintuitive place\n> `\n>\n> Anyway I thought maybe I could do the first workaround ( the one with the\n> text duplication problem) programatically - either with a function or a\n> thread:\n> `\n> // generate a spoken option so it works with the in-game ui\n> === function SpokenOption( postChoiceCommand, optionText )\n> ~return \"[<>\" + optionText + \"<>] <>\" +postChoiceCommand +\"<>\" + optionText\n>\n> // the <> are necessary or the { SpokenOption(..) } is treated as a condition to include the option\n> // however - I guess because it's inserting a string at run time rather than compile time\n> // this generates the option text \"[Hi. Is Mr. Tong in?] ST>>Hi. Is Mr. Tong in?\"\n> D1@ST>> Hello? -> NEXT ->\n> +<>{SpokenOption( \"ST>>\", \"Hi. Is Mr. Tong in?\" )}\n> +<>{SpokenOption( \"ST>>\", \"Good morning. We're here to see Mr Tong.\" )}\n> - -> NEXT ->\n>\n> // generate a spoken option so it works with the in-game ui\n> === ThreadSpokenOption( postChoiceCommand, optionText, ->ReturnTo )\n> + [{optionText}]{postChoiceCommand}{optionText} ->ReturnTo\n>\n> // this generates the correct option text and works, but is totally non-scaleable\n> // as the divert target used by the thread would need to be unique for every branch it was used for..\n> D1@ST>> Hello? -> NEXT ->\n> <- ThreadSpokenOption( \"ST>>\", \"Hi. Is Mr. Tong in?\", ->OptionReturn )\n> <- ThreadSpokenOption( \"ST>>\", \"Good morning. We're here to see Mr Tong.\", ->OptionReturn )\n> -(OptionReturn) -> NEXT ->\n>\n> `\n>\n> I guess what I really need is a sort of text insertion macro thing like\n> the C++ pre-processor?\n> #define SpokenOption( postChoiceCommand, optionText )\\ \"[\" #optionText \"]\"\n> #postChoiceCommand \"\" #optionText\n>\n> or is there some other way of achieving this which I missed?\n>\n> As I was typing this I also realised I can fix my specific issue by just\n> processing commands in option text when the option is selected rather than\n> when the option text is processed so I guess it's moot, but I still think\n> something allowing this sort of thing would be a very helpful feature\n>\n> —\n> You are receiving this because you are subscribed to this thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/inkle/ink/issues/493>, or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AA40o9SL9IJHYO_rXKhxVjxx2b1Zmrhdks5utZaXgaJpZM4YWtoQ>\n> .\n>\n"}}
{"actor":{"display_login":"joningold"}}