Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.
Get Started

Resolved Resolved by DJ Sures!

Passing Variables Between Javascript And Ezscript.

Prior to ARC, I was able to pass variable among different scripts using EzScript.  I can still do that, but I cant pass a variable in JavaScript to and Ezscript.  is that something that can be implemented?

Related Hardware EZ-Robot JD Humanoid
AI Support Bot
Related Content
getVar( variableName, [default value] )
Retrieves the value from the Arc’s global variable storage. These are variables that are published by skill controls, such as the Camera, Auto Position, Speech Recognition, etc..

{variableName} - The name of the global variable as a string
{default value} [Optional] If specified, this value is returned if the global variable doesn’t exist.
{return} The value of the global variable

// Get the current direction the robot is moving
var direction = getVar($Direction);

// Get the value of $test, and if it doesn’t exist return false
var testVar = getVar($test, false);

setVar( variableName, value )
Sets the value from of Arc’s global variable storage. This allows the variable to be available to other controls or other scripts by using getVar().

{variableName} - The name of the global variable as a string
{value} The value that you wish to store in the global variable
{return} The value of the global variable

// Set a value of 5 to be accessible by other controls
setVar($MyValue, 5);

varExists( variableName )
Check if the global variable exists.

{variableName} - The name of the global variable as a string
{return} true/false Boolean if the variable exists

// print if the variable exists

User-inserted image
Dang it.  I didn't read that, as you've probably figured out.

So it worked, it set the variable, I can see it in the variable watcher.  But my ez script doesn't see that the variable has a value.  This script was wrote in a couple of versions before ARC.  Does that matter?
#3   — Edited
Perhaps you're trying to read the variable in EZ-Script before it is being set by Javascript. One exists only when one is existing:D yoda says

Javascript set the variable..


setVar("$myVariable", "this is text");

EZ-Script print the contents of the variable


It was working all the time.  My old ezscript had an error and instead of halting, it just ran and did nothing.

but I found it and marked this resolved.

Thanks for the help, good night.
Anytime:) have a great night as well!