# Scripting skill

#### *mycroft-alias-skill.jumper047*

### Description:

This skill implements rudimental scripting language for mycroft. Scripts consists of two parts: trigger and action. Trigger is, in fact, padatious intent and described with almost same syntax. Action activated when recognized speech triggered script. Scripts stored in yaml config file on mycroft locally in \~/.mycroft/skills/ScriptingSkill/scripts.yaml

#### Triggers

Triggers syntax almost same as mycroft's padatious intents. You can read about them here: <https://mycroft-ai.gitbook.io/docs/skill-development/user-interaction/intents/padatious-intents> The only difference is phrases separator - instead of new line you should use semicolon, ";" Also it is possible to capture some input with `{placeholder}` syntax and use it later in actions.

#### Actions

Commands in action string can be separated with two separator types: "&&" and "&!". First one means next command will be sent to mycroft immediately after previous, second one - next command will be executed next to answer to previous command. At this moment there are three types of commands:

* Plain command - simple text, it will be sent to mycroft messagebus as is.
* `sleep([number])`, where number is number of seconds to wait.
* `one_of([some phrase] | [some other phrase])` - randomly choose one of alternate phrases and then send it to messagebus Also, as mentioned above, it is possible to pass some input to script with `{placeholder}` syntax.

#### Platform:

![Mark I](https://500835181-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzX1y2oL49APvqHoV5o%2Fuploads%2Fgit-blob-20518efa3a75671db56c323c5962b4108102367b%2Fmark-1-icon.png?alt=media) ![Mark II](https://500835181-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzX1y2oL49APvqHoV5o%2Fuploads%2Fgit-blob-72e32b84335e1f575f6e5b7b684320acc72e799f%2Fmark-2-icon.png?alt=media) ![Picroft](https://500835181-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzX1y2oL49APvqHoV5o%2Fuploads%2Fgit-blob-b7dc7493983981386b73158927c1ddf91597de7a%2Fpicroft-icon.png?alt=media) ![plasmoid](https://500835181-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzX1y2oL49APvqHoV5o%2Fuploads%2Fgit-blob-e517091d0124a9f790e778e3219fa05a3f71d7f0%2Fkde.png?alt=media)

#### Examples:

> (please|) flip a coin.\
> One\_of(say tails|say heads)\
> (switch|turn) on {switch} temporarliy; turn on.\
> Say switch on {switch} && sleep(50) && say switch off {switch}

### Installation:

{% hint style="warning" %}
This skill is not aproved by Mycroft skill tester.
{% endhint %}

{% tabs %}
{% tab title="Install by mycroft-msm" %}
`mycroft-msm install https://github.com/jumper047/mycroft-alias-skill`
{% endtab %}
{% endtabs %}

### Summary:

**Github:** <https://github.com/jumper047/mycroft-alias-skill>\
**Owner:** [@jumper047](https://github.com/jumper047)\
**Created:** 2020 May 16 08:27:54 UTC **Last updated:** 2020 Jul 12 11:24:06 UTC\
**License:** Apache License 2.0

**Categories:** \[ uncategorized ]
