ink
ink copied to clipboard
[Feature Request] Tags in Choices
I've seen it mentioned elsewhere, put just thought I'd put in my request/support/pleading for accessing tags in Choices.
Our current use case is we are using tags to define character expressions for lines of dialogue. e.g: Bob: Hi Jim! #EXP_Bob_happy #EXP_Jim_scared
This is fine and works as intended, characters change their expressions when stepping through lines.
But when it come to choices, as the player is cycling through the list of options in a carousel we'd like to preview the player characters expression that selecting the currently highlighted choice would produce.
Currently our Choices are very simple, just repeating the line once selected
- Bob: How do I get there? #EXP_Bob_confused
- Bob: Will it be dangerous? #EXP_Bob_scared
so we'd just want to get the tags of the result in order to preview the expression
To work around this we're adding in custom tags on choices and parsing them out of the option text.
- Bob: How do I get there? $EXP_Bob_confused #EXP_Bob_confused
- Bob: Will it be dangerous? $EXP_Bob_scared #EXP_Bob_scared
At some point we'd also like to attempt localisation by id tagging each line, so being able to tag Choice text in engine would be helpful there too.
Thanks, Owen
I'm currently working on a game where depending on the kind of choice, the choices are supposed to be displayed differently. Therefore I'm using a similar workaround since choice tags are still only available after the choice was taken. Imho that produces incredibly ugly code. A simple choice.getTags() would be amazing.
We hear the request but it has a bit of a gotcha, which is where should tag go on
- “greetings[!”],” I said. #tag
On both the choice and the output text? Maybe.
Anyway for now I would put text directly into the choice if you need it there; and parse / regex it back out again.
- “Greetings!” (smiling)
... or similar.
Jon
—
You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/inkle/ink/issues/372#issuecomment-480248584, or mute the thread https://github.com/notifications/unsubscribe-auth/AA40o9eEl9vcAhN08C9cha0kCexw98hNks5vdzmdgaJpZM4P1W_u .
-- Jazz, in Three-Four Time: A Novel http://www.amazon.co.uk/dp/B004K1EYIE
any update regarding this?
None so far! The recommended method is still marking up the text inside the choice itself.
Hey! I actually found a method that I think works... quite nicely? Hosted right here in a gist. It's using InkJS, though it should be possible to use similar or identical methods using other implementations of Ink.
Basically, it grabs the first tag from every available choice, as long as that tag is on the same physical line the choice in your ink file. So this would return "tag"--
* choice #tag
And this wouldn't.
* choice
#tag
(This last one would apply "tag" to all text in the choice, both before and after the choice is taken).
* choice[] trailing text #tag
As long as you're consistent with your tagging — that is, keep choice tags on the same line, and subsequent tags on the following line, then this'll work. I have a feeling that it isn't a perfect solution, but I haven't run into any problems yet.
I can vouch that @elliotherriman's implementation seems to work for fetching tags from choices; I tested the implementation in my own project and I'm successfully able to use choice tags (I made some project-specific modifications in my implementation like being able to get an array of tags instead of a single tag, but the core idea is the same as the one described by @elliotherriman).
So it looks like choice tags are indeed possible as long as one is willing to write a small bit of code for it. I would recommend to either make this solution more accessible in Ink via some kind of function or just to leave the current behaviour as-is and allow people to code their own solutions. In other words, please don't remove the behaviour that allows for the implementation that @elliotherriman found 😛
I don't think Jon was suggesting that this functionality isn't possible, only that it could cause issues in choices that use the square brackets, and are therefore split into two lines behind the scenes.
That said, I can't think of a single use case for needing different tags on a choice and output text. And even if there were, surely it would be up to the user to resolve that themselves-- theoretically maybe by using glue to recreate the effect of square brackets? Though I'm not sure how that works behind the scenes.
In the Ink 1.0 release post, or something posted around that time, I remember reading that the team felt a little weird exposing all the Ink functions by converting them from internal to public, but decided to do it anyway, because it seemed more important for the engine to be flexible and hackable. I'd consider this a similar situation. Probably a little rickety, maybe not what the developers intended, but absolutely useful to a number of creators. So I do really hope an official function is added, yeah.
Hi! I was wondering if this would be a sensible use for timed responses. e.g.
- Don't you look smashing? I couldn't miss you for a mile away... -> compliment_divert # timer 5
- Hey! It's been forever! What are you doing now? -> greeting_divert # timer 10
- -> Freeze and stay silent ->default_divert # timer default
Using elliotherriman's method, I think I can find a way to get the timer tag data into unity and remove the first choice after 5 seconds, and after all timers expire (10 seconds), a default response of "Freeze and stay silent" would be selected. Is there any better ways of making countdown timers for response choices in ink+unity?
Is there any better ways of making countdown timers for response choices in ink+unity?
Probably only the ones outlined in the original post.
I'm actually working on supporting some common Twine features through a rewrite of the Ink web player-- so I'm happy to let you know once I've figured out the code for timed responses?
Not sure if this helps anyone here, but there is a post about using External function, which should solve OP's issue, however would have to rewrite significant code to implement. Should work in choices(???)
The gist is no longer available. Does anyone still have the code? I need to add tags to my choices as well :(
The gist is no longer available. Does anyone still have the code? I need to add tags to my choices as well :(
Hey! The version in that gist had a few issues — you can find an updated version here.
It's written as a patch for Calico, so if you're building something in Unity or the vanilla ink player, you'll need to adapt lines 28 to 55 (inclusive).
What's the official solution to this?
What's the official solution to this?
As of 1.1.1, runtime choice objects have a list of tags that can be accessed via whateverYourChoiceObjectIsNamed.tags
. You can read more here.
Oh, okay, I see. I shouldn't have been using the old version from Unity Asset Store.
This issue should be closed based on the 1.1.1 release, no?