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