playMaker

Author Topic: Array Maker - Index is less than 0  (Read 1992 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Array Maker - Index is less than 0
« on: September 22, 2017, 02:56:51 PM »
Hi!
I use down arrow to navigate down in the menu, and up arrow to navigate up in the menu. I also use a menu index variable I use with Array Get. When the array index reach to the last or first index, I use an Int Clamp, so it doesn't count less or more. The problem is when the menu reach the last or first index. (First = 0 and last = 4), I get this msg:

Index is less than 0 or more than or equal to the list count.
Parameter name: index


My question is: Is it an Array Maker Action I can use to check when it reach the first or last index, so I don't get this msg anymore?
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Array Maker - Index is less than 0
« Reply #1 on: September 22, 2017, 09:20:49 PM »
Hi,
i can't test right now.

Can you try to set a next frame in between maybe the issue is the clamp.

if so maybe use 2 int compare's and if less that 0 set to 0 and greater than 4 set to 4.

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Array Maker - Index is less than 0
« Reply #2 on: September 22, 2017, 10:34:23 PM »
Hi, djaydino!

I tried with Int Compare, but the problem was that I got this loop problem, because it goes back to the state where I use Int Compare, but what I did to solve this, is to add two extra states where it checks for the first index and last index. Here I use Int Compare. If it's greater than 0, it goes to the next state where I use Array List Get or else it goes back to the previous state. The same for the last index. It worked. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Array Maker - Index is less than 0
« Reply #3 on: September 22, 2017, 10:48:29 PM »
Hi,
So the issue was indeed the clamp?

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Array Maker - Index is less than 0
« Reply #4 on: September 22, 2017, 11:01:54 PM »
No. The first state, I use get key down - Up Arrow and Down Arrow. There I also have Int Clamp. If I have an Int Compare in this state and it goes to another state when the index is 0, I can't return back to the same state, because the index will still be 0 and the Int Compare will check the index and go to the the same state again and again and again. If you know what I mean. Or else I can show a screenshot. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Array Maker - Index is less than 0
« Reply #5 on: September 23, 2017, 10:10:29 AM »
Hi,
It's fine, i get it  ;D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Array Maker - Index is less than 0
« Reply #6 on: September 26, 2017, 04:25:06 AM »
Hi,

 maybe you should use some pre made acitons for this to iterate properly, why doing this manually? you could use the action Iterate from the ecosystem or the getnextxxx actions.

 Bye,

 Jean