-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtriggers.txt
More file actions
127 lines (100 loc) · 6.88 KB
/
triggers.txt
File metadata and controls
127 lines (100 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
Rodney triggers:
A trigger is created by adding an entry into the learndb with the entry
name in the format "#nethack:foo" (more generally, "#irc_channel:foo").
When Rodney sees the text "foo" in the channel #nethack, it will output
one of the definitions, chosen at random, for that entry.
For example:
!learn add #nethack:foo Hello!
<paxed> foo
<Rodney> Hello!
----
You can use special commands in the trigger definitions. The commands are case sensitive.
The dollar signs can be escaped, like this: \$LC(\$ARGS)
Commands with parameters can be nested.
Simple commands:
$ARG Returns one of the arguments given to the trigger, chosen at random, or
nick of the person issuing the trigger if no args.
$ARGS Returns all of the arguments given to the trigger, or nick or the person issuing the trigger if no args.
Pipe characters in both $ARG and $ARGS are escaped by default, so they don't interfere with other commands.
$NICK The nick of the user who triggered the message.
$RNICK A nick of a recently active user.
$SELF The bot's name (Usually "Rodney").
$CHAN Channel where the trigger happened.
$CHAR Random valid NetHack character type, eg. "Wiz-Elf-Mal-Cha"
$RNDOBJ Random simple NetHack object, eg. "spellbook of knock"
$RNDMON Random NetHack monster, eg. "zruty"
$BUC One of "blessed", "uncursed" or "cursed", randomly chosen.
$ROLE One of the roles, eg. "wiz". Use $LROLE for the full name, eg. "wizard".
$RACE One of the races, eg. "gno". Use $LRACE for the full name, eg. "gnome".
$ALIGN One of the alignments, eg. "cha". Use $LALIGN for the full name, eg. "chaotic".
$GENDER Either of the genders, "mal" or "fem". Use $LGENDER for the full name, eg. "female".
$UPTIME The time Rodney has been running, eg. "0 Days, 00:01:54"
$SERVERUPTIME The time the server's been running.
$COIN Either "heads" or "tails"
$PLAYER One of the people currently playing on NAO.
$NPLAYERS Number of players of NAO.
$POM Phase of the Moon.
$DATE Date and time of the server.
Commands with parameters:
$LC(...) Lowercase parameter.
$UC(...) Uppercase parameter.
$LCFIRST(...) Lowercase parameter's first character.
$UCFIRST(...) Uppercase parameter's first character.
$STRLEN(...) Return length of parameter, in characters.
$SUBSTR(...) Takes 2 or 3 parameters. Returns part of the first parameter, similar to perl's substr()
$TRIM(...) Remove whitespace from beginning and end of parameter.
$INDEX(...) Takes 2 parameters. Searches for param2 in param1, and returns the starting position in param1. If not found, returns -1
$RINDEX(...) Like $INDEX(), but searches from the end of param1. (Still returns the starting position, though)
$REVERSE(...) Reverse parameter.
$REBASE(...) Takes 2 parameters. Returns parameter1 converted to another base. parameter2 can be one of "2", "8", "16", "b", "o", "x"
$AN(...) Prefix parameter string with "an " or "a ".
$PLURAL(...) Return a plural form of parameter.
$NPLURAL(...) Takes 2 parameters, separated by a pipe. if param1 equals 1, returns $AN(param2) else returns $PLURAL(param2)
$SSUFFIX(...) Return possessive form for parameter.
$ORDIN(...) Return the parameter (which should be a positive integer), with ordinal suffix.
$RND(X) Returns a random number between 0 and X, inclusive.
$RND(N,M) Returns a random number between N and M, inclusive.
$RND(NdM) Returns a random die roll with dice NdM.
$SHUFFLE(...) Accepts a pipe-delimited list of strings, and returns all of them in random order, eg. "$SHUFFLE(foo|bar|baz)".
$CHOICE(...) Accepts a pipe-delimited list of strings, and returns one of them.
Each string can be prepended with "N*" to multiply the weight for that string, eg. "$CHOICE(10*foo|bar)".
Can also accept one of @role, @race, @gender, @char, @coin, @align, or a diceroll in a D-notation.
$URLENC(...) Encode the parameter for URL usage.
$ROT13(...) Encode the parameter with rot13.
$IF(...) Takes either 2, 3 or 4 parameters, separated by a pipe.
2 parameters: If param1 is non-zero, show param2.
3 parameters: If param1 is non-zero, show param2, else show param3.
4 parameters: If param1 equals param2, shows param3, else shows param4.
$STOP(...) If parameter is 0 or missing, stops processing here and returns the already processed part.
If parameter is nonzero, stops processing and return with nothing, so the bot says nothing.
$QUIT(...) If parameter is a positive integer value, there's a 1-in-parameter chance the bot stops processing
the trigger and returns with nothing, so the bot says nothing.
$RNDCHAR(...) like $CHAR, but can be given a role as a parameter, eg. "$RNDCHAR(Wiz)"
$GOD(...) Gives a random god(dess) of role or alignment, or any role if parameter does not match any role or align.
$REPLACESTR(...) Takes 3 parameters, separated by a pipe. Replaces all occurrences of param1 in param3 with param2.
$TIMEFMT(...) Use strftime(3) to display the current time.
$LG(...) Perform !lg query (minus !lg and -dump), for example "$LG(scorchgeek won)"
$RMPIPES(...) Replaces the pipe characters with spaces.
$ESCAPE(...) Escapes pipe characters so they don't interfere with other commands.
$UNESCAPE(...) Replaces escaped pipe characters with pipes.
$CALC(...) Evaluate parameter as a mathematical expression. Also accepts functions rnd(), rn2(), abs().
$ISNUM(...) Returns 1 if parameter contains only digits, else returns 0.
$ISINT(...) Returns 1 if parameter contains only digits and optionally starts with plus or minus. Otherwise returns 0.
$ISALPHA(...) Returns 1 if parameter contains only a-zA-Z, else returns 0
$ISALNUM(...) Returns 1 if parameter contains only a-zA-Z0-9, else returns 0
$ISPLR(...) Returns 1 if parameter is a registered NAO username, else return 0
$ISADMIN(...) Returns 1 if parameter is a registered bot admin name, else returns 0
$PLRNAME(...) Returns correct capitalization of a registered NAO username. If no matching user, returns ""
$ISWIKIPAGE(...) Returns 1 if parameter matches a nethackwiki page title.
$WIKIPAGE(...) Return correct capitalization of a nethackwiki page title.
$NWIKIPAGES(...) Returns how many nethackwiki page titles match the string.
Special commands:
$THEN The bot will split the result at this and speak each part separately. (Note that there's a space: "$THEN ")
$ACT If the definition begins with this, followed by a space, Rodney will ctcp action the message instead of messaging.
Variables:
$SET(...) Set variable value. Takes two parameters, first is the variable name, second the value.
$GET(...) Get variable value. Takes one parameter, the variable name.
$(...) Alias of $GET(...)
Predefined variables:
argc Integer. Number of arguments given.
argv Array. argv[0] is first argument. For example: "$(argv[0])"