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.
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Tue Jan 10, 2017 1:38 am
good morning to all
I extended a very good tcl and it me works very well
Code: Select all
########### PiNG THiNGiE 1.0 ############
# designed and programmed by FlyBoyUSA #
# for original use in #emuroms Undernet #
#########################################
# Bug reports and ideas goto flyboyus@modex.com
# I love comments, complaints, death threats, and suggestions :-)
set pingscommands "!ping .ping ¡ping ping !pingme .pingme ¡pingme pingme !lag .lag ¡lag lag !lagme .lagme ¡lagme lagme"
foreach pingsnicks [split $pingscommands] { bind pub - $pingsnicks ping_me }
bind ctcr - PING ping_me_reply
proc ping_me {nick uhost hand chan arg} {
global pingchan pingwho
set arg [string toupper $arg]
if {$arg == "ME" } {
putserv "PRIVMSG $nick :\001PING [clock clicks -milliseconds]\001"
set pingwho 0
set pingchan $chan
return 1
} else {
if {$arg == "" } {
putserv "PRIVMSG $nick :\001PING [clock clicks -milliseconds]\001"
set pingwho 0
set pingchan $chan
return 1
} else {
putserv "PRIVMSG $arg :\001PING [clock clicks -milliseconds]\001"
set pingwho 1
set pingchan $chan
return 0
}
}
}
proc ping_me_reply {nick uhost hand dest key arg} {
global pingchan pingwho
set lagg [expr {abs([clock clicks -milliseconds] - $arg) / 1000.0}]
if {$pingwho == 0} {
puthelp "PRIVMSG $pingchan :PiNG THiNGiE - $nick your ping is $lagg"
return 0
} elseif {$pingwho == 1} {
puthelp "PRIVMSG $pingchan :PiNG THiNGiE - looking at the ping of $nick is $lagg"
return 0
}
}
bind raw - 401 no:such:nick
proc no:such:nick {from keyword arg} {
global pingchan
if {[info exists pingchan]} {
set nickspingnosuch [lindex [split $arg] 1]
foreach pichans $pingchan {
putserv "PRIVMSG $pichans :10$nickspingnosuch No such nick"
unset -nocomplain -- pingchan pichans ; break
} } }
putlog "PiNG THiNGiE 1.0 by FlyBoyUSA Loaded"
it works very well
my question is it will be that the tcl also could recognize also the orders in actions
help me please
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Wed Feb 08, 2017 10:30 pm
willyw
Revered One
Posts: 1205 Joined: Thu Jan 15, 2009 12:55 am
Post
by willyw » Thu Feb 09, 2017 11:30 am
#
Code: Select all
########### PiNG THiNGiE 1.0 ############
# designed and programmed by FlyBoyUSA #
# for original use in #emuroms Undernet #
#########################################
# Bug reports and ideas goto flyboyus@modex.com
# I love comments, complaints, death threats, and suggestions :-)
set pingscommands "!ping .ping ¡ping ping !pingme .pingme ¡pingme pingme !lag .lag ¡lag lag !lagme .lagme ¡lagme lagme"
foreach pingsnicks [split $pingscommands] { bind pub - $pingsnicks ping_me }
bind ctcr - PING ping_me_reply
##########################
bind ctcp - "ACTION" ctcp_pingscript_proc
proc ctcp_pingscript_proc {nick uhost hand dest keyword text} {
if {$keyword eq "ACTION" && [lindex [split $text] 0] eq ".ping" } {
ping_me $nick $uhost $hand $dest [lrange [split $text] 1 end ]
}
}
################
proc ping_me {nick uhost hand chan arg} {
global pingchan pingwho
set arg [string toupper $arg]
if {$arg == "ME" } {
putserv "PRIVMSG $nick :\001PING [clock clicks -milliseconds]\001"
set pingwho 0
set pingchan $chan
return 1
} else {
if {$arg == "" } {
putserv "PRIVMSG $nick :\001PING [clock clicks -milliseconds]\001"
set pingwho 0
set pingchan $chan
return 1
} else {
putserv "PRIVMSG $arg :\001PING [clock clicks -milliseconds]\001"
set pingwho 1
set pingchan $chan
return 0
}
}
}
proc ping_me_reply {nick uhost hand dest key arg} {
global pingchan pingwho
set lagg [expr {abs([clock clicks -milliseconds] - $arg) / 1000.0}]
if {$pingwho == 0} {
puthelp "PRIVMSG $pingchan :PiNG THiNGiE - $nick your ping is $lagg"
return 0
} elseif {$pingwho == 1} {
puthelp "PRIVMSG $pingchan :PiNG THiNGiE - looking at the ping of $nick is $lagg"
return 0
}
}
bind raw - 401 no:such:nick
proc no:such:nick {from keyword arg} {
global pingchan
if {[info exists pingchan]} {
set nickspingnosuch [lindex [split $arg] 1]
foreach pichans $pingchan {
putserv "PRIVMSG $pichans :10$nickspingnosuch No such nick"
unset -nocomplain -- pingchan pichans ; break
} } }
putlog "PiNG THiNGiE 1.0 by FlyBoyUSA Loaded"
Try this.
You can see the edits/additions with #### above and below them.
This is untested. Sorry.
Additions will only work with the command:
.ping
I hope this helps.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Thu Feb 09, 2017 10:13 pm
thanks willyw
thank you very much
I will try to extract the global variant to use all the commands..
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Thu Feb 09, 2017 10:25 pm
I achieved it extracted the variant for that he looks and it me works of marvel
now he recognizes all the commands ping & lag (for nicks)
Code: Select all
########### PiNG THiNGiE 1.0 ############
# designed and programmed by FlyBoyUSA #
# for original use in #emuroms Undernet #
#########################################
# Bug reports and ideas goto flyboyus@modex.com
# I love comments, complaints, death threats, and suggestions :-)
# updated for Arnold_X-P email urquizoandrade@hotmail.com /server irc.dal.net channel #tcls my nick's Arnold_X-P & sedition 09/FEB/2017
# thanks to willyw, for the variant in action (/me ping or /me ping nickname)
# this tcl recognizes commands in public and also privately and actions.
set pingscommands "!ping .ping ¡ping ping !pingme .pingme ¡pingme pingme !lag .lag ¡lag lag !lagme .lagme ¡lagme lagme"
foreach pingsnicks [split $pingscommands] { bind pub - $pingsnicks ping_me }
foreach pingmsge [split $pingscommands] { bind msg - $pingmsge msg_ping }
proc msg_ping {nick uhost hand arg} {
ping_me $nick $uhost $hand $nick $arg
}
bind ctcp - "ACTION" ctcp_pingscript_proc
proc ctcp_pingscript_proc {nick uhost hand dest keyword text} {
if {[string match -nocase "*ping*" $text] || [string match -nocase "*lag*" $text]} {
ping_me $nick $uhost $hand $dest [lrange [split $text] 1 end ]
}
}
proc ping_me {nick uhost hand chan arg} {
global pingchan pingwho
set arg [string toupper $arg]
if {$arg == "ME" } {
putserv "PRIVMSG $nick :\001PING [clock clicks -milliseconds]\001"
set pingwho 0
set pingchan $chan
return 1
} else {
if {$arg == "" } {
putserv "PRIVMSG $nick :\001PING [clock clicks -milliseconds]\001"
set pingwho 0
set pingchan $chan
return 1
} else {
putserv "PRIVMSG $arg :\001PING [clock clicks -milliseconds]\001"
set pingwho 1
set pingchan $chan
return 0
}
}
}
bind ctcr - PING ping_me_reply
proc ping_me_reply {nick uhost hand dest key arg} {
global pingchan pingwho
set pingtarget [lindex $arg 0]
set lagg [expr {abs([clock clicks -milliseconds] - $pingtarget) / 1000.0}]
if {$pingwho == 0} {
puthelp "PRIVMSG $pingchan :PiNG THiNGiE - $nick your ping is $lagg"
return 0
} elseif {$pingwho == 1} {
puthelp "PRIVMSG $pingchan :PiNG THiNGiE - looking at the ping of $nick is $lagg"
return 0
}
}
bind raw - 401 no:such:nick
proc no:such:nick {from keyword arg} {
global pingchan
if {[info exists pingchan]} {
set nickspingnosuch [lindex [split $arg] 1]
putserv "PRIVMSG $pingchan :10$nickspingnosuch No such nick."
unset pingchan ;
} }
putlog "PiNG THiNGiE 1.0 by FlyBoyUSA - updated for Arnold_X-P Loaded"
thanks willyw
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Sat Sep 16, 2017 4:07 pm
error in tcl:
the nickname goes out and goes out again... << in the channel
[19:45] * daniel77 (~daniel77@190.186.242.22) Quit (Quit: )
[20:08] <@Kantuta> daniel77 No such nick.
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Sun Oct 29, 2017 7:45 pm
final code and working very well..
Code: Select all
########### PiNG THiNGiE 1.0 ############
# designed and programmed by FlyBoyUSA #
# for original use in #emuroms Undernet #
#########################################
# Bug reports and ideas goto flyboyus@modex.com
# I love comments, complaints, death threats, and suggestions :-)
# updated for Arnold_X-P email urquizoandrade@gmail.com /server irc.dal.net channel #tcls my nick's Arnold_X-P & sedition 09/FEB/2017
# thanks to willyw, for the variant in action (/me ping or /me ping nickname)
# tambien estoy en irc.chatzona.org canal #eggdrop.conf mi correo urquizoandrade@hotmail.com mis nicks Arnold_X-P y sedition
# this tcl recognizes commands in public and also privately and actions.
set pingscommands "!ping .ping ¡ping ping !pingme .pingme ¡pingme pingme !lag .lag ¡lag lag !lagme .lagme ¡lagme lagme"
foreach pingsnicks [split $pingscommands] { bind pub - $pingsnicks ping_me }
foreach pingmsge [split $pingscommands] { bind msg - $pingmsge msg_ping }
proc msg_ping {nick uhost hand arg} {
ping_me $nick $uhost $hand $nick $arg
}
bind ctcp - "ACTION" ctcp_pingscript_proc
proc ctcp_pingscript_proc {nick uhost hand dest keyword text} {
if {[string match -nocase "*ping*" $text] || [string match -nocase "*lag*" $text]} {
ping_me $nick $uhost $hand $dest [lrange [split $text] 1 end ]
}
}
proc ping_me {nick uhost hand chan arg} {
global pingchan pingwho
if {[string match -nocase "me" $arg] } {
putserv "PRIVMSG $nick :\001PING [clock clicks -milliseconds]\001"
set pingwho 0
set pingchan $chan
} {
if {$arg == "" } {
putserv "PRIVMSG $nick :\001PING [clock clicks -milliseconds]\001"
set pingwho 0
set pingchan $chan
} {
putserv "PRIVMSG $arg :\001PING [clock clicks -milliseconds]\001"
set pingwho 1
set pingchan $chan
return 1
}
}
}
bind ctcr - PING ping_me_reply
proc ping_me_reply {nick uhost hand dest keyword arg} {
global pingchan pingwho
set pingtarget [lindex [split $arg] 0]
set lagg [expr {abs([clock clicks -milliseconds] - $pingtarget) / 1000.0}]
if {$pingwho == 0} {
puthelp "PRIVMSG $pingchan :PiNG THiNGiE - $nick your ping is $lagg"
return 0
} elseif {$pingwho == 1} {
puthelp "PRIVMSG $pingchan :PiNG THiNGiE - looking at the ping of $nick is $lagg"
unset -nocomplain -- pingchan
}
return 0
}
bind raw - 401 nosuchnick
proc nosuchnick {from keyword arg} {
global pingchan
set nickspingnosuch [lindex [split $arg] 1]
if {[info exists pingchan]} {
putserv "PRIVMSG $pingchan :10$nickspingnosuch No such nick."
unset pingchan } }
putlog "PiNG THiNGiE 1.0 by FlyBoyUSA - updated for Arnold_X-P Loaded"