I would really appreciate some help with a little interactive fiction game I'm making (个_个)
So, I have an autoloaded script file where I'm storing my global variables such as:
var player_name
var player_gender
and another autoloaded script file where the pages for the story are:
var scene1 = {
"P0001" : "Page one text",
"P0002" : "Page two's text!" + "\n" + "Hello " + str(global.player_name) + "!",
"P0003" : "Page three text",
"P0004" : "Page four text",
"P0005" : "Page five text"
}
And the value for the player_name is being set in my lineEdit node's script:
func _process(_delta):
if global.currentPage == "I0001":
self.show()
if $confirmButton.pressed == true:
global.player_name = $Sprite/MarginContainer/VBoxContainer/LineEdit.text
global.currentPage = "C0001"
self.hide()
When I run the game, instead of player_name showing as the inputted name, instead it's returning as 'Null'
Hello Null!
I feel like I'm either making a little silly mistake that I can't see or I'm just going about this all wrong.
Any help would be really appreciated, and thank you for your time!