Hi, I'm currently working on a dialog box,

Here is my exact error message:

call: Error parsing JSON at line 1: Expected ':'

Here is my exact Debugger message:

Assertion failed: Dialog not found ( obviously this means it wasn't successful in parsing my JSON file )

I am following a youtube tutorial [

I have recreated my dialog box almost 3 times now, I have tried following the video and copying/pasting the text as well; however I always hit the same road block.

Here is my code:


extends ColorRect

export var dialogPath = ""
export(float) var textSpeed = 0.05
 
var dialog
 
var phraseNum = 0
var finished = false
 
func _ready():
	$Timer.wait_time = textSpeed
	dialog = getDialog()
	assert(dialog, "Dialog not found")
	nextPhrase()
 
func _process(_delta):
	$Indicator.visible = finished
	if Input.is_action_just_pressed("ui_accept"):
		if finished:
			nextPhrase()
		else:
			$Text.visible_characters = len($Text.text)
 
func getDialog() -> Array:
	var f = File.new()
	assert(f.file_exists(dialogPath), "File path does not exist")
	
	f.open(dialogPath, File.READ)
	var json = f.get_as_text()
	
	var output = parse_json(json)
	
	if typeof(output) == TYPE_ARRAY:
		return output
	else:
		return []
 
func nextPhrase() -> void:
	if phraseNum >= len(dialog):
		queue_free()
		return
	
	finished = false
	
	$Name.bbcode_text = dialog[phraseNum]["Name"]
	$Text.bbcode_text = dialog[phraseNum]["Text"]
	
	$Text.visible_characters = 0
	
  
	while $Text.visible_characters < len($Text.text):
		$Text.visible_characters += 1
		
		$Timer.start()
		yield($Timer, "timeout")
	
	finished = true
	phraseNum += 1
	return

Any help is much appreciated, thank you!

Assertion failed: Dialog not found ( obviously this means it wasn't successful in parsing my JSON file ) I think it means your path was wrong and it didn't find the json file at all. Since it's exported it means you need to put the path in the variable in the editor before you run the program. There's no other place in the code that there is a path before that. So your path is either wrong, or it wasn't entered at all and it's just an empty string.

8 months later