This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

how to debug this ?

Old posts that have not been replied to for several years.
Locked
P
Pitchat
Op
Posts: 122
Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:

how to debug this ?

Post by Pitchat »

HI

i have a tcl scripts that is suppose tu join a channel and check if theres an X on the channel then say it to another channel everything works fine except that the eggdrop state that there is no X on the channel when there is actually one !!

heres the problem code

Code: Select all


if {[onchan X $req_chan]} { 
set QLcheck 1 
putserv "PRIVMSG $ref_chan :\002X\002 Présent sur le canal ! Demande refusée !" 
} { set QLcheck 0 
putserv "PRIVMSG $ref_chan :Pas de \002X\002 présent sur le canal ! Exigence \002Correcte\002 !" 
} 

thanks in advance for any help
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Re: how to debug this ?

Post by awyeah »

If you launch this script immediately on bind join, then the eggdrop might not detect all users in a chan, it is always best to use a utimer. Say delay it 5-10 secs after the join.


utimer <interval> [list your:proc]


And try something as simple as this:

Code: Select all

if {[onchan "X" $ref_chan]} { 
putserv "PRIVMSG $ref_chan :\002X\002 is \002present\002 on \002$ref_chan\002."
}
if {![onchan "X" $ref_chan]} { 
putserv "PRIVMSG $ref_chan :\002X\002 is \002*not* present\002 on \002$ref_chan\002."
} 
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Re: how to debug this ?

Post by demond »

awyeah wrote:If you launch this script immediately on bind join, then the eggdrop might not detect all users in a chan, it is always best to use a utimer. Say delay it 5-10 secs after the join.
hardly the best ;)

the proper way to do this is to bind raw to End-of-/WHO list:

Code: Select all

bind raw - 315 checkX
proc checkX {f k t} {
  set chan [lindex [split $t] 1]
  if [onchan X $chan] {
    # X is on channel
  } else {
    # X is not on channel
  }
}
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Pitchat, Its quite clear you ripped that part from a different script too :\
P
Pitchat
Op
Posts: 122
Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:

Post by Pitchat »

Thanks for the help i will try it asap

i`d like to point this ... before calling somebody a "ripper " you should first check if it`s the case ....

this portion of script is from a script that doesnt work at all and even the author post on this forum a while ago and didn`t receive any answer

i manage to make it work even if tcl is not what i do best except for the part listed above

be sure that when the script will be 100% working and if it can be useful to somebody it will be made available with all credits to the right people

have a nice day
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Re: how to debug this ?

Post by awyeah »

***EDITED***

Double post.
Last edited by awyeah on Sun Nov 21, 2004 12:33 pm, edited 1 time in total.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Re: how to debug this ?

Post by awyeah »

demond wrote:
awyeah wrote:If you launch this script immediately on bind join, then the eggdrop might not detect all users in a chan, it is always best to use a utimer. Say delay it 5-10 secs after the join.
hardly the best ;)

the proper way to do this is to bind raw to End-of-/WHO list:

Code: Select all

bind raw - 315 checkX
proc checkX {f k t} {
  set chan [lindex [split $t] 1]
  if [onchan X $chan] {
    # X is on channel
  } else {

    # X is not on channel
  }
}
The structure:

if {...} { }
if {...} { }

works as well as

if {...} { }
else {...} { }

or

if {...} { }
elseif {...} { }
else {...} { }

If you have alot of conditions to select from then you might want to use elseif and else, otherwise 'if' is just fine, heh.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Re: how to debug this ?

Post by demond »

awyeah wrote:
demond wrote:
awyeah wrote:If you launch this script immediately on bind join, then the eggdrop might not detect all users in a chan, it is always best to use a utimer. Say delay it 5-10 secs after the join.
hardly the best ;)

the proper way to do this is to bind raw to End-of-/WHO list:

Code: Select all

bind raw - 315 checkX
proc checkX {f k t} {
  set chan [lindex [split $t] 1]
  if [onchan X $chan] {
    # X is on channel
  } else {

    # X is not on channel
  }
}
The structure:

if {...} { }
if {...} { }

works as well as

if {...} { }
else {...} { }

or

if {...} { }
elseif {...} { }
else {...} { }

If you have alot of conditions to select from then you might want to use elseif and else, otherwise 'if' is just fine, heh.
I didn't mean the syntax, I meant your timer method.

Timers should never be used if there is an event-driven solution for a particular problem - as in this case.

Your timer method will not work if the timer is set to, say, 10 seconds but there is lag and join sync takes longer than that.
Locked