z4x Posted February 27, 2013 Share Posted February 27, 2013 When I put WAIT in child script many times (because I have to, to slow down loop a bit) will parent script be put on WAIT too or just child? I really want my extending script to not stop parent one. But i need some functions from main one. Anyone? Link to comment Share on other sites More sharing options...
steve40 Posted February 27, 2013 Share Posted February 27, 2013 You need to think about what is going on from a multithreading perspective. If you call a function in script B from script A, script B "captures" the running thread and script A will do nothing until script B has finished doing it's thing (so that the running thread can return to script A).Using Wait calls causes this running thread to pause so that other threads in the queue can have a chance to call events in script B.If you want to prevent script B from capturing the thread in script A, consider calling OnUpdate() in script B. This will start a new thread in your second script without losing the thread that was running in script A: SCRIPT A: .....scriptB.RegisterForSingleUpdate(0) ; calls for a new thread to be run on script B and immediately continues running code in script A....... =========================================== SCRIPT B: Event OnUpdate() ; a new thread will commence here when called by script A myFunction()End Event Link to comment Share on other sites More sharing options...
z4x Posted February 28, 2013 Author Share Posted February 28, 2013 Hmm thats interesting too, but still I have no idea how to make one script decrease and second script increase same value InRealTime. I have used OnUpdate in 1st script and its decreasing global variable from that script. Then I use While Loop for .isEquipped() specific item + Utility Wait to delay it a bit in second script. But i really hate that solution. Link to comment Share on other sites More sharing options...
z4x Posted March 4, 2013 Author Share Posted March 4, 2013 SCRIPT A: ..... scriptB.RegisterForSingleUpdate(0) ; calls for a new thread to be run on script B and immediately continues running code in script A ....... Btw finally I found use for it, and it doesnt work. Can RegisterForSingleUpdate() really be called from one script to another? I do ScriptB.RegisterForSingleUpdate(0) and i get compilator error: Cannot call the member function RegisterForSingleUpdate alone or on a type, must call it on variable I'm not extending these scripts with each other tho. What Im doing wrong? Link to comment Share on other sites More sharing options...
z4x Posted March 5, 2013 Author Share Posted March 5, 2013 (edited) Edit: nvm fixed that sorry for double post, was suppoed to be edit -.- Edited March 5, 2013 by z4xx Link to comment Share on other sites More sharing options...
Recommended Posts