Pyrorex wrote:
It's a couple of scripts. There's his calc script, and his cideroll script. Also, Girf forgot to include me.
Well yes except for the minor problem that you fail horribly.
Anyways, Whitty, the calc script is fairly simple.
Code:
on *:TEXT:!set *:#drlchat: {
if ( $$2 == n ) { /set %n $3 }
if ( $$2 == x ) { /set %x $3 }
if ( $$2 == y ) { /set %y $3 }
if ( $$2 == z ) { /set %z $3 }
if ( $$2 == m ) { /set %m $3 }
if ( $$2 == m2 ) { /set %m2 $3 }
else { /set $$2 $3- }
}
Basically, this is a variable set, for the calc script.
if ( $$2 == <variable> ) { /set %<variable> $3 }
Just means that if the second word after !set is n, x, y, z, m, or m2, it will set that variable as the third word after !set.
The else means that if $2, or the second word after !set, is not specified, it sets whatever is in there as everything from the third word onward ( $3- ).
Code:
on *:TEXT:!variables:#drlchat: {
/msg $chan n: %n - x: %x - y: %y - z: %z - m: %m - m2: %m2
}
If someone types !variables in #drlchat, it will display:
n: <valueofn> - x: <valueofx> etc
Code:
on *:TEXT:!clearvar*:#drlchat: {
if ( $2 == n ) { /set %n 0 }
if ( $2 == x ) { /set %x 0 }
if ( $2 == y ) { /set %y 0 }
if ( $2 == z ) { /set %z 0 }
if ( $2 == m ) { /set %m 0 }
if ( $2 == m2 ) { /set %m2 0 }
else { /set %n 0 | /set %x 0 | /set %y 0 | /set %z 0 | /set %m 0 | /set %m2 0 }
}
If someone types !clearvar, it checks if you asked it to clear a specific variable, or else clears all of them at once.
Code:
on *:TEXT:!calc *:#drlchat: {
/msg $chan $calc($2-)
}
If someone types !calc, it'll "calc"ulate everything from the second word onward.
!help is fairly self explanatory. When someone types !help, it /msgs the channel the help text.
Code:
on *:TEXT:!roll *:#drlchat: {
set %target $2
set %count 0
:next
if ( %count < %target ) && ( %target <= 10 ) {
if ( $3 >= 256 ) { /msg $chan You rolled: $rand(1,256) | inc %count | goto next }
else { /msg $chan You rolled: $rand(1,$3) | inc %count | goto next }
}
else { /set %target 0 | goto done }
:done
}
This is a fun one.
When someone types !roll, it does several things.
First, it sets the %target, or number of times to roll, to whatever the second word after !roll was.
It also makes sure that the %count variable is 0.
Then, :next, which is a part of the goto loop, is defined.
First, it checks whether %count is less than or equal to %target. So, if it's rolled less dice than it's been asked to, it will increment the %count variable, /msg the channel a random number from 1 to whatever the third word after !roll was, and then repeat the check, using the goto next.
If %count is NOT less than or equal to target, it will go to the else statement, which resets %target and cancels the goto loop process.
Now, there's some anti-spam features in there too, but they're fairly self explanatory.