inkle / inkle/ink

Printing variables within a conditional choice?

Open
#222 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.9k
Forks
540
PR merge metrics
No merged PRs in 30d

Description

Hi everybody,

I am currently trying to vary choice texts and running into an obstacle that I don't have in normal text - so it would be lovely if someone could if I am doing something wrong or if this is just not intended.
Is there a way to print variables within a choice? It seems that everything within curly brackets and within a choice is interpreted as a choice condition.

So for example:
`+ [1] {member_one_name}`
Puts out only "1".

Using a function instead of just curly brackets leads to the same result:
`[1] {print_name(1)}`
Puts out only "1".

The entire thing gets even more tricky when I try to make the choice conditional on top of printing variables:
So while this works fine:

```
+ {member_one_action == "none" && member_one}Luke
~ picked_member = member_one_name
~ member_one_action ="make_flyer"
->send_making_flyer
```

This

```
+ {member_one_action == "none" && member_one}{member_one_name}
~ picked_member = member_one_name
~ member_one_action ="make_flyer"
->send_making_flyer<
```

leads to a
"you shouldn't use a '~' here. tildas are for logic that's on its own line..." <
for the ~picked_member= line

So I am slightly confused, wheather it is just not intended to ever print variables within a choice or if I am doing something wrong.
Is there a workaround or am I just overlooking something?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.