Skip to content

API calls

Group/User/Room ID


calculates the internal green-go id's to be used in for example channel.

channel.assign[1] =  // assigning group 10 to channel 1


Timers can be usd to create repeating or delayed events or to measure time.

A timer can be accessed as an indexed property (timer[1]), and are based on a 1 millisecond clock

Creating a repeating a timed event

the below example will start a timer and 1 second after initialization the event will trigger and execute its code, inside the event the timer is re-triggered with a 500ms time and will trigger the event 500ms later again

event timer[1]
  // do your stuff
  timer[1] = 500 // set repeat time to 500 ms

timer[1] = 1000 // start first event after 1 second

Creating a single delayed event

the below example will start a timer of 5 seconds, after the 5 seconds the timer event will trigger and execute its code. inside the event the timer is canceled to make it available again

after 5 seconds

event timer[1]
  // do your stuff
  cancel timer[1] // release the timer event

timer[1] = 5000 // start event after 5 seconds

Creating 10 times event at 1 second intervals

the below example will start a timer of 1 second, after the initial second the event will trigger. the event checks if counter is 0 if not the counter wil be lowered by one and the timer is re-triggered. if 0 the timer will be canceled.

var counter = 9

event timer[1]
  if counter
    counter = counter - 1
    timer [1] = 1000
    cancel timer[1] // release the timer event
  // do your stuff

timer[1] = 1000 // start event after 1 seconds

using dynamically assigned timers

instead of using timers directly, it is possible to have the VM find a free timer and use that

event timer // get a free timer
  // do event
  timer = 100 // use the timer that generated this event
timer = 100 // set the last found timer

Script to Script communication

Scripts can communicate between each other (either on the same device or via the green-go network). This function is supported by all devices that can run scripts

communication is send in blocks to destinations. destinations are freely numbered. multiple scripts can receive the same data-block if the same control.receive event is set

Script to script events and api


  • control.receive[index]

to receive packets, an control event needs to be setup by creating a event on control.receive[index] with the index set to the destination number to listen on. multiple control.receive events can be set. using a define for the index can help making it more readable, but is not needed

Api calls

  • control.destination(index)

sets the destination index for the next data. all previously data will be send

  • control.write(value) or control.write(key, value)

data can be written as a single value or as a key / value pair. in case a single value is written, then internally it will assign it the next key (starting with 1).

  •,, defaultValue)

when inside a control.receive[] event, it is possible to get the data out of the data block in multiple ways. with no parameters are given, then the next data item is read. when a key is given, this key is searched in the data block. If found it will return this value. If the key is not found, it will return 0. When a default value is also given to the api, then instead of a 0 value the default value is returned in the case the value is not found in the data block


if no parameter is given, then the next key is read. A return of 0 indicates end of the block. If is following the then it uses the key found by the If a key is given, this key is searched. if non-zero is returned the value is found and can be read by

script to script examples

talk follower example

the following example will trigger an event when the channel talk of channel 1 changes and sends the channel and its talk status to the control destination (1)

// sending script

define  1

  control.write(1) // write the first item, channel number                              
  control.write([1]) // write the second item. channel state

the example below will receive the data blok from the previous script, parse it and set the channel accordingly.

// receiving script

define  1

event control.receive[]
  local channel = // read first item, channel number[channel] = // read the second item, channel state and set the channel to this value

set audio on remote user

The snippet below contains a function that will take 3 properties and sends this to the destination this destination is specific to the user id, all devices with this user id will be able to receive this message. two key value pairs, for gain and threshold are set in the message

// sending script

function, gain, threshold)
  control.write(1, gain)
  control.write(2, threshold)

The script below will receive all messages that are send to its if key 1 is sent it will set its gain to its associated value. for key 2 the threshold is set if present

//receiving script

event control.receive[]
  audio.gain =, audio.gain) // if no gain was send, then use the current setting (no change)
  audio.threshold =, audio.threshold)

Networking commands


Api calls

network.address(string) network.address(p1, p2, p3, p4) create a integer ip address from a string or 4 values from 0-255

Open Sound Control (OSC)

OSC commands can be send and received by all devices with a direct network connection.

OSC api and events

OSC Api calls

  • This will enable osc and will set the udp port to listen on.
  • osc.close Stops the osc part
  • osc.destination(ipaddress) Sets the ip address
  • osc.destination(ipaddress, udpport) Sets the ip address and udp port to send osc commands to -osc.send(url, parameter1, .....) Send one or more parameters to OSC url. osc-url's start with a /, like "/channel/1". at least one parameter needs to be given, and parameters can be integers and/or strings
  • osc.sender() Returns the ipaddress (as an integer) of the current osc command received (to be used inside the scope of a osc.receive event)
  • osc.sender.port() Returns the udp source port of the current osc command received (to be used inside the scope of a osc.receive event)

OSC events

  • osc.receive[url]

setup a receive event for a osc url. multiple events/url's can be setup

OSC property read


read parameters by index starting at 1


// receiving osc and setting channel 1 talk state accordingly // start listening for osc udp packets on udp-port 1000

event osc.receive["/channel/1/"]
  if osc.receive[1][1] =
  else[1] =

// sending an osc message to report the talk state of channel 1

Back to top