Auction bot starts auction without asking question - 28/08/05 01:11 PM
Code:
alias sepnum { var %n = ^(\d*)(\d{3})$, %r = $1 while ($regex(%r,%n)) { var %w = $regml(2), %r = $regml(1) var %k = $+(%w,$chr(44),%k) dec %x 3 } return $left($iif(%r,$+(%r,$chr(44),%k),%k),-1) } on *:exit:{ .hsave -o Auction Auction.hsh } on *:disconnect:{ .hsave -o Auction Auction.hsh } on *:start:{ .strip +burc if !$hget(Auction) { .hmake Auction 100 } if $exists(Auction.hsh) { .hload Auction Auction.hsh } } on *:load:{ .strip +burc if !$hget(Auction) { .hmake Auction 100 } if $exists(Auction.hsh) { .hload Auction Auction.hsh } } on *:text:!help:*:{ .play $nick AB_help.txt } on *:text:!rules:*:{ .play $nick AB_help.txt } on !*:join:#:{ .hinc -m Auction $+(Visit.,$address) describe # 5,0Welcomes4 $nick 5to $chan for the $ord($sepnum($hget(Auction,$+(Visit.,$address)))) time } on *:text:!sellme:#:{ if ($right($nick,3) == -pm) { .msg $nick Remove the -pm from the end of your nick before putting yourself up for sale } elseif ($nick isvoice $chan) { .msg $nick You're already up on the auction block } elseif (!$hget(qvars,$address)) { hadd -m qvars $+(checkq,.,$nick) $chan checkq $address $nick $chan } } on *:text:*:#:{ if ($remove($1,$chr(44)) isnum) && ($nick($chan,1,v)) { if ($nick isvoice $chan) { describe # laughs as $nick tries to bid on themselves } elseif (!%bid) || ($remove($1,$chr(44) > %bid) { set %bid $remove($1,$chr(44)) set %bidnick $nick describe # I now have $sepnum($1) for a bid on $nick($chan,1,v) describe # Do I hear a bid of $sepnum($calc($remove(%bid,$chr(44)) + 10)) $+ ? } else { describe # Sorry $nick $+ $chr(44) but your bid must be greater than $sepnum(%bid) } } } on *:text:*:?: { if ( $hget(qvars,$address) ) { if ($v1 == $lines(questions.txt)) && ($remove($1,$chr(44)) !isnum) { .msg $nick Sorry, but the answer to this question must be a number } else { .hadd -m Auction $+($v1,$address) $1- checkq $address $nick $hget(qvars,$+(checkq,.,$nick)) } } } alias checkq { while ($hget(qvars,$1) <= $lines(questions.txt)) && $hget(Auction,$+($hget(qvars,$1),$address)) { hinc -m qvars $1 } if ( $read(questions.txt,$hget(qvars,$1)) ) { if (!$hget(Auction,$+($hget(qvars,$1),$address))) .msg $nick $read(questions.txt,$hget(qvars,$1)) } else { hdel qvars $1 mode $3 +v $2 describe $3 leads $2 up to the auction block, ensuring that A/all have a good view describe $3 smiles as He reads off $2 $+ 's description as $hget(Auction,$+(1,$1)) describe $3 states that $2 has indicated their likes as being $hget(Auction,$+(2,$1)) describe $3 notes that $2 has the following limits: $hget(Auction,$+(3,$1)) describe $3 looks at the clock, and says that the auction for $2 will end in 2 minutes hdel qvars $+(checkq,.,$2) $+(.timer,$2) 1 120 { end_auction $1 $2 $3 } } } alias end_auction { .mode $3 -v $2 if !%bid { describe $3 apologizes to $2 $+ . I'm sorry, but there weren't any bids. Please try again later. } elseif %bid < $hget(Auction,$+(4,$1)) { describe $3 Sorry $2 $+ . The highest recorded bid was less than you requested. Please try again later. } else { describe $3 escorts $2 to %bidnick $+ . Congratulations...You have won .msg $2 Please add -pm to the end of your nick if you're going to stay in the room .msg %bidnick Please add -pm to the end of your nick if you're going to stay in the room } unset %bid* }