You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm v new to ink and I'm wondering is there a way to perform logic based on the outcome of a shuffle?
I feel like I'd want to be able to do something like this
VAR holding_item = false
{~He hands me a cup of coffee {holding_item = true} | He hands me the newspaper {holding_item = true}}
Although it feels like the markup is encouraging me to do it more like this
VAR holding_item = false
{~He hands me a cup of coffee {set_bool(holding_item, true)} | He hands me the newspaper {set_bool(holding_item, true)}}
== function set_bool (bool, state)
~ bool = state
I read all the documentation and searched these topics but I couldn't quite tell what was the proper way to do this. Any help appreciated!
The text was updated successfully, but these errors were encountered:
Hey!
The second way is the way to do it; we often make little atomic functions
for use inline (even "set_true" and "set_false" to keep things short.)
Note that your function needs to use the "ref" keyword to show that's going
to actually edit the Boolean variable itself, rather than making a new
temporary value and setting that.
== function set_bool (ref bool, state)
~ bool = state
Cheers!
Jon
On Thu, 9 Mar 2017 at 6:29 am, ClaireHosking ***@***.***> wrote:
Hi All,
I'm v new to ink and I'm wondering is there a way to perform logic based
on the outcome of a shuffle?
I feel like I'd want to be able to do something like this
VAR holding_item = false
{~He hands me a cup of coffee {holding_item = true} | He hands me the newspaper {holding_item = true}}
Although it feels like the markup is encouraging me to do it more like this
VAR holding_item = false
{~He hands me a cup of coffee {set_bool(holding_item, true)} | He hands me the newspaper {set_bool(holding_item, true)}}
== function set_bool (bool, state)
~ bool = state
I read all the documentation and searched these topics but I couldn't
quite tell what was the proper way to do this. Any help appreciated!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#282>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA40o3tZ4_HY8EoCdUzkoEPg959b4AdKks5rj5xhgaJpZM4MXsji>
.
Hi All,
I'm v new to ink and I'm wondering is there a way to perform logic based on the outcome of a shuffle?
I feel like I'd want to be able to do something like this
Although it feels like the markup is encouraging me to do it more like this
I read all the documentation and searched these topics but I couldn't quite tell what was the proper way to do this. Any help appreciated!
The text was updated successfully, but these errors were encountered: