playMaker

Author Topic: arraymaker : - Simple array get  (Read 3743 times)

Harford

  • Playmaker Newbie
  • *
  • Posts: 6
arraymaker : - Simple array get
« on: March 03, 2012, 04:26:55 PM »
First off, - arraymaker seems great! Nice addition

I'd like some help,

I'm creating a list ( txt file ) with about 100 different number in it, for a web game.
I'd like to find a random one of those and see if it matches the typed value.

The way I am trying to do it so far -

Split Text To Array List
[takes my txt line spaced file of numbers and puts it in an array]

Array List Count
[Count the number of strings in the array]
[Store the value as array.Count]

Random Int
[Store a random Int value between 0 and array.Count]

Array List Get
[Sort of stuck at this point, as the terminology is not quite self explanatory ( to me ) , so some advice on how to now get that random value from the array and store it in a variable, would be great


Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: arraymaker : - Simple array get
« Reply #1 on: March 05, 2012, 10:53:40 AM »
Hi,

 I suppoed you have you looked at the sample provided (wordsearch) ? It's very similar to what you are willing to achieve.

There is a thread on this: http://hutonggames.com/playmakerforum/index.php?topic=891.0

Basically, All your steps are spot on.

ArrayListGet: This is how you will need to set it up:
--make sure you point to the gameObject where you have your ArraList
--"AT index": put your random int in this
-- in the Data storage section store the string ( you should have created a FsmString to hold the string value).

 And done, ArrayListGet will take the value from that array at the random index and store it in that FsmString Variable.

 If that doesn't help, I'll create a working sample for you, ok?

Bye,

 Jean

Anykey

  • Playmaker Newbie
  • *
  • Posts: 5
Re: arraymaker : - Simple array get
« Reply #2 on: April 03, 2012, 11:39:51 AM »
Hello,
Is it possible to have Array List Get every frame ?

I have an array with my weapons and Array List Get is supposed to check the string at an index and if this string contains the name of a weapon , it displays the weapon. The issue is when I play , Array List Get is grey , so I suppose when the index int var changes with up and down arrow , the stored string doesn't change.

I'm a very beginning visual programmer, how could I achieve what I want to do ?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: arraymaker : - Simple array get
« Reply #3 on: April 04, 2012, 01:35:37 AM »
Hi,

You should instead of getting it everyframe, watch for the index change and then fire the arrayGet only when needed.

So build a state that watch for the index change, when it does, transit to the state where to get it from the array, do stuff with it, and then back to that state that watch the index.

Does that make sense?