Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Could not find script for class "Dialogic"" when trying to start timeline #2145

Open
zxcdevlop opened this issue Mar 19, 2024 · 30 comments
Open
Labels
Bug 🐞 Something isn't working Needs testing We don't understand this problem fully yet

Comments

@zxcdevlop
Copy link

zxcdevlop commented Mar 19, 2024

this happens when I try to start my dialogic timeline through a button, and I don't know how to fix this

I'm copy-pasting all my code in the script here in case there's something else causing this problem because I don't know how to fix it

how do I start a dialogic timeline here? is there anything else i need?

extends Control

func _ready() -> void:
	print("[Dialogic] Testing scene was started.")
	if !ProjectSettings.get_setting('internationalization/locale/test', "").is_empty():
		print("Testing locale is: ", ProjectSettings.get_setting('internationalization/locale/test'))
	$PauseIndictator.hide()

	var scene: Node = DialogicUtil.autoload().Styles.load_style(DialogicUtil.get_editor_setting('current_test_style', ''))
	if not scene is CanvasLayer:
		if scene is Control:
			scene.position = get_viewport_rect().size/2.0
		if scene is Node2D:
			scene.position = get_viewport_rect().size/2.0

	randomize()
	var current_timeline: String = DialogicUtil.get_editor_setting('current_timeline_path', null)
	if !current_timeline:
		get_tree().quit()
	DialogicUtil.autoload().start(current_timeline)
	DialogicUtil.autoload().timeline_ended.connect(get_tree().quit)
	DialogicUtil.autoload().signal_event.connect(recieve_event_signal)
	DialogicUtil.autoload().text_signal.connect(recieve_text_signal)

func recieve_event_signal(argument:String) -> void:
	print("[Dialogic] Encountered a signal event: ", argument)

func recieve_text_signal(argument:String) -> void:
	print("[Dialogic] Encountered a signal in text: ", argument)

func _input(event:InputEvent) -> void:
	if event is InputEventKey and event.pressed and event.keycode == KEY_ESCAPE:
		DialogicUtil.autoload().paused = !DialogicUtil.autoload().paused
		$PauseIndictator.visible = DialogicUtil.autoload().paused

	if (event is InputEventMouseButton
	and event.is_pressed()
	and event.button_index == MOUSE_BUTTON_MIDDLE):
		var auto_skip: DialogicAutoSkip = DialogicUtil.autoload().Inputs.auto_skip
		var is_auto_skip_enabled := auto_skip.enabled

		auto_skip.disable_on_unread_text = false
		auto_skip.enabled = !is_auto_skip_enabled

func _on_pressed():
	Dialogic.start('day1')
	
@CakeVR
Copy link
Collaborator

CakeVR commented Mar 19, 2024

Hello, first of all, I fixed your formatting.
It's three backticks followed by gdscript.

Do you have the Dialogic autoload in the Project Settings enabled? Have you tried restarting?

@CakeVR CakeVR added Bug 🐞 Something isn't working Needs testing We don't understand this problem fully yet labels Mar 19, 2024
@zxcdevlop
Copy link
Author

i tried disabling and enabling the plugin, and it said:
Can't add Autoload:
Invalid name.
Must not collide with an existing global script class name.

what does this mean?

@CakeVR
Copy link
Collaborator

CakeVR commented Mar 20, 2024

i tried disabling and enabling the plugin, and it said: Can't add Autoload: Invalid name. Must not collide with an existing global script class name.

what does this mean?

This means you already have an autoload using this name or your cache is invalidated.

I recommend to close Godot, delete global_script_class_cache.cfg in .godot, and start your project again.

If this does not remedy the issue, try restarting one more time.

If that does not help either, delete the .godot folder fully and try starting your project again, potentially restarting another time after this.

@zxcdevlop
Copy link
Author

i use macos, where can i find the .godot folder?

@CakeVR
Copy link
Collaborator

CakeVR commented Mar 20, 2024

i use macos, where can i find the .godot folder?

It's a folder located at the root of every Godot project.

@zxcdevlop
Copy link
Author

i can't seem to find the .godot folder in my project folder

@CakeVR
Copy link
Collaborator

CakeVR commented Mar 20, 2024

Maybe it's a hidden folder on your operating system. I never used macOS.

@metanoder
Copy link
Contributor

