docs/usage/script-basics.md

changeset 166
5d39804f108b
equal deleted inserted replaced
165:92e1733243d5 166:5d39804f108b
1 # Script basics
2
3 Scansion scripts are designed to be extremely easy to read and write. They are based
4 on natural language statements as far as possible.
5
6 ## Metadata
7
8 A script begins with an optional title and description:
9
10 ```
11 # Script Title
12 # A short description of the script.
13 ```
14
15 Scripts may also contain one or more tags. A tag is either a simple string or
16 may also include an associated value. They are one tag per line, each beginning
17 with `##`:
18
19 ```
20 ## slow
21 ## status: stable
22 ```
23
24 Tags are useful to group scripts, and allow you to easily filter when running
25 Scansion with many scripts at once, e.g. with `--only-tags "status: stable"` or
26 `--skip-tags slow`.
27
28 ## Defining characters
29
30 Every script defines one or more characters that will perform actions in the
31 script.
32
33 Definitions consist of the type and name of the character, as well as any additional
34 properties specific to that character.
35
36 For example, an XMPP client called Romeo might be defined like this:
37
38 ```
39 [Client] Romeo
40 jid: romeo@example.com
41 password: s3cr3t!
42 ```
43
44 ## Actions
45
46 Once you have defined characters, you can have them perform actions. For example
47 our client Romeo will connect to the server and broadcast his availability to
48 contacts:
49
50 ```
51 Romeo connects
52
53 # Send presence!
54 Romeo sends:
55 <presence/>
56 ```
57
58 Different types of characters support different actions, see for example the
59 [Client class](../character-classes/client.md).
60
61 Note: lines beginning with a '#' are comments, and are useful to add descriptions to
62 each action, and help keep scripts readable.

mercurial