Using a Timer Timout to run a function that is passed variables

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Robster
:warning: Old Version Published before Godot 3 was released.

Hi all,

I have a function called woodenBoardPlay that accepts two inputs.

so the function looks a bit like:

func woodenBoardPlay(direction, message):

In my timer’s timeout, I want to call that function like so:

sunkTimer.connect("timeout",self,woodenBoardPlay("down", "youLost"))

It gives this error though:
Invalid type in function 'connect' in base 'Timer'. Cannot convert argument 3 from Nil to String.

How can I pass variables to a function like I’m trying to? I am officially stumped! :slight_smile:

:bust_in_silhouette: Reply From: aozasori

Like this:

sunkTimer.connect("timeout",self,"woodenBoardPlay",["down", "youLost"])

Thank you. That’s appreciated. This is where these QA forums will help in the future. There are so many little things like this to learn and I just can’t find anywhere else to get that kind of info. It’s very helpful. Thanks again.

Robster | 2016-12-22 05:26

Thanks aozasori ! I was trying to understand the argument into the connect function.

 Array binds=Array(),

DriNeo | 2016-12-22 20:42