Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Resolving 2+ actions at the same time.


Airaxen

Recommended Posts

Well it didn't take long for me to run into another problem. Once again so people know this is MMF.

In my little program I have some processes running parallel with each other. However there will be times where two processes finish what they're doing and then try to input their values into a 'queue' at the same time.

This queue is simply an alterable value. It works by taking whatever was already present, multiplies it by 10 and adds the newest value. So really it's just a big number.

Now when I have some processes finish at the same time one will get discarded and only one 'wins' out. Ideally I want both to somehow make it as that was the entire point of having a queue system.

I'm not sure if such a problem can be resolved but I'd like to hear thoughts.

Link to comment
Share on other sites

One way of solving this would probably be to use an "infinite" loop.

When a process is active, you can start a loop "query" at -1.

While the loop is active, check to see if a process is not active ( negate the condition ). If so, stop the loop.

Now in another event ( make sure both of these events excluding the one that starts the loop have the On Loop "query" condition right at the top ), have the condition that checks if a process is active ( not negated ) but this time around add a pick one condition. I'm of course guessing that your processes are related to active objects though.

Anyhow, that event will pick one of the active processes ( or an active object to be more direct ) so you can store only a single process, and if there's another active process, then the loop will continue and rerun the query for the additional processes. When all processes have been queued, the loop will stop and everything else will continue merrily.

I call this the infinite loop as it'll never stop until a condition is satisfied to force it to stop. It's great for your kind of situation as it'll handle all multiple occurrences until all are satisfied.

Since the pick one condition only works with objects however, if your processes are done in some other way you may need to give them all IDs and compare them to the loop index of your loop. If a loop is set to -1, it'll count up from 0, so if you have two processes with the IDs 0 and 1 and compared to the loop index it'll first see process 0 and then process 1.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...