RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Loops and conditional branches

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 85
Okay ... I'm thinking out a common event. The first part would look like this.

Loop
  Timer (x numbers and y seconds)
       conditional branch
          If timer past x miniutes and y seconds then
           stop timer
Break loop

-----------------------------------
I make another loop below it.

loop
  Conditional branch
      If timer less than x
         This thing happens
         else
              conditional branch
                   if timer is less than x
                    This thing happens
                      else
                          conditional branch
                             if timer is less than x
                                 This thing happens.
                               else

Etc etc etc

                                               Conditional branch
                                                 if timer is less than x 
                                                     this thing happens
                                                         else
break loop
---------------------
Now, Eventually, the conditional branch runs out of time from the timer. Obviously. After it does, will it go back to the first conditional branch in the loop?

And will the timer from another loop auctually interact from a timer from another loop? If its in the same common event? And did I even use the timer right?

Thanks alot
- Caesis

***
FURRY 4 LIFE. Here kitty kitty kitty....
Rep:
Level 87
can't say i know. but if the "This thing happens" part is the same for each of them why not just have one that loops itself?
"screaming out the mating call. i've become the lord of love"

caramelldansen forever!

**
Rep:
Level 85
That plan didn't work great ...

Okay, anyone know this now:

Theres a timer in a loop.

Theres another loop or conditional branch.
Can the timer affect the events in the conditional branch and loop?

Thanks
- Caesis

**
Rep:
Level 86
I don't see why it wouldn't.  The timer is a global thing.  It should affect any events that would refer to it, no matter where they are located.

Because we'll say you have loop A and loop B, which is what you're asking about.  Loop A will call the timer, which makes it start, and shows the time on the screen, counting down.  If you're setting it up like you have in that loop down there, however, you may want to do something more like...

Timer (x numbers and y seconds)   
   Loop
       conditional branch
          If timer past x miniutes and y seconds then
           stop timer
   Break loop

Because otherwise each instance of the loop will reset your timer to whatever you placed it at.  Anyway, continuing on. 

...hm.  I think your eventing could be changed a bit, otherwise this is going to be caught in the loop until the end of the timer is reached, and none of your other events will happen.  Something more like this would be more effective, I think...

(Step 1)
Plot event starts the Timer.

(Step 2)
Set a Common Event with a parallel process that has your

       conditional branch
          If timer past x miniutes and y seconds then
           stop timer

Which will do exactly what you wanted up there, only it won't be trapped in limbo forever.  However, if you plan on using more than one timer in your game (as in, another event involving a timer in the future), this will need to be edited slightly, as /all/ timers will stop at that time.

(Step 3)

Setup another Common Event with parallel process.  Again, if you're planning to use multiple timers throughout your game, you're going to want to set up another condition, such as a switch.  Here is where you'll have your conditional branches, just how you had them before.  So something like...

loop
  Conditional branch
      If timer less than 5
         This thing happens
         else
              conditional branch
                   if timer is less than 10
                    This thing happens
                      else
                          conditional branch
                             if timer is less than 20
                                 This thing happens.
                               else

And so on building upwards, otherwise it'll just run the first condition once and that'll be all. 

Whew, that was a little longer than I thought, ^_^;  I hope that's clear, but if not, either reply again, shoot me a PM or hit me up on one of my messengers. 

Kularian