; text received
on *:text:*:#: {
; nick is op
if ($nick isop $chan) {
; check for text matching "<EmpireName> <SectorName> <Asteroids> <Land> <Networth> <?Alliance?>" and capture values "Asteroids" and "Land"
; text format: <word> <(digit:digit)> <number with possible commas> <number with possible commas> <number with at least one comma> <possibly some text in square brackets>
if ($regex($1-,/^\S+ \(\d:\d\) ([\d\54]+) ([\d\54]+) [\d\54]+\54\d+(?:\s\[.+\])?$/)) {
; set the captured values "Asteroids" and "Land", with the possible commas removed, into variables
var %r = $remove($regml(1),$chr(44)), %l = $remove($regml(2),$chr(44)), %r.hits = 0, %l.hits = 0
; calculate asteroids remaining per hit - count required no. of hits
while (%r > 0) {
dec %r $iif((%r > 100),$calc($v1 * 0.1),10)
inc %r.hits
}
; calculate land remaining per hit - count required no. of hits
while (%l > 0) {
dec %l $iif((%l > 200),$calc($v1 * 0.1),20)
inc %l.hits
}
; output result to the channel
msg $chan %r.hits hits to Roid kill; %l.hits hits to Land kill
}
}
}