Updated Scripting Language (markdown)

Michael Ingraham 2019-09-24 18:18:34 -04:00
parent d27c17c95a
commit 34fe3a5d05
1 changed files with 9 additions and 11 deletions

@ -24,10 +24,10 @@ SDCARD_DIR | enables support for web UI for SD card directory upload and downloa
USE_24C256 | enables use of 24C256 I<sup>2</sup>C EEPROM to expand script buffer (defaults to 4k)
SUPPORT_MQTT_EVENT | enables support for subscribe unsubscribe
USE_TOUCH_BUTTONS | enable virtual touch button support with touch displays
USE_WEBSEND_RESPONSE | enable receiving the response of a websend command (received in section E)
USE_WEBSEND_RESPONSE | enable receiving the response of a [`WebSend`](Commands#websend) command (received in section E)
USE_SCRIPT_WEB_DISPLAY | enable `>W` section
USE_SCRIPT_JSON_EXPORT | enable `>J` section
USE_SCRIPT_SUB_COMMAND | enable to call scripter subroutines via name in console or with MQTT
USE_SCRIPT_SUB_COMMAND | enables invoking named script subroutines via the Console or MQTT
<BR><BR>To enter a script, go to `Configuration` =\> `Edit script` in the Tasmota web UI menu
@ -109,7 +109,7 @@ The lines in this section are displayed in the web UI main page. Requires compil
>- USER IO elements are displayed at the top of the page
>
>A web user interface may be generated containing any of the following elements: toggle button, check box, slider, or text input.
>- **Button:** `bu(<vn> <txt1> <txt2>)` (up to 4 buttons may be defined in one line)
>- **Button:** `bu(<vn> <txt1> <txt2>)` (up to 4 buttons may be defined in one row)
`<vn>` = name of variable to hold button state
`<txt1>` = text of ON state of button
`<txt2>` = text of OFF state of button
@ -241,14 +241,12 @@ If you define a variable with the same name as a special variable that special v
`#name` names a subroutine. Subroutine is called with `=#name`
`#name(param)` names a subroutine with a parameter. Subroutine is called with `=#name(param)`
Subroutines end with the next `#` or `>` line or break. May be nested
Parameters can be numbers or strings and on mismatch are converted
if USE_SCRIPT_SUB_COMMAND is defined a subroutine may be called via console or MQTT with the subroutines name
e.g. the subroutine
#SETLED(num)
may be called by SETLED 1 via console passing 1 in num (works also with string parameters)
it is possible to overwrite internal Tasmota commands. if the subroutine is called e.g.
#POWER1(num) the cmd POWER1 is processed in scripter in stead of Tasmota.
Subroutines end with the next `#` or `>` line or break. Subroutines may be nested
Parameters can be numbers or strings and on type mismatch are converted
If `#define USE_SCRIPT_SUB_COMMAND` is included in your `user_config_override.h`, a subroutine may be invoked via the Console MQTT using the subroutine's name. For example, a declared subroutine `#SETLED(num)` may be invoked by typing `SETLED 1` in the Console. The parameter `1` is passed into the `num` argument. This also works with string parameters.
It is possible to "replace" internal Tasmota commands. For example, if a `#POWER1(num)` subroutine is declared, the command `POWER1` is processed in the scripter instead of in the main Tasmota code.
`=(svar)`executes a script in a string variable (dynamic or self modifying code)