Doomed_Space_Marine Posted May 4, 2008 Share Posted May 4, 2008 Is it possible to make two loops in the same thread work separate at the same time? Link to comment Share on other sites More sharing options...
GoofyHTS Posted May 4, 2008 Share Posted May 4, 2008 If I understand you correctly,you need two loops (for/while) (Not Nested) running at the same time in the same thread? No. I don't know why you want to do that anyways. What's problem that you are trying to solve? Link to comment Share on other sites More sharing options...
Doomed_Space_Marine Posted May 5, 2008 Author Share Posted May 5, 2008 Hmm.. No problem anymore. I already found another way to solve the problem Yesterday I didn't know how to use timers (@32 and @33). Link to comment Share on other sites More sharing options...
X_ATP_X Posted May 5, 2008 Share Posted May 5, 2008 Is it possible to make two loops in the same thread work separate at the same time? :Loopswait 0if 8118: not actor $stew dead 004D: jump_if_false @Stew_deadif 80FE: not actor $PLAYER_ACTOR sphere 1 in_sphere -2243.176 -2562.0867 31.9219 radius 2.0 2.0 2.0 004D: jump_if_false @in_sphereif 8119: not car $stewbike wrecked004D: jump_if_false @Bike_wreckedwait 50jump @Loops In This Loop 3 Things will checked at the same time. Of course you can use other opcodes for example "801A: not 1 > $TIMER" to check a Timer or so. Link to comment Share on other sites More sharing options...
Doomed_Space_Marine Posted May 5, 2008 Author Share Posted May 5, 2008 Is it possible to make two loops in the same thread work separate at the same time? :Loopswait 0if 8118: not actor $stew dead 004D: jump_if_false @Stew_deadif 80FE: not actor $PLAYER_ACTOR sphere 1 in_sphere -2243.176 -2562.0867 31.9219 radius 2.0 2.0 2.0 004D: jump_if_false @in_sphereif 8119: not car $stewbike wrecked004D: jump_if_false @Bike_wreckedwait 50jump @Loops In This Loop 3 Things will checked at the same time. Of course you can use other opcodes for example "801A: not 1 > $TIMER" to check a Timer or so. I mean I want to do something like this: :Thread<some kind of jump> @Loop1<some kind of jump> @Loop2end_thread:Loop1wait <amount of time><code>jump @Loop1:Loop2wait <amount of time different than in the first loop><code>jump @Loop2 Would it be possible to make @Loop1 and @Loop2 run at the same time? Link to comment Share on other sites More sharing options...
X_ATP_X Posted May 5, 2008 Share Posted May 5, 2008 Is it possible to make two loops in the same thread work separate at the same time? :Loopswait 0if 8118: not actor $stew dead 004D: jump_if_false @Stew_deadif 80FE: not actor $PLAYER_ACTOR sphere 1 in_sphere -2243.176 -2562.0867 31.9219 radius 2.0 2.0 2.0 004D: jump_if_false @in_sphereif 8119: not car $stewbike wrecked004D: jump_if_false @Bike_wreckedwait 50jump @Loops In This Loop 3 Things will checked at the same time. Of course you can use other opcodes for example "801A: not 1 > $TIMER" to check a Timer or so. I mean I want to do something like this: :Thread<some kind of jump> @Loop1<some kind of jump> @Loop2end_thread:Loop1wait <amount of time><code>jump @Loop1:Loop2wait <amount of time different than in the first loop><code>jump @Loop2 Would it be possible to make @Loop1 and @Loop2 run at the same time? i think that is not Possible. but with my script you can check some different thinks too! Link to comment Share on other sites More sharing options...
tomworld10 Posted May 5, 2008 Share Posted May 5, 2008 Hi, No. You'll have to create two different threads. Have fun Link to comment Share on other sites More sharing options...
P.I.M.P_PL Posted May 6, 2008 Share Posted May 6, 2008 Is it possible to make two loops in the same thread work separate at the same time? In This Loop 3 Things will checked at the same time. Of course you can use other opcodes for example "801A: not 1 > $TIMER" to check a Timer or so. I mean I want to do something like this: :Thread<some kind of jump> @Loop1<some kind of jump> @Loop2end_thread:Loop1wait <amount of time><code>jump @Loop1:Loop2wait <amount of time different than in the first loop><code>jump @Loop2 Would it be possible to make @Loop1 and @Loop2 run at the same time? try this (i using gosubs to go to two labels in the same time but in the end of this labels to who you go with gosubs its be in end od the label this opcode: return but you can try with jump to second label without returning or use next gosub;) warning!! its be limit in sa of gosubs in one thread(see in the sanny builder help) :Threadthread 'write_some_name'wait 0gosub @Loop1gosub @Loop2end_thread:Loop1wait 1000<code>jump @Loop1:Loop2wait 1000<code>jump @Loop2 or you can try this thread: :Threadthread 'write_some_name'wait 0gosub @Loop2jump @Loop1:Loop1wait 1000<code>jump @Loop1:Loop2wait 1000<code>jump @Loop2 Link to comment Share on other sites More sharing options...
Y_Less Posted May 6, 2008 Share Posted May 6, 2008 This is exactly what threads are for, you can't do it without threads as that's how it's done. And gosubs don't run at the same time, those will run one after the other. Link to comment Share on other sites More sharing options...
GoofyHTS Posted May 6, 2008 Share Posted May 6, 2008 This is exactly what threads are for, you can't do it without threads as that's how it's done. And gosubs don't run at the same time, those will run one after the other. That is 100% correct. As I said from the beginning it's not possible running two loops simultaneously in one thread. Use two threads, it's the only correct way. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now