Function(...) process takes about 5 seconds and make actions with one unit from the group.
So it's problem for me run "code after" until Function ends proceed with all unit from the group.
Is there any good decisions to avoid Function(...) expectation?
(i don't want use trigger and global variables instead function)
You want a function which includes a wait to run in its own thread, so when calling this function from another function, it does not wait for the function to finish?
If this is correct, I am sorry, there seems to be no other way than using a trigger and globals.
In Gui there is an option to run an action in its own thread, however in Galaxy this translates into exactly the same thing, a trigger and a bunch of globals.
You want a function which includes a wait to run in its own thread, so when calling this function from another function, it does not wait for the function to finish?
It's possible to create the "run an action in its own thread" in galaxy. But you'll have to pass your parameters to it via globals. (This is how its done with the auto generated trigger script anyway)
intTestGlobal=0;//This function creates the multithreadvoidRun(strings){triggert=TriggerCreate(s);TriggerExecute(t,false,false);TriggerDestroy(t);}//This is the action threadboolActionThread(booltc,boolra){//varsinti=TestGlobal;//actions//Put your Print(IntegerToString(i)) output hereWait(5,c_timeGame);//Simulates the 5 second wait.//Print your action completed debug output here Print(IntegerToString(i)+"ActionComplete")returntrue;}voidInitTest(){inti=0;while(i<9){TestGlobal=i;Run("ActionThread");i+=1;}
Just paste this in your custom script with the initializer InitTest() and it should work. Add a dummy trigger with map initialization event if it can't compile cos libraries are missing. What you should find when you run this is that 0-9 gets printed immediately. After a 5 second wait, it will print action completed once for each integer 0-9.
PS: Might have bug cos i didn't test this out myself. Oh and while is basically the script version of cycle.
Guys, i have script:
Cycle - take group of units:
Run Function (...)
End Cycle
Code after....
Function(...) process takes about 5 seconds and make actions with one unit from the group. So it's problem for me run "code after" until Function ends proceed with all unit from the group.
Is there any good decisions to avoid Function(...) expectation? (i don't want use trigger and global variables instead function)
I am not sure, if i got what you mean.
You want a function which includes a wait to run in its own thread, so when calling this function from another function, it does not wait for the function to finish?
If this is correct, I am sorry, there seems to be no other way than using a trigger and globals.
In Gui there is an option to run an action in its own thread, however in Galaxy this translates into exactly the same thing, a trigger and a bunch of globals.
I'm taking the same assumption as Kueken531 here.
It's possible to create the "run an action in its own thread" in galaxy. But you'll have to pass your parameters to it via globals. (This is how its done with the auto generated trigger script anyway)
Just paste this in your custom script with the initializer InitTest() and it should work. Add a dummy trigger with map initialization event if it can't compile cos libraries are missing. What you should find when you run this is that 0-9 gets printed immediately. After a 5 second wait, it will print action completed once for each integer 0-9.
PS: Might have bug cos i didn't test this out myself. Oh and while is basically the script version of cycle.
Thanks! But i wanted use Function to avoid globals. Now I don't see any reason to not run external triggers (with globals).
@fenfires: Go
If you want the function to not block then you have to use a new trigger (with globals to pass parameters).