Hi,
I want to use a loop to run over methods that are defined in a separate text file.
In order to do this, I am using:
for instruction in _instructions:
callv(instruction["funcion_name"], instruction["arguments"])
This in a loop executes correctly and executes all defined methods, however, they are executed all at the same time.
So I was thinking of using yield to wait for one method to finish before starting the next method in the loop.
However, when I try to use:
yield(callv(instruction["func"], instruction["args"]), "completed")
It says:
First argument of yield() not of type object
I read that I need to return an object from the called function or call resume() to allow for it to work,
however, I have no idea how I do this, I tried several methods but nothing worked.
For example, I am calling this function here:
func walk_to_position(target_position_x, target_position_y):
var target_position = Vector2(int(target_position_x), int(target_position_y))
entity.current_mouse_position = target_position
>>>> what to put here to return? I tried return, I tried yield(), nothing worked..... <<<<<<
How do I return from here so that yield accepts the function and continues execution to the next?