Skip to content

Commit 4e3b006

Browse files
committed
Update readme and screenshots
1 parent 7631b53 commit 4e3b006

11 files changed

+332
-258
lines changed

AdvancedCactbot.md

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# Advanced Cactbot Usage
2+
3+
1. [Configuring UI Modules](#configuring-ui-modules)
4+
1. [Customizing Appearance](#customizing-appearance)
5+
1. [Customizing Behavior](#customizing-behavior)
6+
1. [Text To Speech](#text-to-speech)
7+
1. [Adding Custom Triggers](#adding-custom-triggers)
8+
1. [Regular Expression Extensions](#regular-expression-extensions)
9+
1. [Writing a cactbot UI Module](#writing-a-cactbot-ui-module)
10+
11+
## Configuring UI modules
12+
13+
The general philosophy of cactbot is that future updates of cactbot will update files inside
14+
the ui directory, and any user configuration should go in files in the user directory. This
15+
will prevent your changes from being clobbered during future cactbot updates.
16+
17+
All cactbot UI modules can load user settings from the [user/](user/) directory. The user/
18+
directory already includes some example configuration files, which you can rename and use.
19+
For example the **user/raidboss-example.js** can be renamed to **user/raidboss.js**
20+
and edited to change the behaviour of the **raidboss** module.
21+
22+
If you want to do it yourself, then create a **user/\<name\>.css** or a **user/\<name\>.js**
23+
file, where **\<name\>** is the name of the UI module, such as [raidboss](ui/raidboss) or
24+
[jobs](ui/jobs).
25+
26+
After making any changes to these files, pressing the "Reload overlay" button for the
27+
appropriate cactbot in ACT's OverlayPlugin settings will apply the changes.
28+
29+
### Customizing Appearance
30+
31+
The **user/\<name\>.css** file can change positions, sizes, colors, etc. for components of
32+
the UI module. See the **ui/\<name\>/\<name\>.css** to find the names of things you can modify.
33+
For example in [ui/raidboss/raidboss.css](ui/raidboss/raidboss.css), you see the
34+
`#popup-text-container` and `#timeline-container` which can be changed via **user/raidboss.css**
35+
to different positions as desired. The size and color of info text alerts can also be changed by
36+
making a CSS rule for the `.info-text` class such as below:
37+
38+
```
39+
.info-text {
40+
font-size: 200%;
41+
color: rgb(50, 100, 50);
42+
}
43+
```
44+
45+
### Customizing Behavior
46+
47+
The **user/\<name\>.js** file can set options to customize how the UI module works. The
48+
options that can be changed are documented in the `Options` section at the top of the
49+
**ui/\<name\>/\<name\>.js** file. For example in [ui/raidboss/raidboss.js](ui/raidboss/raidboss.js),
50+
you see the `BarExpiresSoonSeconds` option which controls when timeline bars should be
51+
highlighted. You can change that option from the default value to 5 seconds by editing
52+
**user/raidboss.js** to say:
53+
54+
```
55+
Options.BarExpiresSoonSeconds = 5
56+
```
57+
58+
To disable a text/sound alert that comes built-in for a fight, find the trigger's `id` in the files in
59+
[ui/raidboss/data/triggers](ui/raidboss/data/triggers). Then add the `id` to the `Options.DisabledTriggers`
60+
in the **user/raidboss.js** file, such as:
61+
62+
```
63+
Options.DisabledTriggers = {
64+
'O4S1 Fire III': true,
65+
}
66+
```
67+
68+
### Text To Speech
69+
70+
If you dislike the built-in sound info, alert, and alarm noises that cactbot uses by default and would
71+
prefer to use text to speech (tts), you can set a global option by including this line
72+
in your **user/raidboss.js** file:
73+
74+
```
75+
// Including this line will make any trigger with text to speech use that instead of other
76+
// noises.
77+
Options.SpokenAlertsEnabled = true;
78+
79+
// If you don't like the on screen text, you can turn that off with this line too:
80+
Options.TextAlertsEnabled = false;
81+
```
82+
83+
See [this options documentation](user/raidboss-example.js) for a full list of options and
84+
how to configure text, sound, and tts options on a per trigger basis.
85+
86+
### Adding Custom Triggers
87+
88+
To add a sound alert that can be activated in any zone, for example, add the following to **user/raidboss.js**:
89+
90+
```
91+
Options.Triggers = [
92+
{ zoneRegex: /./,
93+
triggers: [
94+
// Trick Attack used.
95+
{ regex: /:\y{Name}:\y{AbilityCode}:Trick Attack:/,
96+
sound: '../../resources/sounds/WeakAuras/RoaringLion.ogg',
97+
},
98+
99+
.. other triggers here ..
100+
],
101+
},
102+
103+
// .. other zones here ..
104+
]
105+
```
106+
107+
A more sophisticated example that shows an alert message after a 1 second delay, but
108+
only when the player's character name appears in the FFXIV log message:
109+
110+
```
111+
Options.Triggers = [
112+
// .. other zones here ..
113+
114+
{ zoneRegex: /./,
115+
triggers: [
116+
// .. other triggers here ..
117+
118+
{ regex: /:(\y{Name}) gains the effect of Forked Lightning from/,
119+
delaySeconds: 1,
120+
alertText: 'Forked Lightning: Get out',
121+
condition: function(data, matches) { return matches[1] == data.me; },
122+
},
123+
124+
// .. other triggers here ..
125+
],
126+
},
127+
128+
// .. other zones here ..
129+
]
130+
```
131+
132+
### Regular Expression Extensions
133+
134+
If you're familiar with regular expressions you'll note the the `\y{Name}` and
135+
`\y{AbilityCode}` are unfamiliar. These are extensions provided by cactbot for
136+
convenience to avoid having to match against all possible unicode characters
137+
or to know the details of how the FFXIV ACT plugin writes things.
138+
139+
The set of extensions are:
140+
- `\y{Float}`: Matches a floating-point number, accounting for locale-specific encodings.
141+
- `\y{Name}`: Matches any character or ability name (including empty strings which the FFXIV ACT plugin can generate when unknown).
142+
- `\y{ObjectId}`: Matches the 8 hex character object id in network log lines.
143+
- `\y{AbilityCode}`: Matches the FFXIV ACT plugin's format for the number code of a spell or ability.
144+
- `\y{TimeStamp}`: Matches the time stamp at the front of each log event such as `[10:23:34.123]`.
145+
- `\y{LogType}`: Matches the FFXIV ACT plugin's format for the number code describing the type of log event, found near the front of each log event.
146+
147+
See this [cactbot-user git repo](https://github.com/quisquous/cactbot-user) for more examples.
148+
149+
150+
151+
## Writing a cactbot UI module
152+
153+
To build a cactbot ui, you need to make a **.html** file and point cactbot at it. There are a
154+
number of helpful things in the [resources/](resources/) directory.
155+
156+
Include the [resources/defaults.css](resources/defaults.css) file to get some of the default
157+
look and feel of other cactbot uis, then use the `.text` class on any HTML elements which contain
158+
text. You may add the `.hide` class to elements you do not want shown, and remove it when they
159+
should be visible.
160+
161+
Include the [resources/resize_handle.css](resources/resize_handle.js) and
162+
[resources/resize_handle.js](resources/resize_handle.js) files to give visual feedback to the
163+
user when the module is unlocked for moving and resizing.
164+
165+
Include the [resources/unicode.js](resources/unicode.js) file to use unicode categories in
166+
regular expressions in order to support non-english characters.
167+
168+
There are a number of web components that provide widgets for building your ui, including the
169+
[timerbar](resources/timerbar.js), [timerbox](resources/timerbox.js) or
170+
[resourcebar](resources/resourcebar.js). Include the file and then instatiate it by making an
171+
element of that type, such as `<timer-bar></timer-bar>` or `<resource-bar></resource-bar>`.
172+
173+
The set of Javascript events that can be listened for via `document.addEventListener` is found
174+
in [CactbotOverlay/JSEvents.cs](CactbotOverlay/JSEvents.cs). The public fields of each event
175+
type will be members of the event's `detail`. See the
176+
[ui/test/cactbot_test.html](ui/test/cactbot_test.html) ui module for a simple example of
177+
listening to and using the Javascript events.

0 commit comments

Comments
 (0)