Actions

Common Format

{
  type: "action name",
  var: "variable name",
  value: "value to pass",
  count: "times to loop"
}

Type

This is required, and it should be one of the following values.

  • TAP
  • BATCH
  • SWIPE_UP
  • SLOW_UP
  • SWIPE_RIGHT
  • SWIPE_DOWN
  • SLOW_DOWN
  • SLOW_RIGHT
  • SLOW_LEFT
  • SWIPE_LEFT
  • REPEAT
  • MOVE
  • WAIT
  • MSG
  • STOP
  • SET
  • ADD
  • LAP
  • EVENT
  • INPUT

Var

This is the name of the variable to read or write to.  This is not required for every action

Value

This is typically a integer, number based value.  If the value starts with a $, it will be treated a a variable reference.

Count

This is optional.  The default value is 1.  If this number is greater then 1, the action will loop this may times.

Specific Details

TAP

{
  "type": "TAP",
  "value": "component-id"
}

The value should be a name of a component identifier.  Component identifiers are stored in the related view files.

BATCH

{
  "type": "BATCH",
  "value": "START"
},
{
  Other tap or swipe actions
},
{
  "type": "BATCH",
  "value": "END"
}

Batch is used to speed up processing by sending a series of commands at the same time. Commands that are not tap, input, event or swipe based will not be batched.

SWIPE_UP

SLOW_UP

SWIPE_RIGHT

SWIPE_DOWN

SLOW_DOWN

SLOW_RIGHT

SLOW_LEFT

SWIPE_LEFT

REPEAT

{
  "type": "REPEAT",
}

This action will cause the current state execution to return to the start and try again.  The screen will be re-sampled and conditions evaluated.

MOVE

{
  "type": "MOVE",
  "value": "log-in"
}

This will cause the app to switch state and restart before continuing to process.

Value

The name of the state to switch to.

WAIT

{
  "type": "WAIT",
  "value": "5000"
}

This will cause the app to pause for a specified amount of milliseconds.  For reference 1 second is equal to 1000 milliseconds.

MSG

{
  "type": "MSG",
  "value": "Starting raid ${raid_runs}"
}

This will print a message to the log.  You can include variables by using the format ${variable_name}.

STOP

{
  "type": "STOP"
}

Stop execution of the current script.

SET

{
  "type": "SET",
  "value": "0",
  "var": "_loops"
}

This will set the variable defined by var to the specified value.

ADD

{
  "type": "ADD",
  "var": "raid_runs",
  "value": "1"
}

This will add the value to the variable defined by var.

LAP

{
  "type": "LAP",
  "value": "BATTLE"
}

Use the LAP action to create a simple timer that will print out the time between invocations.  The first invocation will not print out any timing information.

EVENT

{
  "type": "EVENT",
  "value": "back"
}
  • camera
    • Cause the camera to appear.  Useful to act as a screen saver.
  • back
    • press the back button
  • brighter
    • Make the screen brighter
  • darker
    • Make the screen darker

INPUT

{
"type": "INPUT",
"value": "7"
}

This will send a raw key input to the device.  This is a more advanced version of EVENT, but more open ended.  You can find available values here.

LABEL

{
"type": "LABEL",
"value": "LABEL_NAME"
}

This will define a label in the current statement.  Label is a special tag that enables control flow to jump around and perform advanced logic.

GOTO

{
"type": "GOTO",
"value": "LABEL_NAME"
}

This will cause the program to jump to the named label within the same statement.  Potential usages conditional blocks and looping.

LINK

{
"type": "LINK",
"value": "STATE_NAME"
}

This works like a INCLUDE, but allows you to control if it is actually used.  Typically a CALL would be preferred, since LINK actions will not return a value.