(Basic info of what is best) |
m |
||
Line 7: | Line 7: | ||
== Custom alias bypassing == | == Custom alias bypassing == | ||
+ | |||
When calling any form of command or identifer mIRC attempts to find a scripted version prior to looking for native functionality. This can be bypassed by prefixing commands with ! and by inserting a ~ after the $ of identifers | When calling any form of command or identifer mIRC attempts to find a scripted version prior to looking for native functionality. This can be bypassed by prefixing commands with ! and by inserting a ~ after the $ of identifers | ||
Line 12: | Line 13: | ||
== Conditional Syntax == | == Conditional Syntax == | ||
Best to worst: | Best to worst: | ||
− | if (condition) command | + | <syntaxhighlight lang="mirc">if (condition) command |
if condition { command } | if condition { command } | ||
− | if (condition) { command } | + | if (condition) { command }</syntaxhighlight> |
Line 21: | Line 22: | ||
Best to worst: | Best to worst: | ||
− | var %result = condition_false_value | + | <syntaxhighlight lang="mirc">var %result = condition_false_value |
if (condition) %result = condition_true_value | if (condition) %result = condition_true_value | ||
Line 27: | Line 28: | ||
else %result = condition_false_value | else %result = condition_false_value | ||
− | %result = $iif(condition, condition_true_value, condition_false_value) | + | %result = $iif(condition, condition_true_value, condition_false_value)</syntaxhighlight> |
Line 36: | Line 37: | ||
== []'s vs $() vs $eval == | == []'s vs $() vs $eval == | ||
Best to worst: | Best to worst: | ||
− | [ eval_statement ] | + | <syntaxhighlight lang="mirc">[ eval_statement ] |
$(eval_statement, 2) | $(eval_statement, 2) | ||
− | $eval(eval_statement, 2) | + | $eval(eval_statement, 2)</syntaxhighlight> |
Revision as of 20:57, 15 December 2015
mIRC is not considered a fast language and, more often than not, the easiest implementation is not the fastest.
The following tips will help to increase the execution speed of a script. Most will have a very marginal speed advantage and, as such, may not be worth the hassle outside of long-running script blocks such as loops.
Contents
Custom alias bypassing
When calling any form of command or identifer mIRC attempts to find a scripted version prior to looking for native functionality. This can be bypassed by prefixing commands with ! and by inserting a ~ after the $ of identifers
Conditional Syntax
Best to worst:
if (condition) command if condition { command } if (condition) { command }
if-else vs $iif()
$iif() is much slower than using an if-else statement. When $iif() is evaluated it is first rearranged into an if-else statement and the resulting if-else statement is parsed.
Best to worst:
var %result = condition_false_value if (condition) %result = condition_true_value if (condition) %result = condition_true_value else %result = condition_false_value %result = $iif(condition, condition_true_value, condition_false_value)
/tokenize & $n vs $gettok()
For successive calls against the same data, it is faster to use /tokenize and $n over $gettok().
[]'s vs $() vs $eval
Best to worst:
[ eval_statement ] $(eval_statement, 2) $eval(eval_statement, 2)