Hello,
I would save a value in a config file and check if that value has been set. You can use the Config file object to do this.
Here's some quick code that will do that. There's no error checking, but it does what it needs to do. The config file is saved (in Window) in C:\Users\USERNAME\AppData\Roaming\Godot\app_userdata\GODOT PROJECT NAME
extends Node2D
var only_show_once = false
var config_file = "user://settings.cfg"
func _ready():
var directory = Directory.new();
if !directory.file_exists(config_file):
print("Config file doesn't exist")
else:
load_config(config_file)
if only_show_once:
print("This isn't the first time this app has been run")
else:
print("First run. Add some code to show a popup box.")
only_show_once = true
save_config(config_file)
func load_config(filename):
var config = ConfigFile.new()
config.load(filename)
only_show_once = config.get_value("config", "only_show_once")
func save_config(filename):
var config = ConfigFile.new()
config.set_value("config", "only_show_once", only_show_once)
config.save(filename)
The above code creates a text file that looks like this:
[config]
only_show_once=true
You can edit that with a text file and set the value back to false to check it works as expected.
You can also save other config values to that file.