errors in project that worked fine

Godot Version

4.7

Question

hello! i am making a VN-style game in godot with point-and-click function, however, the first scene is purely a visual novel style click-through monologue. it was working fine, and i had to put down my project for a few days, then come back, and now it isn’t working.

i am getting three main errors:

  1.   _load: Resource file not found: res:// (expected type: unknown)
    
  2. start: Failed to instantiate an autoload, can't load from path
    
  3. load_block: Invalid assignment of property or key 'text' with value of type 'String' on a base object of type 'Nil'.
      <GDScript Source>IntroDialog.gd:29 @ load_block()
      <Stack Trace> IntroDialog.gd:29 @ load_block()
                    IntroDialog.gd:19 @ _ready()
    
    

The third error is the one that stops it from running. This is my node setup:

And the script for IntroDialog:

extends Control

const CHAR_READ_RATE = 0.05

@export_file("*.json") var jsonsrc

@export_category("scene reference")
@export var char_text : Label
@export var scene_img : TextureRect

var scene_script : Dictionary
var current_block : Dictionary 
var next_block : Dictionary
var tween = create_tween()

# get json file
func _ready() -> void:
	get_json(jsonsrc)
	load_block(current_block)
	
# parse json file as dict
func get_json(src: String):
	var jsontext = FileAccess.get_file_as_string(src)
	scene_script = JSON.parse_string(jsontext)
	current_block = scene_script["start"]

# update state to show contents
func load_block(block : Dictionary):
		if block.has("text"): char_text.text = block["text"]
		char_text.visible_ratio = 0.0
		var char_raw = str(char_text.text)
		tween = create_tween()
		tween.tween_property(char_text, "visible_characters", len(char_raw), len(char_raw) * CHAR_READ_RATE)
		if block.has("scene"): scene_img.set_scene(block["scene"])
		if block.has("next"):
			var key = block["next"]
			next_block = scene_script[key]
		pass

# load next block for display
func next():
	current_block = next_block
	load_block(current_block)
	pass
		
# handle inputs
func _input(event: InputEvent) -> void:
	if event.is_action_pressed("click"):
		if char_text.visible_ratio < 1.0:
			tween.kill()
			char_text.visible_ratio = 1.0
		elif event.is_action_pressed("click"):
			next()

Which has its Jsonsrc variable resource set to my corresponding json file with the blocks of text and image indicators. The script on the TextureRect that displays images doesn’t really affect this and seems to generally be working fine, as all the paths and assets are active and up to date with how the project files are set up. I can’t seem to figure out why the dialogue script won’t break down the json file into its blocks and display the text (hence the error) even after looking at the documentation for the error type…

Any help is appreciated for any part of this, and I’m happy to answer any questions, I just want to get it working again..! Thank you!

Your char_text is null, make sure your label is assigned in the Inspector panel.

If this is an autoload ensure that the scene is assigned as the autoload, not just the script. You can tell by the path ending in .tscn instead of .gd from the globals/autoload section of the project settings.

thank you! seems a silly thing in hindsight, definitely part of getting used to the engine… much appreciated!