Help - Hot Potato Explodes Prematurely. - 21/02/06 03:41 AM
Well see, I've been working on a Hot Potato script for a while now. I've got it up and working, except for one problem - sometimes it explodes with the 'Everybody is idle!' message, even when everybody is not over the designated idle time (60 secs). Could someone take a look at it and tell me what I'm doing wrong?
Code:
; Hot Potato script. ; xx Written by Kentoukurai. xx on *:start:{ hmake hphof hload hphof hphof.txt } on *:text:!hotpotato*:#:{ if (!$hget(hotpotato)) { hpstart $chan $nick } } on *:text:!pass*:#:{ if ($chan == $hget(hotpotato, channel)) { hppass $nick $iif($2, $2) } } alias hpstart { if ($hget(hotpotato)) { hfree hotpotato } hmake hotpotato 100 hadd hotpotato username $2 msg $1 Hot Potato has been enabled by $hget(hotpotato, username) $+ ! Game starts in 10 seconds, get ready! .timer 1 10 hprlstrt $1 } alias hprlstrt { hadd hotpotato channel $1 .timer1 1 $rand(15, 60) hpend msg $hget(hotpotato, channel) $+ $hget(hotpotato, username) $+ has the potato! Type !pass to pass! } alias hppass { if ($1 == $hget(hotpotato, username)) { hadd hotpotato users $nick($hget(hotpotato, channel), 0) unset %hpi :passtorand if (!%hpi) { %hpi = 0 } inc %hpi if (%hpi >= $hget(hotpotato, users)) { unset %hpi hpend x .timer1 off } else { goto isidle } :isidle %hpnktmp = $nick($hget(hotpotato, channel), $rand(1, $hget(hotpotato, users))) if ($nick($hget(hotpotato, channel), %hpnktmp).idle > 60) { goto passtorand } elseif (%hpnktmp == $me) || (%hpnktmp == $1) { goto passtorand } else { hdel hotpotato username hadd hotpotato username %hpnktmp msg $hget(hotpotato, channel) $+ $1 $+ passed the potato to $+ $hget(hotpotato, username) $+ ! } } } alias hpend { %hplosar = $hget(hotpotato, username) hadd hphof %hplosar $calc($hget(hphof, %hplosar) + 1) if ($1 == x) { msg $hget(hotpotato, channel) Everybody is idle! } msg $hget(hotpotato, channel) The potato exploded on $+ %hplosar $+ ! %hplosar has been hit with the potato $+ $hget(hphof, %hplosar) time $+ $iif($hget(hphof, %hplosar) != 1, s) $+ ! hfree hotpotato hsave hphof hphof.txt }