Sure, but the only other code I have written that I think could interact is just a function that prints the value for global_1 when a button is pressed in the scene that’s attempting to use global_1.
# > used as a stand-in for indents
func on_print_example_pressed() -> void:
> print (global_1)
with a signal connecting said button to the function.
For a wider context to the scene itself, it’s a panel of buttons that I am using to test out methods of compiling multiple variables from across the project into a dictionary for saving to a JSON file, but none of the code for actually compiling the dictionary has been written yet as I realized I didn’t actually know how to grab the variables in the first place. Now, here’s the entirety of the scene’s script. (it’s moderately unorganized:)
extends Node2D
var example_value = 1
var file_number
var example_1
var path_dictionary
var var_path
var global_1 = (global.global_1)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
$RichTextLabel.set_text(str(example_value))
# This function will create the dictionary variable that will be saved to the JSON file.
func create_save_dict():
for var_name in path_dictionary:
var_path = path_dictionary[var_name]
# This function will be for the final process of saving to the file
func save_to_file(file_number):
print(file_number)
#
# learn about callables.
return
pass
func _on_plus_one_to_value_pressed() -> void:
# pass # Replace with function body.
example_value += 1
func _on_minus_one_to_value_pressed() -> void:
# pass # Replace with function body.
example_value -= 1
func _on_print_example_pressed() -> void:
print (global_1)
func _on_main_1_path_dictionary_signal(path_dictionary: Variant) -> void:
pass # Replace with function body.
The function at the very bottom was me attempting an experiment with passing variables over signals, but that hasn’t gone anywhere.
Edit just after posting: I have no clue why that second block quote is entirely gray.