|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
The problem appears in the section that is marked in red. For some reason that section keeps going into an endless loop. Any suggestions? on @*:text:!abductme:#:{
.msg $nick You will now be asked up to 4 questions
.msg $nick You will have one minute to answer each, so please don't waste time
describe # starts interrogating $nick
.enable #abduct
:desc
if !$hget(AS,$+(Desc.,$address)) {
var %entry = Desc
.msg $nick What do you look like? (Description)
.timer $+ $nick 1 60 goto desc
}
:limits
if !$hget(AS,$+(Limits.,$address)) {
var %entry = Limits
.msg $nick Anything you won't do? (Limits)
.timer $+ $nick 1 60 goto limits
}
:likes
if !$hget(AS,$+(Likes.,$address)) {
var %entry = Likes
.msg $nick What gets you going? (Likes)
.timer $+ $nick 1 60 goto likes
}
[color:red] :pref
if !$hget(AS,$+(Pref.,$address)) {
var %entry = Pref
.msg $nick Need a Dom, Domme, or don't you care (Dom/me)
.timer $+ $nick 1 60 goto pref
}
if $hget(AS,$+(Pref.,$address)) == Dom goto next
elseif $hget(AS,$+(Pref.,$address)) == Domme goto next
elseif $hget(AS,$+(Pref.,$address)) == Dom/me goto next
else goto pref
[/color]
:next
.disable #abduct
.mode # +v $nick
describe # $nick is now available for abduction
describe # Their description is $hget(AS,$+(Desc.,$address))
describe # Their likes are $hget(AS,$+(Likes.,$address))
describe # Their limits are $hget(AS,$+(Limits.,$address))
describe # Their preference is $hget(AS,$+(Pref.,$address))
if $hget(AS,$+(Position,0)) > 1 {
while %oldpos == %newpos { set %newpos $rand(1,$hget(AS,$+(Position,0))) }
.timer 1 13 describe # Slaves $nick $hget(AS,$+(Position,%newpos))
set %oldpos %newpos
}
elseif $hget(AS,$+(Position,0)) { .timer 1 13 describe # $nick $hget(AS,$+(Position,1)) }
}
#abduct off
on *:text:*:?:{
hadd -m AS $+(%entry,.,$address) $1-
}
#abduct end
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
:pref
if !$hget(AS,$+(Pref.,$address)) {
var %entry = Pref
.msg $nick Need a Dom, Domme, or don't you care (Dom/me)
.timer $+ $nick 1 60 goto pref
}
if $hget(AS,$+(Pref.,$address)) == Dom goto next
elseif $hget(AS,$+(Pref.,$address)) == Domme goto next
elseif $hget(AS,$+(Pref.,$address)) == Dom/me goto next
else goto pref
Follow it through. It Starts at :PREF, now lets assume assume there is a "$hget(AS,$+(Pref.,$address))" so the IF is not done however the vale of "$hget(AS,$+(Pref.,$address))" is not DOM is not DOMME and is not DOM/ME so it reaches the GOTO PREF and repeats, nothing has changed so your in a endless loop. Your greater problem is your using illegal constructs .timer $+ $nick 1 60 goto anything results in /goto: 'anything' not found becuase its not in an alias or the event script anymore when the timer goes off Also not ensuring events are triggered by the relevent persons before assigning values to the AS hash table on *:text:*:?:{ hadd -m AS $+(%entry,.,$address) $1- }you keep altering %entry for the new one (not that it makes any diff since your been setting VAR %entry), but then accept anyone who pm's you as answering to that, what if it was someone else? I did a code rewrite for you, tried to keep as much of the original as possable. on @*:text:!abductme:#:{ abductme goto start $nick $address $chan }
;[color:blue]The !abductme event now calls an alias to do the work passing the needed parameters such as $nick $address $chan, since when a timer calls this later these identifiers no longer hold those values.[/color]
;
;$1 = goto
;$2 = location
;$3 = $nick
;$4 = $address
;$5 = $chan
alias abductme {
;echo -st ABDUCTME $1-
if (($1 != goto) || (!$5)) { return }
;[color:blue]First thing i do is make sure the values were passed ok else abort.[/color]
goto $2
;[color:blue]First 2 are the goto position, so make the jump.[/color]
:start
.msg $3 You will now be asked up to 4 questions
.msg $3 You will have one minute to answer each, so please don't waste time
describe $5 starts interrogating $3
:desc
if !$hget(AS,$+(Desc.,$4)) {
set -u70 $+(%,entry.,$4) Desc
;[color:blue]I use a address ($4) specific temp vars to hold what entry[/color]
set -u70 $+(%,after.,$4) Limits $3-
;[color:blue]I use a address ($4) specific temp vars to hold what to do after entry (see below on text)[/color]
.msg $3 What do you look like? (Description)
.timer $+ $3 1 60 abductme goto desc $3-
;[color:blue]I set the timer off but now it well call this alias using the goto position wanted and passing other parameters also needed[/color]
return
;[color:blue]Lastly i stop processing any more script[/color]
}
:limits
if !$hget(AS,$+(Limits.,$4)) {
set -u70 $+(%,entry.,$4) Limits
set -u70 $+(%,after.,$4) likes $3-
.msg $3 Anything you won't do? (Limits)
.timer $+ $3 1 60 abductme goto limits $3-
return
}
:likes
if !$hget(AS,$+(Likes.,$4)) {
set -u70 $+(%,entry.,$4) Likes
set -u70 $+(%,after.,$4) pref $3-
.msg $3 What gets you going? (Likes)
.timer $+ $3 1 60 abductme goto likes $3-
return
}
:pref
if !$hget(AS,$+(Pref.,$4)) {
set -u70 $+(%,entry.,$4) Pref
set -u70 $+(%,after.,$4) Pref $3-
;[color:blue]Notice this what to do after entry is not set to the :next postition but rather returns to :pref, this is so the below validation routine can process the entry[/color]
.msg $3 Need a Dom, Domme, or don't you care (Dom/me)
.timer $+ $3 1 60 abductme goto pref $3-
return
}
if ($hget(AS,$+(Pref.,$4)) != Dom) && ($hget(AS,$+(Pref.,$4)) != Domme) && ($hget(AS,$+(Pref.,$4)) != Dom/me) {
hadd -m AS $+(Pref.,$4)
goto pref
;[color:blue]If the entry was not DOM DOMME or DOM/ME then its invalid and we must delete it and loop back for another request of it[/color]
}
:next
mode $5 +v $3
describe $5 $3 is now available for abduction
describe $5 Their description is $hget(AS,$+(Desc.,$4))
describe $5 Their likes are $hget(AS,$+(Likes.,$4))
describe $5 Their limits are $hget(AS,$+(Limits.,$4))
describe $5 Their preference is $hget(AS,$+(Pref.,$4))
if $hget(AS,$+(Position,0)) > 1 {
while %oldpos == %newpos { set %newpos $rand(1,$hget(AS,$+(Position,0))) }
.timer 1 13 describe $5 Slaves $3 $hget(AS,$+(Position,%newpos))
set %oldpos %newpos
}
elseif $hget(AS,$+(Position,0)) { .timer 1 13 describe $5 $3 $hget(AS,$+(Position,1)) }
;[color:blue]I didnt alter any of this becuase I wasnt sure what it was ment to be doing anyway, I assumed you do :) [/color]
}
;
on *:text:*:?:{
if ($($+(%,entry.,$address),2)) {
;[color:blue]If there is a entry needed for this PMer then proceed into gathering it[/color]
hadd -m AS $+($($+(%,entry.,$address),2),.,$address) $1-
;[color:blue]store the entry[/color]
if ($($+(%,after.,$address),2)) {
;[color:blue]If I can find a what do do after entry then trigger it, this replaces the original timer that would loop back and call the same abduct code[/color]
;[color:blue]This also means that after answering a question there is not the remaineder of the 60 seconds to wait for the next question[/color]
.timer $+ $nick 1 1 abductme goto $($+(%,after.,$address),2)
;[color:blue]I replace the timer with a new one saying goto The after entery temp var[/color]
}
unset $+(%,entry.,$address)
unset $+(%,after.,$address)
;[color:blue]erase the temp vars created since there not needed now, and incase the user sends a second PM real quickly[/color]
}
}
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Appreciate your assistance, but was wondering where, in my original code you saw .timer $+ $nick 1 60 goto anything
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
No i mean anything at all here.
.timer $+ $nick 1 60 goto anything
when the timer goes off its NOT inside the original script that called it so it doesnt know any of the position marks so cant jump to them.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
oh..ok...that explains a lot of timer problems I've been having...aside from the one's that you've helped me with here, I've managed to find other ways around them.
|
|
|
|
Joined: Apr 2005
Posts: 4
Self-satisified door
|
Self-satisified door
Joined: Apr 2005
Posts: 4 |
I have never seen a timer used on a /goto command. But if mIRC supports it and it is working you will still have another problem! The script will continue beyond all /timer commands once the !abductme command is typed, then the script will be executed again with the /goto command. To make this work, you will need a /return after all the /timer commands, this will make the script stop and wait 60 seconds before continuing.
I have never heard of a /timer on the /goto command.
In the @*:text:!abductme:#: you use a @ prefix so in the On Text where you do the /hadd you should also use an @ prefix. Also, you should remake the script so only one On Text event is retriggered every time the same person replyies to a question. It would eliminate the forced 60 second wait and allow more than one person to be abducted at one time. Only 1 timer name will be used to repeate the question every 60 seconds.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
This problem has been resolved...thanks anyways
|
|
|
|
|