Scripting Operators » History » Version 59
Per Amundsen, 01/04/2019 04:00 PM
1 | 39 | Per Amundsen | {{>toc}} |
---|---|---|---|
2 | |||
3 | 1 | Per Amundsen | h1. Scripting Operators |
4 | |||
5 | 51 | Per Amundsen | AdiIRC supports various operators for use in [[/if]] [[/elseif]] [[/while]] and [[$iif]] expressions. |
6 | 1 | Per Amundsen | |
7 | 42 | Per Amundsen | [[/var]], [[/set]], [[$calc]] supports it's own set of [[Arithmetic Operators|arithmetic expression]]. |
8 | 30 | Per Amundsen | |
9 | 33 | Per Amundsen | All operators supports the "!" sign to reverse the operation. |
10 | 32 | Per Amundsen | |
11 | 35 | Per Amundsen | Operators in bold is AdiIRC only. |
12 | |||
13 | 34 | Per Amundsen | *Example* |
14 | |||
15 | <pre> |
||
16 | ; check if 5 is lower than 4. |
||
17 | if (5 < 4) echo true |
||
18 | else echo false |
||
19 | 36 | Per Amundsen | |
20 | 38 | Per Amundsen | ; Reverse check if 5 is lower than 4 same, as 5 > 4. |
21 | 36 | Per Amundsen | if (5 !< 4) echo true |
22 | else echo false |
||
23 | 34 | Per Amundsen | </pre> |
24 | |||
25 | 10 | Per Amundsen | h2. Math Comparison Operators |
26 | 13 | Per Amundsen | |
27 | 45 | Mr. BS | |_.Syntax |_.Name |_.Result | |
28 | 10 | Per Amundsen | |=. <notextile>%x == %y</notextile> |
29 | 11 | Per Amundsen | <notextile>%x = %y</notextile> |
30 | 12 | Per Amundsen | <notextile>%x != %y</notextile> |
31 | 16 | Per Amundsen | <notextile>%x !== %y</notextile> |
32 | 12 | Per Amundsen | <notextile>%x < %y</notextile> |
33 | <notextile>%x > %y</notextile> |
||
34 | <notextile>%x <= %y</notextile> |
||
35 | <notextile>%x >= %y</notextile> |
||
36 | <notextile>%x // %y</notextile> |
||
37 | <notextile>%x \\ %y</notextile> |
||
38 | <notextile>%x & %y</notextile> |
||
39 | |^. Equal |
||
40 | 15 | Per Amundsen | Equal |
41 | 1 | Per Amundsen | Not equal |
42 | 16 | Per Amundsen | Not equal |
43 | 10 | Per Amundsen | Less than |
44 | Greater than |
||
45 | Less than or equal to |
||
46 | Greater than or equal to |
||
47 | Multiple Of (Divides) |
||
48 | Not Multiple Of (Not Divides) |
||
49 | Bitwise And |
||
50 | |^. True, if %x is equal to %y. |
||
51 | True, if %x is equal to %y. |
||
52 | 16 | Per Amundsen | True, if %x is not equal to %y. |
53 | 10 | Per Amundsen | True, if %x is not equal to %y. |
54 | True, if %x is strictly less than %y. |
||
55 | True, if %x is strictly greater than %y. |
||
56 | True, if %x is less than or equal to %y. |
||
57 | True, if %x is greater than or equal to %y. |
||
58 | True, if %x divides %y. |
||
59 | True, if %x does not divides %y. |
||
60 | True, if (bit representation of) %x AND %y is a none zero. |
||
61 | 14 | Per Amundsen | | |
62 | 17 | Per Amundsen | |
63 | h2. String Comparison Operators |
||
64 | |||
65 | 45 | Mr. BS | |_.Syntax |_.Name |_.Result | |
66 | 17 | Per Amundsen | |=. %x isin %y |
67 | %x isincs %y |
||
68 | %x iswm %y |
||
69 | %x iswmcs %y |
||
70 | %x isnum |
||
71 | %x isnum N |
||
72 | %x isnum N- |
||
73 | %x isnum N-M |
||
74 | %x isletter |
||
75 | %x isletter N |
||
76 | %x isalnum |
||
77 | %x isalpha |
||
78 | %x islower |
||
79 | %x isupper |
||
80 | |^. Is In |
||
81 | Is In (case sensitive) |
||
82 | 58 | Per Amundsen | [[Scripting_Wildcards|Wildcard]] Matching |
83 | [[Scripting_Wildcards|Wildcard]] Matching (case sensitive) |
||
84 | 17 | Per Amundsen | Is Digit |
85 | Is Digit, Equal to |
||
86 | Is Digit, Greater than or equal to |
||
87 | Is Digit, in Range |
||
88 | Is a Letter |
||
89 | Is a Letter In A List |
||
90 | Alphanumeric Characters |
||
91 | Alphabetic Characters |
||
92 | All lower case letters |
||
93 | All upper case letters |
||
94 | |^. True, if %x is fully found inside %y. |
||
95 | True, if %x is fully found inside (case sensitive) %y. |
||
96 | 58 | Per Amundsen | True, if [[Scripting_Wildcards|wildcard]] string %x matches %y. |
97 | True, if [[Scripting_Wildcards|wildcard]] string %x matches (case sensitive) %y. |
||
98 | 17 | Per Amundsen | True, if %x is a number. |
99 | True, if %x is number N. |
||
100 | True, if %x is number N or greater. |
||
101 | True, if %x is a number between N and M (inclusively). |
||
102 | True, if %x is a letter. |
||
103 | True, if %x is a letter in a list of letters. |
||
104 | True, if %x contains only alphabetic or numeric characters. |
||
105 | True, if %x contains only alphabetic characters. |
||
106 | True, if %x contains only lower case letters. |
||
107 | True, if %x contains only upper case letters. |
||
108 | | |
||
109 | 19 | Per Amundsen | |
110 | 40 | Per Amundsen | h2. Lexicographical String Comparison Operators |
111 | 19 | Per Amundsen | |
112 | 45 | Mr. BS | |_.Syntax |_.Name |_.Result | |
113 | 22 | Per Amundsen | |=. <notextile>a == b</notextile> |
114 | <notextile >a === b</notextile> |
||
115 | <notextile >str1 == str2</notextile> |
||
116 | <notextile >str1 === str2</notextile> |
||
117 | 19 | Per Amundsen | a < b |
118 | a > b |
||
119 | str1 < str2 |
||
120 | 1 | Per Amundsen | str1 > str2 |
121 | |^. Case insensitive character comparison |
||
122 | Case sensitive character comparison |
||
123 | Case insensitive String comparison |
||
124 | Case sensitive String comparison |
||
125 | 25 | Per Amundsen | Lexicographically Less Than |
126 | 1 | Per Amundsen | Lexicographically Greater Than |
127 | Lexicographically Less Than |
||
128 | Lexicographically Greater Than |
||
129 | |^. True, if character a is equal to character b, case insensitive. |
||
130 | True, if character a is equal to character b, case sensitive. |
||
131 | True, if str1 equals str2 in a case insensitive manner. |
||
132 | True, if str1 equals str2 in a case sensitive manner. |
||
133 | True, if the [[$asc]](a) comes before [[$asc]](b) |
||
134 | True, if the [[$asc]](a) comes after [[$asc]](b) |
||
135 | True, if str1 comes before str2 |
||
136 | True, if str1 comes after str2 |
||
137 | 23 | Per Amundsen | | |
138 | |||
139 | h2. Channel-related Operators |
||
140 | |||
141 | 45 | Mr. BS | |_.Syntax |_.Name |_.Result | |
142 | 23 | Per Amundsen | |=. %x ison %y |
143 | 1 | Per Amundsen | %x isop %y |
144 | %x ishop %y |
||
145 | 46 | Per Amundsen | %x ishelp %y |
146 | 43 | Per Amundsen | *%x isadmin %y* |
147 | 35 | Per Amundsen | *%x isowner %y* |
148 | 1 | Per Amundsen | %x isvoice %y |
149 | 59 | Per Amundsen | %x isvo %y |
150 | 1 | Per Amundsen | %x isreg %y |
151 | 23 | Per Amundsen | %x ischan |
152 | %x isban %y |
||
153 | 41 | Per Amundsen | %x isinvite %y |
154 | %x isexcept %y |
||
155 | 50 | Per Amundsen | *%x isquiet %y* |
156 | 23 | Per Amundsen | |^. Is On |
157 | Is an Operator |
||
158 | Is a Halfop |
||
159 | 47 | Per Amundsen | Is a Halfop |
160 | 23 | Per Amundsen | is a Protected Operator |
161 | Is a Channel Owner |
||
162 | Is a Voice |
||
163 | 59 | Per Amundsen | Is a Voice |
164 | 23 | Per Amundsen | Is a Regular |
165 | 1 | Per Amundsen | Is a Channel |
166 | 49 | Per Amundsen | Is a Ban |
167 | 23 | Per Amundsen | Ia a Invite |
168 | 1 | Per Amundsen | Is a Except |
169 | 49 | Per Amundsen | Is a Quiet |
170 | 24 | Per Amundsen | |^. True, if nick %x is on channel %y. |
171 | 23 | Per Amundsen | True, if nick %x is an operators on channel %y. |
172 | 46 | Per Amundsen | True, if nick %x is a halfop on channel %y. |
173 | 1 | Per Amundsen | True, if nick %x is a halfop on channel %y. |
174 | 43 | Per Amundsen | True, if nick %x is a protected/admin operator on channel %y. |
175 | 23 | Per Amundsen | True, if nick %x is a channel owner on channel %y. |
176 | 59 | Per Amundsen | True, if nick %x is a voice on channel %y. |
177 | 23 | Per Amundsen | True, if nick %x is a voice on channel %y. |
178 | True, if nick %x is a regular user on channel %y. |
||
179 | True, if channel %x is a channel you are on. |
||
180 | True, if ban address %x is a ban on channel %y. (taken from IBL) |
||
181 | True, if invite address %x is a invite on channel %y. (taken from IIL) |
||
182 | 1 | Per Amundsen | True, if except address %x is a except on channel %y. (taken from IEL) |
183 | 49 | Per Amundsen | True, if quiet address %x is a quiet on channel %y. (taken from IQL) |
184 | 19 | Per Amundsen | | |
185 | 28 | Per Amundsen | |
186 | h2. List-related Operators |
||
187 | |||
188 | 45 | Mr. BS | |_.Syntax |_.Name |_.Result | |
189 | 28 | Per Amundsen | |=. %x isaop |
190 | %x isaop %y |
||
191 | %x isavoice |
||
192 | %x isavoice %y |
||
193 | 54 | Per Amundsen | %x isprotect |
194 | %x isprotect %y |
||
195 | 50 | Per Amundsen | %x isignore |
196 | 28 | Per Amundsen | %x isignore %y |
197 | %x isnotify |
||
198 | 52 | Per Amundsen | |^. In Auto Op List |
199 | In Auto Op List |
||
200 | In Auto Voice List |
||
201 | In Auto Voice List |
||
202 | 54 | Per Amundsen | In Auto Protect List |
203 | In Auto Protect List |
||
204 | 28 | Per Amundsen | In Ignore List |
205 | In Ignore List For Type |
||
206 | 48 | Per Amundsen | In Notify List |
207 | 56 | Per Amundsen | |^. True, if host %x is in the auto-op list. |
208 | 57 | Per Amundsen | True, if host %x is in the auto-op list for the channel %y. |
209 | True, if host %x is in the auto-voice list. |
||
210 | True, if host %x is in the auto-voice list for the channel %y. |
||
211 | TODO (always returns False) |
||
212 | 55 | Per Amundsen | TODO (always returns False) |
213 | 48 | Per Amundsen | True, if host %x is in the Ignore list. |
214 | True, if host %x is in the Ignore list for type %y. |
||
215 | True, if nick %x is in the Notify list. |
||
216 | 1 | Per Amundsen | | |
217 | 28 | Per Amundsen | |
218 | h2. Other Operators |
||
219 | |||
220 | 45 | Mr. BS | |_.Syntax |_.Name |_.Result | |
221 | 35 | Per Amundsen | |=. *%x isurl* |
222 | 28 | Per Amundsen | |^. Is a url |
223 | |^. True, if %x is a url. |
||
224 | | |