Quick Array Object question - Current Position/FastLoops

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hey!

    I have two separate behaviors using fastloops to work with an array object and they both alter the Current Position and read from it.
    My worry is that if the fastloop from each behavior are running simultaneously, they may conflict with each other by altering the Current Position at the same time in the Array Object producing inaccurate results for either or both processes.
    Is this a reasonable concern? Will I have to make sure that processes making use of the "Current Position" function are never running at the same time?
    Or is the array object able to create multiple "instances" of the current position? (I dont think that's the case.. just asking)

    Also, does the Current Position carry over to other frames if the array is global? Might I run into the same potential conflict issue there if using a sub-frame?

    Thanks in advance!

    Edited 3 times, last by uncleswell (August 9, 2012 at 12:35 AM).

  • Changing the current position obviously changes the current position so every time you change it, it changes. That said, only one particular fast loop ever runs at once. You can however run one fast loop inside another, and another inside of that, but the parent loop is always paused until the child loop has completed the final iteration.

    Personally, I never use or refer to the current position, but instead loop through and compare to the loop index. What exactly are you trying to do?

  • Changing the current position obviously changes the current position so every time you change it, it changes. That said, only one particular fast loop ever runs at once. You can however run one fast loop inside another, and another inside of that, but the parent loop is always paused until the child loop has completed the final iteration.

    Personally, I never use or refer to the current position, but instead loop through and compare to the loop index. What exactly are you trying to do?

    Chris, thanks for the reply. That's what I thought..

    However, I was under the impression that separate behaviors were 'processed' by MMF's event-reader independently and not in a particular order. So the Main events in the frame, Object 1's behavior, and Object 2's behavior are all run at once instead of checking the main events, THEN object 1's behavior, THEN object 2's behavior, etc... Is this correct? If so, I would imagine that two fast loops COULD in fact occur at the same time (in separate behaviors or in a sub-frame).

    Maybe I still just don't understand all the ins and outs of the runtime engine.

    As for what I am trying to do, I won't go into too much detail.. but Simply, I will have multiple object behaviors that contain events which each pretty much consistently access/alter the same array for different purposes. So obviously, a conflict in which the current position is rapidly changed by 2 separate processes that rely on the current position to access specific data will open up the possibility for error.

    I am currently using the loop index method to avoid that.. but I have found that some of it will be much more efficient if I can use the current position.

    Edited once, last by uncleswell (August 9, 2012 at 1:47 AM).

  • To be honest, you should never use behaviors because they are totally pointless. But from what I remember they are executed before your main code (possibly after...). If you have multiple objects with behaviors then they are executed in their own invisible internal order which is somewhat dependent on the order in which you created the objects but it can change if you have deleted an object at any time during your project.

  • At the end of the frame, store the current position in a global value and then at the start of the next frame, set the current position to that value. Regarding the sub-app, in the properties window, check "Global Values and Strings" then use the global value to save and load the position.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!