To see hidden files on macOS, when in your game's project folder, hit
CMD + Shift + .
(command + shift + period)

@zxcdevlop
Copy link
Author

i tried disabling and enabling the plugin, and it said: Can't add Autoload: Invalid name. Must not collide with an existing global script class name.
what does this mean?

This means you already have an autoload using this name or your cache is invalidated.

I recommend to close Godot, delete global_script_class_cache.cfg in .godot, and start your project again.

If this does not remedy the issue, try restarting one more time.

If that does not help either, delete the .godot folder fully and try starting your project again, potentially restarting another time after this.

so I did this and this popped up int eherrors:

Line 9:Identifier "DialogicUtil" not declared in the current scope.
Line 9:Identifier "DialogicUtil" not declared in the current scope.
Line 17:Identifier "DialogicUtil" not declared in the current scope.
Line 20:Identifier "DialogicUtil" not declared in the current scope.
Line 21:Identifier "DialogicUtil" not declared in the current scope.
Line 22:Identifier "DialogicUtil" not declared in the current scope.
Line 23:Identifier "DialogicUtil" not declared in the current scope.
Line 33:Identifier "DialogicUtil" not declared in the current scope.
Line 33:Identifier "DialogicUtil" not declared in the current scope.
Line 34:Identifier "DialogicUtil" not declared in the current scope.
Line 39:Could not find type "DialogicAutoSkip" in the current scope.
Line 39:Identifier "DialogicUtil" not declared in the current scope.
Line 40:Cannot infer the type of "is_auto_skip_enabled" variable because the value doesn't have a set type.
Line 46:Identifier "Dialogic" not declared in the current scope.

it seems that there is a lot of "not declared in the current scope", do I need to add anything to my code to fix this?

@CakeVR
Copy link
Collaborator

CakeVR commented Mar 21, 2024

What version of Godot are you using?

Try removing Dialogic and installing it again.

This article mentions how you can verify if your installation succeeded: https://docs.dialogic.pro/getting-started.html#1-installation--activation

@zxcdevlop
Copy link
Author

i'm using v4.2.1.stable.official [b09f793f5]

@zxcdevlop
Copy link
Author

i reinstalled dialogic 2 and i think there are even more problems now:

