Updated Scripting Language (markdown)

gemu 2019-09-24 17:16:55 +02:00
parent 10439bbb61
commit 26e2e2abc4
1 changed files with 9 additions and 1 deletions

@ -27,6 +27,7 @@ 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_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
<BR><BR>To enter a script, go to `Configuration` =\> `Edit script` in the Tasmota web UI menu
@ -108,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>)`
>- **Button:** `bu(<vn> <txt1> <txt2>)` (up to 4 buttons may be defined in one line)
`<vn>` = name of variable to hold button state
`<txt1>` = text of ON state of button
`<txt2>` = text of OFF state of button
@ -242,6 +243,13 @@ If you define a variable with the same name as a special variable that special v
`#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.
`=(svar)`executes a script in a string variable (dynamic or self modifying code)
**For loop** (loop count must not be less than 1)