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

Opcode 88 when making a Dictionary with Callable values in GDScript #83468

Closed
MichaelMacha opened this issue Oct 17, 2023 · 1 comment · Fixed by #83486
Closed

Opcode 88 when making a Dictionary with Callable values in GDScript #83468

MichaelMacha opened this issue Oct 17, 2023 · 1 comment · Fixed by #83486

Comments

@MichaelMacha
Copy link
Contributor

Godot version

4.1.2

System information

Linux Mint 21.3

Issue description

I have a Dictionary of ints to Callables. When this dictionary has more than one entry, I consistently get the error "Internal Script Error! Opcode: 88 (please report)".

The associated error message is this:

E 0:00:01:0088   player.gd:9 @ @static_initializer(): Condition ' p_instance == nullptr ' is true. Breaking..:
  <C++ Source>   modules/gdscript/gdscript_vm.cpp:2452 @ call()
  <Stack Trace>  player.gd:9 @ @static_initializer()

The exact GDScript that seems to be causing the issue is this:

static var flavor_fire_def : Dictionary = {
	Gummy.Flavor.UNFLAVORED : (func():
		pass),
	Gummy.Flavor.ORANGE : func():
		var bullet = preload("res://bullet.tscn").instantiate()
		get_parent().add_child(bullet)
		bullet.linear_velocity = -$Mesh/BulletSource.global_transform.basis.z * 3.0
		bullet.global_position = $Mesh/BulletSource.global_position
}

Unless I'm making a syntactical error somewhere, my only workaround is going to be assigning functions directly.

Steps to reproduce

The above code should theoretically be enough on my version, and perhaps OS.

Minimal reproduction project

The above data should cover it, I've seen no evidence that another part of my project is involved.

@dalexeev
Copy link
Member

dalexeev commented Oct 17, 2023

get_parent().add_child(bullet)
bullet.linear_velocity = -$Mesh/BulletSource.global_transform.basis.z * 3.0
bullet.global_position = $Mesh/BulletSource.global_position

Non-static functions and get_node() shorthands cannot be called in a static context. The bug is that the static analyzer did not report these errors in the lambda bodies.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants