Hyunsu Posted February 15, 2011 Posted February 15, 2011 (edited) "A" is big resource. "B" is 1kb resource. i want to start "B" after starting "A". but i can't. -- script in "A" resource. function startingB() startResource(getResourceFromName("B")); end addEventHandler("onResourceStart", getResourceRootElement(), startingB); -- at Console , (i typed "start A") starting "A" starting "B" start: Resource "B" stated start: Resource "A" stated i want to add "FinishedStarting". Edited February 15, 2011 by Guest
Castillo Posted February 15, 2011 Posted February 15, 2011 I'm not sure of what are you trying to say, but getResourceState includes many states, such as: loaded, starting. So i don't really get what do you mean.
diegofkda Posted February 15, 2011 Posted February 15, 2011 "A" is big resource."B" is 1kb resource. i want to start "B" after starting "A". but i can't. -- script in "A" resource. function startingB() startResource(getResourceFromName("B")); end addEventHandler("onResourceStart", getResourceRootElement(), startingB); -- at Console , (i typed "start A") starting "A" starting "B" start: Resource "B" stated start: Resource "A" stated i want to add "onResourceStarted". or add return of getResourceState a "started". onResourceStart and onResourceStarted... IS NOT THAT THE SAME THING!?!??
Lex128 Posted February 15, 2011 Posted February 15, 2011 You want to run B after start up the server? If so, try using a timer. I have the same problem and I solved it using a timer 50ms
Hyunsu Posted February 15, 2011 Author Posted February 15, 2011 (edited) You want to run B after start up the server?If so, try using a timer. I have the same problem and I solved it using a timer 50ms yes, it's my wanting. but, that's not safe. we don't know when resource finished starting. Edited February 15, 2011 by Guest
Hyunsu Posted February 15, 2011 Author Posted February 15, 2011 (edited) I'm not sure of what are you trying to say, but getResourceState includes many states, such as: loaded, starting.So i don't really get what do you mean. sorry, my bad english. i already did getResourceState. "when resource start" and "when resource finished starting" were always "running". not changed. Edited February 15, 2011 by Guest
Hyunsu Posted February 15, 2011 Author Posted February 15, 2011 onResourceStart and onResourceStarted... IS NOT THAT THE SAME THING!?!?? maybe i think that .. when start resource("onResourceStart" ) -> starting.. - > starting.. -> when finished starting resource("onResourceStarted")
12p Posted February 15, 2011 Posted February 15, 2011 What do you exactly want to do, with that event? Maybe you could do a script for that, instead of using that event: addEventHandler ( "onResourceStart", getRootElement ( ), function ( ) setTimer ( triggerEvent, 500, 1, "onResourceStarted", getResourceRootElement ( ) ) end ) Or something like that, I don't know hehe
diegofkda Posted February 15, 2011 Posted February 15, 2011 You want to run B after start up the server?If so, try using a timer. I have the same problem and I solved it using a timer 50ms yes, it's my wanting. but, that's not safe. we don't know when resource finished starting. Try to scale the file-size with timers. If file-size is 10 kb, use setTimer 500, if its 1 mb, try to use 1000. If the resource is 1 kb, use just 50.
12p Posted February 15, 2011 Posted February 15, 2011 Yep. The code I gave was an idea about how to do it
lil Toady Posted February 16, 2011 Posted February 16, 2011 That's not how it works, resource A should be a dependency of resource B specified in the meta.xml
eAi Posted February 16, 2011 Posted February 16, 2011 If A is a dependency of B in meta.xml, it won't start until A has started.
Recommended Posts