inkle / inkle/ink

How to use variable that has string value in if statement?

Open
#541 5 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

Hey.

I have a global variable that has string values through the story and in connection on the variable changes i will active the popup and wire the value to the text object. So which function should i use to set it?

**Variables;**
`
VAR TATI_MESSAGE = 0`
`
~ TATI_MESSAGE = "system recovered"

~ TATI_MESSAGE = "portal opens"`

I am trying to use variableState with following the code line but i couldnt find how to use it in if statement;
`_inkStory.variablesState["TATI_MESSAGE"] = _tatiMessageText.text;`

**Edit:**
I have changed the global int value to string " " and now can pull the text from the story to the text object. Now the last problem left; how can i trigger the popup object when the variable changes ? There is a long way that adding a global variable named like "TATI_POPUP = 1" and adding this one just before of the all "TATI_MESSAGE" variables but is there a short way that i can use?

Contributor guide

No contributing guide indexed for this repository

Research direction

Use the TATI_MESSAGE declarations and the _inkStory.variablesState[...] assignment as the starting points. Check the existing Ink/C# API behavior for conditionals and variable changes; completion should establish a concrete way to detect the change and trigger the popup, or clearly identify that no shorter mechanism is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.