playMaker

Author Topic: Array Get Next not working?  (Read 5537 times)

SlashHabit

  • Playmaker Newbie
  • *
  • Posts: 16
Array Get Next not working?
« on: June 27, 2017, 11:19:02 AM »
Hi, I currently have an array with a big list of different words, over a 1000 which is being created from the split to text array action which works perfectly.

Now the player types in words and stores it in a string variable, after this action I'm trying to find the correct word in the array, I tried using array get next but that action only wants to look for an array variable and not a gameobject.

I then downloaded array get next2 which is exactly like the first action but with a flag marker.

Thanks in advance!

Also attached a picture which might help illustrate my problem.

SlashHabit

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Array Get Next not working?
« Reply #1 on: June 27, 2017, 02:11:26 PM »
Just to clarify, how the hell do I cycle through the array until it finds the word I typed? I saw now that I have 'array list get', but It doesn't work either. It's stuck at Index 0 and doesn't cycle through all indexes.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Array Get Next not working?
« Reply #2 on: June 27, 2017, 03:06:21 PM »
Stupid question, but why aren't you using arraylist?
Available for Playmaker work

SlashHabit

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Array Get Next not working?
« Reply #3 on: June 27, 2017, 03:34:44 PM »
Stupid question, but why aren't you using arraylist?

I've tried using array list but that doesn't work either.

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Array Get Next not working?
« Reply #4 on: June 27, 2017, 04:42:12 PM »
have you tried using the Array Contains action instead of cycling through it all?

or try setting the "end index" field on the get next action to the total keys in the array
edit: actually, I'm confused, your get next action is not set to return anything? how is that supposed to work?
« Last Edit: June 27, 2017, 04:44:41 PM by terri »

SlashHabit

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Array Get Next not working?
« Reply #5 on: June 27, 2017, 05:11:15 PM »
have you tried using the Array Contains action instead of cycling through it all?

or try setting the "end index" field on the get next action to the total keys in the array
edit: actually, I'm confused, your get next action is not set to return anything? how is that supposed to work?

I'm probably just as confused as you are. I sort of know how arrays work, but I can't really tell the program "Hey, look for this variable in this list and get back to me if it exists or not"

I've gone through basically all gets and finds contains etc multiple times over and over again. Which is why I named the jpg to "insanity" because when I took that screenshot I hadn't set up the get next action yet, even though I've tried it multiple times before. But yeah, that's my problem. I don't know how to set it up.

Just as a recap;

Split text to array: Creates all the words and puts them all in an array
Typing a text into a string variable
>Check if variable exist in the array< Not working
Success?

I'm getting kinda tired, been working on this crap for hours.

SlashHabit

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Array Get Next not working?
« Reply #6 on: June 27, 2017, 05:23:54 PM »
Look here a screenshot.

Even when I put the word RUG, at index 0. The action can't find it.

No matter how many times I press the enter key or point at different indexes or whatever it can't find anything.

EDIT: I know how Array GET works, it works if I point at a specific index, but I have 1200 indexes. I need the action to look through them all and see if it exists or not.
« Last Edit: June 27, 2017, 05:53:59 PM by SlashHabit »

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Array Get Next not working?
« Reply #7 on: June 27, 2017, 07:07:07 PM »
Have you made sure there aren't any empty spaces anywhere? Maybe when building the string something is being added to the end
« Last Edit: June 27, 2017, 07:08:49 PM by terri »

SlashHabit

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Array Get Next not working?
« Reply #8 on: June 27, 2017, 07:14:56 PM »
Have you made sure there aren't any empty spaces anywhere? Maybe when building the string something is being added to the end

Just checked, no spaces at all when building the string. Good thinking anyways.

Gonna sleep on it. I just need this to work and my first crappy mobile game which is going to make me half a dollar a day which will in 8 days give me the opportunity to feed my cat be completed.

SlashHabit

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Array Get Next not working?
« Reply #9 on: June 28, 2017, 11:24:14 AM »
Yeah still not working.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Array Get Next not working?
« Reply #10 on: June 28, 2017, 12:29:35 PM »
Hi,
i just tested "array list contains" and it seems to work fine on my end.

Can you check if the reference is correct and if you are getting an error in the console?

another thing you can test if the state is called.

You can do this 2 way :

1. place a "Debug Log" action 'above' the "Array List Contains" add a text and
    check 'Send To Unity Log'
    When you play it and the state is reached it should show the Log in the 'Console'

2. Right click on the state name and click 'Toggle Breakpoint'
    When you play the game and it reaches the state, the game will be paused and
    the state will be focused in the playmaker window.
    Right click again and click 'Toggle Breakpoint' again to uncheck the breakpoint.


if nothing happens, maybe it got stuck on an earlier state.

SlashHabit

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Array Get Next not working?
« Reply #11 on: June 28, 2017, 01:05:06 PM »
Hi,
i just tested "array list contains" and it seems to work fine on my end.

Can you check if the reference is correct and if you are getting an error in the console?

another thing you can test if the state is called.

You can do this 2 way :

1. place a "Debug Log" action 'above' the "Array List Contains" add a text and
    check 'Send To Unity Log'
    When you play it and the state is reached it should show the Log in the 'Console'

2. Right click on the state name and click 'Toggle Breakpoint'
    When you play the game and it reaches the state, the game will be paused and
    the state will be focused in the playmaker window.
    Right click again and click 'Toggle Breakpoint' again to uncheck the breakpoint.


if nothing happens, maybe it got stuck on an earlier state.

Thanks for your reply!

Checked the references and changed them incase they sounded a bit too familiar to eachother. But the problem still remains.

I ran a debug and got the following message back "Index is less than 0 or more than or equal to the list count." This sure is a noodle scratcher.
« Last Edit: June 28, 2017, 01:16:41 PM by SlashHabit »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Array Get Next not working?
« Reply #12 on: June 29, 2017, 01:53:42 AM »
Hi.

Quote
I ran a debug and got the following message back "Index is less than 0 or more than or equal to the list count." This sure is a noodle scratcher.

How did you do this debug?
Can you show some pictures or video?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Array Get Next not working?
« Reply #13 on: June 29, 2017, 02:02:00 AM »
Hi,

How do you get this list in the first place? if you share it, I'll have a look.

 Bye,

 Jean
 

SlashHabit

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Array Get Next not working?
« Reply #14 on: June 29, 2017, 05:18:09 AM »
Hi.

Quote
I ran a debug and got the following message back "Index is less than 0 or more than or equal to the list count." This sure is a noodle scratcher.

How did you do this debug?
Can you show some pictures or video?

Here's a screenshot