Skip to content

How to set variable to itself plus one through code #1326

Discussion options

You must be logged in to vote

Okay, I solved the issue. It was because I wasn't saving it properly in my new scene. Here I'll post my code in case someone else has another question similar to this.

// This converts string into integer
onready var story_passage = int(Dialogic.get_variable('story_passage'))

// This will check what the number is and display the prompt (I have this match function within a process func to update constantly), you can also just have another func that will update when the variable is changed.
match story_passage:
0:
$RichTextLabel.bbcode_text = 'hello world'

// This is a button which increases the number by one and set the new value.
func _on_Next_pressed():
story_passage += 1
Dialogic.set_va…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by creativecorvus3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant