Asked

How To Create Multidimensional Arrays

Could you please show me how to create an array with 20 names, each associated with three values (x, y, z)? Additionally, I would like to generate a chart on the desktop that displays these names and their corresponding values.

Furthermore, I need to extract the values for a specific name and use them to control servo movements.

This assistance would be greatly appreciated.

Thank you, Don


ARC Pro

Upgrade to ARC Pro

Unlock the true power of automation and robotics by becoming a proud subscriber of Synthiam ARC Pro.

#81  

Stuff like this is messing me up with converting my EZ  scripts to Javascript. The one that constantly gets me is the sleep() command. In Javascript I need to use a lowercase "s" in sleep(). If I use a uppercase "S" like i could get away with in EZ Script the thing wont run until I lower case it. Now you say the Console.log() command needs to be upper case? Ugh. Why? Is there a reason for the differance? Is there any other commands that are case sensitive? @Athena, do you have the answer?

PRO
Synthiam
#82   — Edited

haha you ask like I'm in charge of the programming language:). I didn't make JavaScript hehe. REAL programming languages are case sensitive - Because they compile down to the ASCII values. A capital C is a different value than a lowercase c.

But you really should be using intellisense. As you type it shows the command. You can use the UP and DOWN arrow to select the command and press ENTER.

User-inserted image

So even the Console.log()

User-inserted image

PRO
Synthiam
#83   — Edited

Oh also i should add there are naming conventions for programming languages, which is why case sensitive matters.

For example...

  • functions start with lowercase letter (i.e. sleep)
  • classes (which group functions) start with uppercase letters (i.e. Servo)

So if you look at the Console... it's this..

Console.log("some text");

The "Console" is the class (which groups functions) and "log" is the function. If you press "Console." with a period at the end, you'll see all the functions that live under Console..

User-inserted image

So the naming convention is... Class.function()

#84  

OK, Thanks @DJ. That makes sense.

Actually I have been using the intellisense feature and it's wonderful. However because I was using it (improperly) I just found the my issue with the case sensitive frustrations. I'll start typing (for example, "servo" in lowercase) and add the peroid (.) to get the extension options with intellisense active. When I click on the intellisense extension option that I want, it will add the whole command as I wanted. The problem is that if I start out using the wrong case (servo. instead of Servo.) it will copy my wrong case choice instead of correcting it.

Example: I'll start typing servo. (with the "."), then pick the extension "releaseAll()" it will add servo.releaseAll() into the script. IT should be typed as: Servo.releaseAll() with a uppercase S. Now I see that I should be clicking on the servo offering in the intellisense list when I first type it, It will be inserted into the script, then add a "." to then choose again the wanted extension. It's a two part operation. LOL.:p If done the second way it's inserted  properly.

Thanks for the guidance.

PRO
Synthiam
#85  

You'll like the ARCx editor then. Because if you enter low case like this...

User-inserted image

but when you press ENTER it corrects the case as well...

User-inserted image

It's a better editor because it has lots of features including the ability to rename variables by right-clicking....

User-inserted image

#87  

Looking forward to it I’m sure it has been years in the making. There are probably a lot of things going on behind-the-scenes to make the platform beneficial for future.

#88  

Hey @DJ, is it to late to ask for a search tool to be added to this script editor in ARCx?