diff --git a/Scripting-Language.md b/Scripting-Language.md index efffe1c5..24406fc2 100644 --- a/Scripting-Language.md +++ b/Scripting-Language.md @@ -24,10 +24,10 @@ SDCARD_DIR | enables support for web UI for SD card directory upload and downloa USE_24C256 | enables use of 24C256 I2C 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

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( )` (up to 4 buttons may be defined in one line) +>- **Button:** `bu( )` (up to 4 buttons may be defined in one row) `` = name of variable to hold button state `` = text of ON state of button `` = 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)