Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Two loops in one thread?


Doomed_Space_Marine
 Share

Recommended Posts

Doomed_Space_Marine

Is it possible to make two loops in the same thread work separate at the same time?

Link to comment
Share on other sites

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. mercie_blink.gif

 

What's problem that you are trying to solve?

 

 

 

Link to comment
Share on other sites

Doomed_Space_Marine

Hmm.. No problem anymore. I already found another way to solve the problem smile.gif Yesterday I didn't know how to use timers (@32 and @33).

Link to comment
Share on other sites

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

Doomed_Space_Marine
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

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

tomworld10

 

 

 

Hi,

 

 

No. You'll have to create two different threads.

 

 

Have fun

 

 

Link to comment
Share on other sites

P.I.M.P_PL
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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.