alias comma {
var %a, %b = $regsub($ticks,$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a)
return %a
}
on *:text:!spy*:#:{
if ($1 == !spyadd) {
var %nick = $2, %stats = $3-, %i = 1
var %regex = /((?:spy )?(?:of|de)fen(?:c|s)e):?\s+(\d{1,3}(?:,\d\d\d)*(?:\s|$)|\d+)/gi
if ($regex(%stats,%regex)) && ($regml(0) == 8) {
while ($regml(%i)) {
var %stat = $replace($v1,ce,se,$chr(32),.), %value = $comma($regml($calc(%i + 1)))
writeini $scriptdirspy.ini %nick %stat %value
inc %i 2
}
writeini $scriptdirspy.ini %nick edited $date
msg $chan %nick $+ 's 3stats added to the database!
}
else {
msg $chan 4Sorry something is missing, the proper format is "!spyadd <nick> speed: $chr(35) strength: $chr(35) defense: $chr(35) dexterity: $chr(35) level: $chr(35) total: $chr(35) $+ " the order of the four stats is not important.
}
}
elseif ($1 == !spy) {
var %nick = $2
if ($ini($scriptdirspy.ini,%nick)) {
msg $chan 6 $+ %nick $+ 's stats are:
msg $chan 6Offense: $readini($scriptdirspy.ini,n,%nick,offense)
msg $chan 6Defense: $readini($scriptdirspy.ini,n,%nick,defense)
msg $chan 6Spy Offense: $readini($scriptdirspy.ini,n,%nick,spy.offense)
msg $chan 6Spy Defense: $readini($scriptdirspy.ini,n,%nick,spy.defense)
}
elseif (%nick) msg $chan 4sorry %nick is not in the database!
else msg $chan 4You need a nick for me to look up anything silly.
}
}