create_timer as void function?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gruen

well I am creating timer in my code and everytime i get following message:

The function ‘connect()’ returns a value, but this value is never used

so now i have 7 timers and i get this message 7 times already.

i know in a function i need to set a low line “_” to avoid that message, if i know i dont need the argument.

is there a way to do so in the create_timer function also?

Are you worried about the warnings that the editor prints out? If so, you can safely ignore them.

Ertain | 2019-08-21 11:03

:bust_in_silhouette: Reply From: Holm

you can use following

# warning-ignore:unused_argument

at top of a function and you get no warnings from this.
Example:

# warning-ignore:unused_argument
func _physics_process(delta):
...

thank you, i dont know why but that didnt worked for me. maybe i didnt use it in the right way. annyway i could get off that warnings bei creating an function to shorten the timer creating:

for

get_tree().create_timer( seconds ).connect( "timeout", self, "anyFunction")

i did that:

func alarm (seconds, where, funktion):
return (get_tree().create_timer(seconds).connect("timeout",where,funktion))		

I dont know why, but in this case there aren’t warnings spawning annywere

bad english for my sorry

gruen | 2019-08-23 07:11