Asked — Edited
Resolved Resolved by Aerius!

Arrays

In EZ-Script:

It is not really clear to me what functionality regarding Arrays are supported with EZ-Script.

Perhaps someone can clarify for me how to do the following:

  1. How do I define an array with multiple elements all at once.
  2. How do I traverse the elements of an array?
  3. How do I append to the array?
  4. Is there a for loop like functionality?

Thanks


ARC Pro

Upgrade to ARC Pro

ARC Pro will give you immediate updates and new features needed to unleash your robot's potential!

PRO
Synthiam
#1  

Have you loaded the array example project?

#2  

@DJ

Yes I did look at them.

First I appreciate all the examples you provide but in this case it did not really help me.

So unless I am looking at the wrong example:

The appendarray does not seem to be an option when I use it in ez-script The defineArray example does not seem to work and complains about an error on line 6. From what I can see at least there does not seem to be a for loop. The example in the fillarray command seems to imply at least reading the example that you can only add one value at a time.

Please correct me if I am wrong in any of my observations.

Thanks

#3  

So I figured out by playing around I can do the following to fill the array. I would appreciate help with the other questions.

DefineArray($X, 10) $X[1] = 1 $X[2] = 2

Thanks

Canada
#4  

If this example could help,

I am using a coma delimited text file containing lines of different words in it.

The game script (draft for now) is extracting data from the file to an array.

then each element is use into a variable ready to be process by the script.

The game:? Let the robot guess what is the image on the card without looking at it

What's need to play? A deck of card with different image on it

Player? My little 4 years old granddaughter

The script is available in the cloud under my user name.

Canada
#5  

I can't load a plain text file. however , here is a list of data in my txt file.

Is it an animal,can it fly,is it a bird,it have green feeders,can he talk,it is a parrot, Is it an animal,can it fly,is it a bug,it is multicolored,it was before a caterpillar,it is a butterfly, Is it an animal,can it fly,is it a bug,it is brown or black,it is small,it is a fly, Is it an animal,can it swim and walks,it is black and white,he loves fish,it is a penguin, Is it an animal,can it walk,it have four legs,is it tall,it can roar,it is a lion, Is it an animal,can it walk,it have four legs,is it tall,you can ride on it,it is an horse, Is it an animal,can it walk,it have four legs,is it tall,it gives milk,it is a cow, Is it an animal,can it walk,it have four legs,is it small,it is your best friend,it is a dog, Is it an animal,can it walk,it have four legs,is it small,mouses are afraid of it,it is a cat, food,fruit,in a tree,yellow,monkeys loves it,banana, food,fruit,in a tree,green or red,round,apple, food,fruit,in a tree,green,small and round,grapes, food,fruit,in a tree,red,small and round,cherries, food,vegetable,in garden,orange,carrot, food,vegetable,in garden,brown,potatoes, food,icy,creamy,pink,to be licked, ice cream, object,clothing,summer,T-shirt,white, object,clothing,summer,shirt,blue, object,clothing,summer,shirt,red,

#6  

@Aerius

I will take a look at your script and I appreciate the help.

Thanks

#7  

Thank you. Your script gave me some ideas of how to accomplish what I want to do.