Scripting Operators » History » Version 55
Per Amundsen, 06/08/2017 06:02 AM
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 | Wildcard Matching |
||
83 | Wildcard Matching (case sensitive) |
||
84 | 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 | True, if wildcard string %x matches %y. |
||
97 | True, if wildcard string %x matches (case sensitive) %y. |
||
98 | 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 | %x isreg %y |
||
150 | 23 | Per Amundsen | %x ischan |
151 | %x isban %y |
||
152 | 41 | Per Amundsen | %x isinvite %y |
153 | %x isexcept %y |
||
154 | 50 | Per Amundsen | *%x isquiet %y* |
155 | 23 | Per Amundsen | |^. Is On |
156 | Is an Operator |
||
157 | Is a Halfop |
||
158 | 47 | Per Amundsen | Is a Halfop |
159 | 23 | Per Amundsen | is a Protected Operator |
160 | Is a Channel Owner |
||
161 | Is a Voice |
||
162 | Is a Regular |
||
163 | 1 | Per Amundsen | Is a Channel |
164 | 49 | Per Amundsen | Is a Ban |
165 | 23 | Per Amundsen | Ia a Invite |
166 | 1 | Per Amundsen | Is a Except |
167 | 49 | Per Amundsen | Is a Quiet |
168 | 24 | Per Amundsen | |^. True, if nick %x is on channel %y. |
169 | 23 | Per Amundsen | True, if nick %x is an operators on channel %y. |
170 | 46 | Per Amundsen | True, if nick %x is a halfop on channel %y. |
171 | 1 | Per Amundsen | True, if nick %x is a halfop on channel %y. |
172 | 43 | Per Amundsen | True, if nick %x is a protected/admin operator on channel %y. |
173 | 23 | Per Amundsen | True, if nick %x is a channel owner on channel %y. |
174 | True, if nick %x is a voice on channel %y. |
||
175 | True, if nick %x is a regular user on channel %y. |
||
176 | True, if channel %x is a channel you are on. |
||
177 | True, if ban address %x is a ban on channel %y. (taken from IBL) |
||
178 | True, if invite address %x is a invite on channel %y. (taken from IIL) |
||
179 | 1 | Per Amundsen | True, if except address %x is a except on channel %y. (taken from IEL) |
180 | 49 | Per Amundsen | True, if quiet address %x is a quiet on channel %y. (taken from IQL) |
181 | 19 | Per Amundsen | | |
182 | 28 | Per Amundsen | |
183 | h2. List-related Operators |
||
184 | |||
185 | 45 | Mr. BS | |_.Syntax |_.Name |_.Result | |
186 | 28 | Per Amundsen | |=. %x isaop |
187 | %x isaop %y |
||
188 | %x isavoice |
||
189 | %x isavoice %y |
||
190 | 54 | Per Amundsen | %x isprotect |
191 | %x isprotect %y |
||
192 | 50 | Per Amundsen | %x isignore |
193 | 28 | Per Amundsen | %x isignore %y |
194 | %x isnotify |
||
195 | 52 | Per Amundsen | |^. In Auto Op List |
196 | In Auto Op List |
||
197 | In Auto Voice List |
||
198 | In Auto Voice List |
||
199 | 54 | Per Amundsen | In Auto Protect List |
200 | In Auto Protect List |
||
201 | 28 | Per Amundsen | In Ignore List |
202 | In Ignore List For Type |
||
203 | 48 | Per Amundsen | In Notify List |
204 | 55 | Per Amundsen | |^. TODO (always returns False) |
205 | TODO (always returns False) |
||
206 | TODO (always returns False) |
||
207 | TODO (always returns False) |
||
208 | TODO (always returns False) |
||
209 | TODO (always returns False) |
||
210 | 48 | Per Amundsen | True, if host %x is in the Ignore list. |
211 | True, if host %x is in the Ignore list for type %y. |
||
212 | True, if nick %x is in the Notify list. |
||
213 | 1 | Per Amundsen | | |
214 | 28 | Per Amundsen | |
215 | h2. Other Operators |
||
216 | |||
217 | 45 | Mr. BS | |_.Syntax |_.Name |_.Result | |
218 | 35 | Per Amundsen | |=. *%x isurl* |
219 | 28 | Per Amundsen | |^. Is a url |
220 | |^. True, if %x is a url. |
||
221 | | |