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.
Help for those learning Tcl or writing their own scripts.
pektek
Halfop
Posts: 55 Joined: Sat Jul 01, 2023 4:51 pm
Post
by pektek » Tue May 07, 2024 7:51 pm
I ran tcl for myself but I got an error
!ping
[02:48:07] Tcl error [ping_cevabi]: can't read "ping_suresi(cengiz)": no such element in array
Code: Select all
set ping_bklm_srsi 15000
set ping_kanal "#Sohbet"
bind pub - !ping ping
bind ctcr - PING ping_cevabi
proc ping {nick uhost handle chan arg} {
global botnick ping_suresi ping_kanal ping_bklm_srsi
if {[lindex $arg 0] == ""} { set nick $nick }
if {[lindex $arg 0] != ""} { set nick [string tolower [lindex $arg 0]] }
set ms [clock clicks -milliseconds]
if {[info exists ping_suresi($nick)]} {
if {[expr $ms - $ping_suresi($nick)] < $ping_bklm_srsi} {
putserv "NOTICE $nick :Henüz bir ping istediniz, lütfen biraz sonra tekrar deneyin."
return
}
}
set ping_suresi($nick) $ms
set ping_kanal $chan
putserv "PRIVMSG $nick :\001PING $ping_suresi($nick)\001";
}
proc ping_cevabi {nick uhost handle {dest ""} keyword text} {
global botnick ping_suresi ping_kanal
set cnick [string tolower $nick]
if {$dest == ""} {set dest $botnick}
if {$dest == $botnick} {
set ms [clock clicks -milliseconds]
set fark [expr [expr $ms - $ping_suresi($cnick)]/1000.0]
putserv "PRIVMSG $ping_kanal :$nick ping süreniz $fark saniye."
}
}
putlog "pingkanal.tcl"
CrazyCat
Revered One
Posts: 1306 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed May 08, 2024 7:09 am
This is because if you don't put any argument when doing !ping, you use the nick of the person without lowercase it:
if {[lindex $arg 0] == ""} { set nick $nick }
Correct that with:
if {[lindex $arg 0] == ""} { set nick [string tolower $nick] }
aslpls
Halfop
Posts: 52 Joined: Mon May 02, 2016 9:41 am
Post
by aslpls » Wed May 08, 2024 1:03 pm
it is working with the updated code from Crzy..
the output is
Code: Select all
<Botname> aslpls ping süreniz 2.177 saniye.
<Botname> aslpls ping süreniz 2.321 saniye.
2 ping results in the channel. how can we remove the second ping output? it is redundant to have two output when you
type !ping in the channel.
It was FUNNY!
CrazyCat
Revered One
Posts: 1306 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed May 08, 2024 6:16 pm
Check if you don't have 2 binds ctcr loaded (multiple loading of script without restarting it ?)
When I tested it, I only got one response from the eggdrop. And as your ping aren't the same, I suspect it's due to a side-effect in your eggdrop (restart could be a good idea) or the network you're on, or anything else but not related to the script itself.
aslpls
Halfop
Posts: 52 Joined: Mon May 02, 2016 9:41 am
Post
by aslpls » Thu May 09, 2024 1:26 am
Restarted the bot last night, after 8hrs of sleep. I tried it and it is working perfect. You are right Crzy.
Pektek, now you're script is working properly.
It was FUNNY!
pektek
Halfop
Posts: 55 Joined: Sat Jul 01, 2023 4:51 pm
Post
by pektek » Sat Nov 23, 2024 7:21 pm
thank you everyone in advance