playMaker

Author Topic: Strange Array Error  (Read 3695 times)

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Strange Array Error
« on: August 04, 2012, 02:48:39 AM »
I have this odd error where the value of an Int variable on my FSM will cause a completely unrelated state to throw an Infinite Loop warning that doesn't make any sense.

I can provide more information later, but for now I wanted to ask:
Is there a known error involved in having an Int variable define the index of an array in an ArrayListGet action?


artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Strange Array Error
« Reply #1 on: August 05, 2012, 02:20:10 AM »
bump

I really need help on this.  I occasionally get extremely bizarre bugs with PlayMaker that just "go away" when I change something.  I think issues like that can outright cripple a project, so this time I'm loathe to move forward until I get someone's opinion on this issue.  It could help one of you guys out with some serious problem, or just fix another bug. 

Either way, I don't know how to convey the problem without sharing my scripts themselves.  I'm willing to send these to Jean or Alex, but I need someone to reply first.  ;)


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Strange Array Error
« Reply #2 on: August 07, 2012, 06:00:54 AM »
Hi,

 if you have a repro project, you can pm me, no problem

bye,

 Jean

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Strange Array Error
« Reply #3 on: August 10, 2012, 01:09:17 AM »
So as it turned out, ArrayMaker does not obey PlayMakers Infinite Loop Threshold preference, it has it's own, so I was confused by it throwing infinite loop warnings well before my threshold setting.

Now that that's cleared up: Can someone help me understand how to use ArrayList Get Next?

Currently I have two ArrayLists, "A" and "B". 

I check a series of bool values in A, one at a time.  After each one I exit the state, increment a couple Int variables to keep track of where I am, and then return to it for the next value.

However it seems the GetNext action goes through each index sequentially, and I can't figure out how to exit after each index to set my counter Ints and, nor does it seem possible to return to a specified index value when I return to the state to pick up where I left off.

My script is working perfectly at the moment, it just gets interrupted by the Infinite Loop warning.  Can someone propose an alternative approach?  Can I disable the Infinite Loop checker?  Am I using the state incorrectly? (I am still learning how to use Array's, and they confuse me a little). 

Thank you in advance.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Strange Array Error
« Reply #4 on: August 10, 2012, 02:26:35 AM »
Hi,

 I don't think any action can overcome the inifinite loop warning, unless you introduce a next frame or time delay. The solution I am using is to increase the "Infinite Loop Threshold" in the preferences/Debugging section.

as for exiting loops, you simply need to introduce a check of some sort and have a transition event moving away from the state responsible for the "next". Keeping indexes is something that you can do by maintaining an FsmInt that you set to 0 before entering the loop procedure, and increase in the looping state.

Have you checked the generic iteration action I just did few days ago?
http://hutonggames.com/playmakerforum/index.php?topic=2081.0

it maintains that index, and you can do whatever you want with this then.


Bye,

 Jean

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Strange Array Error
« Reply #5 on: August 10, 2012, 03:09:32 AM »
I have my Infinite Loop Threshold at the default of 100, but my FSM freezes after looping through the Array List Get state 25 times.  What could cause that?

Thank you for the other info! 

amaranth

  • Full Member
  • ***
  • Posts: 172
Re: Strange Array Error
« Reply #6 on: August 10, 2012, 02:29:27 PM »
Hi artician, I just found this thread. I don't think this has anything to do with ArrayMaker. I'm having the same problem with my loops that don't have any ArrayMaker calls in them. I'm not sure if this is a bug. I don't remember having this problem in previous verisons of PlayMaker. Are you on 1.4.3?

For me, the freeze hits when I have 22 loops with a threshold of 300.

(note to jean: I do have arrays attached to the game object, but this fsm doesn't call them)

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Strange Array Error
« Reply #7 on: August 10, 2012, 02:49:18 PM »
I seem to be running 1.4.0, so I'll update, but I don't expect a change on this issue.

I think the main problem here is that ArrayMaker has a different loop threshold than PlayMaker, -or- somehow we're sending more Get functions to the Array Lists than we think we are...  Poop!

Thanks for the reply.  Glad to know I'm not the only one.