Function doesn't print/ doesn't call another function.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mixtheleaf
func place():
print("place")
$Sprite/AnimationPlayer.current_animation="idle"
placing = false
Level.set_grid_position(("pad" if Pad else "plant"),tile_pos.y,tile_pos.x,ObjectIndex,Plant,null)
GlobalScript.emit_signal("_on_plant_planted",tile_pos.x,tile_pos.y,origin_button)

This i supposed to print place, it is called by

func _input(event: InputEvent) -> void:
if event.is_action_pressed("lmb"):
	if placing:
		if get_tile_access(tile_pos.y,tile_pos.x):
			print("We're calling the function place but yet it's isn't printing 'place'. Why could that be?")
			place()
		else:
			GlobalScript.emit_signal("_failed_plant_placement")
			queue_free()

Since it also should calls this, shouldn’t this print too?

func set_grid_position(type:String,row:int,collumn:int,value:int,id:String,data: Dictionary):
print("aha!",type," ",value," ",id)
if type=="pad":
	spgrid[row][collumn]=value
	padgrid[row][collumn]=id
elif type=="plant":
	objgrid[row][collumn]=value
	plantgrid[row][collumn]=id
	print(objgrid[row][collumn]," ",plantgrid[row][collumn])
elif type=="griditem":
	objgrid[row][collumn]=value
	itemgrid[row][collumn]=id
	itemgriddata[row][collumn]=data

None of these, except the _input(), print anything. However i do know that the place() function is called because the animation does change to idle and the placing does disable. I, however, am unsure whether set_grid_position() is being called.
*Functions have been slightly adjusted but nothing is printed.
fixed don’t answer im extremely dumb

Please prevent others from making the same mistake.
How did you solve your problem?

Wakatta | 2021-03-13 01:52

:bust_in_silhouette: Reply From: mixtheleaf

Problem was my carelessness. Script inherited from this script had a separate place function, which i didn’t change, and thus it didn’t execute set_grid_position. Sorry about that.

Always check inhrited objects if you have “make sub resources unique” enabled :slight_smile:

mixtheleaf | 2021-03-13 16:46