Line 27:Could not find type "DialogicTimeline" in the current scope.
Line 69:Could not find type "DialogicEvent" in the current scope.
Line 80:Could not resolve script "res://addons/dialogic/Modules/Audio/subsystem_audio.gd".
Line 80:Cannot infer the type of "Audio" variable because the value doesn't have a set type.
Line 83:Could not resolve script "res://addons/dialogic/Modules/Background/subsystem_backgrounds.gd".
Line 83:Cannot infer the type of "Backgrounds" variable because the value doesn't have a set type.
Line 86:Could not resolve script "res://addons/dialogic/Modules/Character/subsystem_portraits.gd".
Line 86:Cannot infer the type of "Portraits" variable because the value doesn't have a set type.
Line 89:Could not resolve script "res://addons/dialogic/Modules/Choice/subsystem_choices.gd".
Line 89:Cannot infer the type of "Choices" variable because the value doesn't have a set type.
Line 92:Could not resolve script "res://addons/dialogic/Modules/Core/subsystem_expression.gd".
Line 92:Cannot infer the type of "Expressions" variable because the value doesn't have a set type.
Line 95:Could not resolve script "res://addons/dialogic/Modules/Core/subsystem_animation.gd".
Line 95:Cannot infer the type of "Animations" variable because the value doesn't have a set type.
Line 98:Could not resolve script "res://addons/dialogic/Modules/Core/subsystem_input.gd".
Line 98:Cannot infer the type of "Inputs" variable because the value doesn't have a set type.
Line 101:Could not resolve script "res://addons/dialogic/Modules/Glossary/subsystem_glossary.gd".
Line 101:Cannot infer the type of "Glossary" variable because the value doesn't have a set type.
Line 104:Could not resolve script "res://addons/dialogic/Modules/History/subsystem_history.gd".
Line 104:Cannot infer the type of "History" variable because the value doesn't have a set type.
Line 107:Could not resolve script "res://addons/dialogic/Modules/Jump/subsystem_jump.gd".
Line 107:Cannot infer the type of "Jump" variable because the value doesn't have a set type.
Line 110:Could not resolve script "res://addons/dialogic/Modules/Save/subsystem_save.gd".
Line 110:Cannot infer the type of "Save" variable because the value doesn't have a set type.
Line 113:Could not resolve script "res://addons/dialogic/Modules/Settings/subsystem_settings.gd".
Line 113:Cannot infer the type of "Settings" variable because the value doesn't have a set type.
Line 116:Could not resolve script "res://addons/dialogic/Modules/Style/subsystem_styles.gd".
Line 116:Cannot infer the type of "Styles" variable because the value doesn't have a set type.
Line 119:Could not resolve script "res://addons/dialogic/Modules/Text/subsystem_text.gd".
Line 119:Cannot infer the type of "Text" variable because the value doesn't have a set type.
Line 122:Could not resolve script "res://addons/dialogic/Modules/TextInput/subsystem_text_input.gd".
Line 122:Cannot infer the type of "TextInput" variable because the value doesn't have a set type.
Line 125:Could not resolve script "res://addons/dialogic/Modules/Variable/subsystem_variables.gd".
Line 125:Cannot infer the type of "VAR" variable because the value doesn't have a set type.
Line 128:Could not resolve script "res://addons/dialogic/Modules/Voice/subsystem_voice.gd".
Line 128:Cannot infer the type of "Voice" variable because the value doesn't have a set type.
Line 345:Could not find type "DialogicSubsystem" in the current scope.
Line 349:Could not find type "DialogicSubsystem" in the current scope.
Line 52:Could not find type "DialogicSubsystem" in the current scope.
Line 53:Could not find type "DialogicSubsystem" in the current scope.
Line 57:Could not find type "DialogicSubsystem" in the current scope.
Line 58:Could not find type "DialogicSubsystem" in the current scope.
Line 135:Identifier "DialogicResourceUtil" not declared in the current scope.
Line 185:Identifier "DialogicResourceUtil" not declared in the current scope.
Line 191:Could not find type "DialogicTimeline" in the current scope.
Line 219:Could not find type "DialogicTimeline" in the current scope.
Line 237:Could not find type "DialogicEvent" in the current scope.
Line 237:Could not find type "DialogicEvent" in the current scope.
Line 238:Could not find type "DialogicEvent" in the current scope.
Line 270:Could not find type "DialogicSubsystem" in the current scope.
Line 271:Could not find type "DialogicSubsystem" in the current scope.
Line 313:Could not find type "DialogicSubsystem" in the current scope.
Line 331:Could not find type "DialogicSubsystem" in the current scope.
Line 332:Identifier "DialogicUtil" not declared in the current scope.
Line 334:Cannot infer the type of "subsystem_node" variable because the value doesn't have a set type.
Line 353:Could not find type "DialogicSubsystem" in the current scope.
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".
Line 1:Could not find base class "DialogicSubsystem".

res://addons/dialogic/Modules/Audio/subsystem_audio.gd:
Line 1:Could not find base class "DialogicSubsystem".

it says there's 72 errors right now, and I'm pretty sure I installed dialogic correctly, what do I do now?

@CakeVR
Copy link
Collaborator

CakeVR commented Mar 21, 2024

Try restarting Godot again or reload the project.

@zxcdevlop
Copy link
Author

wait those errors were from the DialogicGameHandler thing, the script that contains my problem now has 13 errors:

Line 9:Identifier "DialogicUtil" not declared in the current scope.
Line 9:Identifier "DialogicUtil" not declared in the current scope.
Line 17:Identifier "DialogicUtil" not declared in the current scope.
Line 20:Identifier "DialogicUtil" not declared in the current scope.
Line 21:Identifier "DialogicUtil" not declared in the current scope.
Line 22:Identifier "DialogicUtil" not declared in the current scope.
Line 23:Identifier "DialogicUtil" not declared in the current scope.
Line 33:Identifier "DialogicUtil" not declared in the current scope.
Line 33:Identifier "DialogicUtil" not declared in the current scope.
Line 34:Identifier "DialogicUtil" not declared in the current scope.
Line 39:Could not find type "DialogicAutoSkip" in the current scope.
Line 39:Identifier "DialogicUtil" not declared in the current scope.
Line 40:Cannot infer the type of "is_auto_skip_enabled" variable because the value doesn't have a set type.

this was after I reloaded the project, restarting godot is just closing and reopening it right?

@CakeVR
Copy link
Collaborator

CakeVR commented Mar 21, 2024

Can you verify the Dialogic autoload is enabled in your project and Dialogic as a plugin is enabled? Both can be found in your project settings.

Restarting Godot (your project) is closing and opening the project, yes.

@zxcdevlop
Copy link
Author

yes, the dialogic autoload and plugin are both enabled

@CakeVR
Copy link
Collaborator

CakeVR commented Mar 21, 2024

If you clear all errors and try to start your timeline, do you encounter any errors? If so, what errors and what script has them?

@zxcdevlop
Copy link
Author

its from the DialogicGameHandler and it says "Parser Error: Could not find type "DialogicTimeline" in the current scope."

@Jowan-Spooner
Copy link
Collaborator

@zxcdevlop Somehow some script must result in an error. Because there are a lot of references inside of dialogic, usually a single error already results in many many error messages and other files failing to load.

It would be very useful to know which error is at the very beginning of your list of errors in your output, when opening the project, maybe you can share a screenshot of the output?

Also can you specify which version of dialogic you are using, precisely which Dialogic 2 alpha version?

I'm also confused as the code snippet in the OP contains the code of the TestTimelineScene. You do NOT need all that in your scenes script, not sure why you have that there.

@zxcdevlop
Copy link
Author

i'm using [2.0-alpha-13]
Screenshot 2024-03-21 at 21 03 43

@CakeVR
Copy link
Collaborator

CakeVR commented Mar 21, 2024

Have you added the DialogicGameHandler to your scene? If so, that's not the correct way of using Dialogic.

Dialogic gets used via its autoload. If you added this yourself, you must remove it or it won't work.

Here is a guide you can follow to get started: https://docs.dialogic.pro/getting-started.html

@CakeVR
Copy link
Collaborator

CakeVR commented Apr 8, 2024

Hello, as there was no further reply, I will close this issue.

If you still have this problem, let us know!

@CakeVR CakeVR closed this as completed Apr 8, 2024
@Galaxy1879
Copy link

Galaxy1879 commented Apr 12, 2024

image

sadly i got the same error, I downgraded the dialogue version since the newer had way to many errors.
alpha-12

@AutumnRivers
Copy link

I receive this same error on alpha-13. I'm using Dialogic via Autoload. Unfortunately, it doesn't seem very consistent; sometimes it'll happen when playing the project, and sometimes it won't.

@CakeVR
Copy link
Collaborator

CakeVR commented Apr 14, 2024

Hello, please confirm if any of you are using C# in your projects.

@CakeVR CakeVR reopened this Apr 14, 2024
@AutumnRivers
Copy link

Hello, please confirm if any of you are using C# in your projects.

Hi there! Yes, I'm using C# in my project. It seems to go away for the most part when I build the .NET project before launching (it still builds when you launch, but you can choose to build before)

(I said this in the server, but I'm putting it here too for non-server-members)

@luiscesjr
Copy link

Hello, please confirm if any of you are using C# in your projects.

I came here to looking for this issue, I also have the "Could not find Type DialogicTimeLine in the current scope" issue, and also I am using the mono version of Godot. recently updated to 4.3 Dev 5 because of a much needed feature they added.

It seems random, sometimes it pops up, sometimes it doesn't, haven't tried building first and then playtesting tough.

@Galaxy1879
Copy link

Okey, I found a solution. You can download a pre-made project that weirdly enough has working dialogue installed.
Here is the itchio link.
https://devworm.itch.io/completedialogue-tutorial-projects-4102024

That will not fix the issue why it wasnt working in the first place but it will atleast work now.

@aldocd4
Copy link

aldocd4 commented May 11, 2024

Hello, someone have an idea about this bug? This literally make the addon unusable in any C# project :(

image

It appears each time you edit a C# file and re-build the game to test changes.
I will try to dig into addon source code to understand what's causing it.

@luiscesjr
Copy link

Hello, someone have an idea about this bug? This literally make the addon unusable in any C# project :(
It appears each time you edit a C# file and re-build the game to test changes. I will try to dig into addon source code to understand what's causing it.

So far what @AutumnRivers said is what I do, always build it before hitting play and it works. But sometimes I forget lol.

Other than that, I have no idea as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 Something isn't working Needs testing We don't understand this problem fully yet
Projects
None yet
Development

No branches or pull requests

8 participants