registerSlashCommand('setvar',(args,value)=>setLocalVariable(args.key||args.name,value,args),[],'<span class="monospace">key=varname index=listIndex (value)</span> – set a local variable value and pass it down the pipe, index is optional, e.g. <tt>/setvar key=color green</tt>',true,true);
registerSlashCommand('getvar',(args,value)=>getLocalVariable(value,args),[],'<span class="monospace">index=listIndex (key)</span> – get a local variable value and pass it down the pipe, index is optional, e.g. <tt>/getvar height</tt> or <tt>/getvar index=3 costumes</tt>',true,true);
registerSlashCommand('addvar',(args,value)=>addLocalVariable(args.key||args.name,value),[],'<span class="monospace">key=varname (increment)</span> – add a value to a local variable and pass the result down the pipe, e.g. <tt>/addvar score 10</tt>',true,true);
registerSlashCommand('setglobalvar',(args,value)=>setGlobalVariable(args.key||args.name,value,args),[],'<span class="monospace">key=varname index=listIndex (value)</span> – set a global variable value and pass it down the pipe, index is optional, e.g. <tt>/setglobalvar key=color green</tt>',true,true);
registerSlashCommand('getglobalvar',(args,value)=>getGlobalVariable(value,args),[],'<span class="monospace">index=listIndex (key)</span> – get a global variable value and pass it down the pipe, index is optional, e.g. <tt>/getglobalvar height</tt> or <tt>/getglobalvar index=3 costumes</tt>',true,true);
registerSlashCommand('addglobalvar',(args,value)=>addGlobalVariable(args.key||args.name,value),[],'<span class="monospace">key=varname (increment)</span> – add a value to a global variable and pass the result down the pipe, e.g. <tt>/addglobalvar score 10</tt>',true,true);
registerSlashCommand('incvar',(_,value)=>incrementLocalVariable(value),[],'<span class="monospace">(key)</span> – increment a local variable by 1 and pass the result down the pipe, e.g. <tt>/incvar score</tt>',true,true);
registerSlashCommand('decvar',(_,value)=>decrementLocalVariable(value),[],'<span class="monospace">(key)</span> – decrement a local variable by 1 and pass the result down the pipe, e.g. <tt>/decvar score</tt>',true,true);
registerSlashCommand('incglobalvar',(_,value)=>incrementGlobalVariable(value),[],'<span class="monospace">(key)</span> – increment a global variable by 1 and pass the result down the pipe, e.g. <tt>/incglobalvar score</tt>',true,true);
registerSlashCommand('decglobalvar',(_,value)=>decrementGlobalVariable(value),[],'<span class="monospace">(key)</span> – decrement a global variable by 1 and pass the result down the pipe, e.g. <tt>/decglobalvar score</tt>',true,true);
registerSlashCommand('if',ifCallback,[],'<span class="monospace">left=varname1 right=varname2 rule=comparison else="(alt.command)" "(command)"</span> – compare the value of the left operand "a" with the value of the right operand "b", and if the condition yields true, then execute any valid slash command enclosed in quotes and pass the result of the command execution down the pipe. Numeric values and string literals for left and right operands supported. Available rules: gt => a > b, gte => a >= b, lt => a < b, lte => a <= b, eq => a == b, neq => a != b, not => !a, in (strings) => a includes b, nin (strings) => a not includes b, e.g. <tt>/if left=score right=10 rule=gte "/speak You win"</tt> triggers a /speak command if the value of "score" is greater or equals 10.',true,true);
registerSlashCommand('while',whileCallback,[],'<span class="monospace">left=varname1 right=varname2 rule=comparison "(command)"</span> – compare the value of the left operand "a" with the value of the right operand "b", and if the condition yields true, then execute any valid slash command enclosed in quotes. Numeric values and string literals for left and right operands supported. Available rules: gt => a > b, gte => a >= b, lt => a < b, lte => a <= b, eq => a == b, neq => a != b, not => !a, in (strings) => a includes b, nin (strings) => a not includes b, e.g. <tt>/setvar key=i 0 | /while left=i right=10 rule=let "/addvar key=i 1"</tt> adds 1 to the value of "i" until it reaches 10. Loops are limited to 100 iterations by default, pass guard=off to disable.',true,true);
registerSlashCommand('times',(args,value)=>timesCallback(args,value),[],'<span class="monospace">(repeats) "(command)"</span> – execute any valid slash command enclosed in quotes <tt>repeats</tt> number of times, e.g. <tt>/setvar key=i 1 | /times 5 "/addvar key=i 1"</tt> adds 1 to the value of "i" 5 times. <tt>{{timesIndex}}</tt> is replaced with the iteration number (zero-based), e.g. <tt>/times 4 "/echo {{timesIndex}}"</tt> echos the numbers 0 through 4. Loops are limited to 100 iterations by default, pass guard=off to disable.',true,true);
registerSlashCommand('flushvar',(_,value)=>deleteLocalVariable(value),[],'<span class="monospace">(key)</span> – delete a local variable, e.g. <tt>/flushvar score</tt>',true,true);
registerSlashCommand('flushglobalvar',(_,value)=>deleteGlobalVariable(value),[],'<span class="monospace">(key)</span> – delete a global variable, e.g. <tt>/flushglobalvar score</tt>',true,true);
registerSlashCommand('add',(_,value)=>addValuesCallback(value),[],'<span class="monospace">(a b c d)</span> – performs an addition of the set of values and passes the result down the pipe, can use variable names, e.g. <tt>/add 10 i 30 j</tt>',true,true);
registerSlashCommand('mul',(_,value)=>mulValuesCallback(value),[],'<span class="monospace">(a b c d)</span> – performs a multiplication of the set of values and passes the result down the pipe, can use variable names, e.g. <tt>/mul 10 i 30 j</tt>',true,true);
registerSlashCommand('max',(_,value)=>maxValuesCallback(value),[],'<span class="monospace">(a b c d)</span> – returns the maximum value of the set of values and passes the result down the pipe, can use variable names, e.g. <tt>/max 10 i 30 j</tt>',true,true);
registerSlashCommand('min',(_,value)=>minValuesCallback(value),[],'<span class="monospace">(a b c d)</span> – returns the minimum value of the set of values and passes the result down the pipe, can use variable names, e.g. <tt>/min 10 i 30 j</tt>',true,true);
registerSlashCommand('sub',(_,value)=>subValuesCallback(value),[],'<span class="monospace">(a b)</span> – performs a subtraction of two values and passes the result down the pipe, can use variable names, e.g. <tt>/sub i 5</tt>',true,true);
registerSlashCommand('div',(_,value)=>divValuesCallback(value),[],'<span class="monospace">(a b)</span> – performs a division of two values and passes the result down the pipe, can use variable names, e.g. <tt>/div 10 i</tt>',true,true);
registerSlashCommand('mod',(_,value)=>modValuesCallback(value),[],'<span class="monospace">(a b)</span> – performs a modulo operation of two values and passes the result down the pipe, can use variable names, e.g. <tt>/mod i 2</tt>',true,true);
registerSlashCommand('pow',(_,value)=>powValuesCallback(value),[],'<span class="monospace">(a b)</span> – performs a power operation of two values and passes the result down the pipe, can use variable names, e.g. <tt>/pow i 2</tt>',true,true);
registerSlashCommand('sin',(_,value)=>sinValuesCallback(value),[],'<span class="monospace">(a)</span> – performs a sine operation of a value and passes the result down the pipe, can use variable names, e.g. <tt>/sin i</tt>',true,true);
registerSlashCommand('cos',(_,value)=>cosValuesCallback(value),[],'<span class="monospace">(a)</span> – performs a cosine operation of a value and passes the result down the pipe, can use variable names, e.g. <tt>/cos i</tt>',true,true);
registerSlashCommand('log',(_,value)=>logValuesCallback(value),[],'<span class="monospace">(a)</span> – performs a logarithm operation of a value and passes the result down the pipe, can use variable names, e.g. <tt>/log i</tt>',true,true);
registerSlashCommand('abs',(_,value)=>absValuesCallback(value),[],'<span class="monospace">(a)</span> – performs an absolute value operation of a value and passes the result down the pipe, can use variable names, e.g. <tt>/abs i</tt>',true,true);
registerSlashCommand('sqrt',(_,value)=>sqrtValuesCallback(value),[],'<span class="monospace">(a)</span> – performs a square root operation of a value and passes the result down the pipe, can use variable names, e.g. <tt>/sqrt i</tt>',true,true);
registerSlashCommand('round',(_,value)=>roundValuesCallback(value),[],'<span class="monospace">(a)</span> – rounds a value and passes the result down the pipe, can use variable names, e.g. <tt>/round i</tt>',true,true);
registerSlashCommand('len',(_,value)=>lenValuesCallback(value),[],'<span class="monospace">(a)</span> – gets the length of a value and passes the result down the pipe, can use variable names, e.g. <tt>/len i</tt>',true,true);
registerSlashCommand('rand',(args,value)=>randValuesCallback(Number(args.from??0),Number(args.to??(value.length?value:1)),args),[],'<span class="monospace">(from=number=0 to=number=1 round=round|ceil|floor)</span> – returns a random number between from and to, e.g. <tt>/rand</tt> or <tt>/rand 10</tt> or <tt>/rand from=5 to=10</tt>',true,true);