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.
garfwen
Halfop
Posts: 61 Joined: Wed Mar 12, 2008 5:16 pm
Post
by garfwen » Sat May 30, 2009 5:11 am
Hello
<Dude> getmsg
<Bot> Yeah its working
Code: Select all
bind msg - getmsg getmsg
proc getmsg { nick host handle text } {
global db
set txt [lindex [lindex [::mysql::sel $db "SELECT language FROM lang WHERE cmd='works'" -list] 0] 0]
putserv "privmsg $nick :$txt"
}
In this case txt will return "Yeah its working".
Is it possible to put a var like $nick on my mysql? so it can return "Dude Yeah its working"
<Dude> getmsg
<Bot> Dude Yeah its working
(sorry for my bad english)
GaRfWeN
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Sat May 30, 2009 8:14 am
Include $nick in your output line:
Code: Select all
putserv "PRIVMSG $nick :$nick $txt"
r0t3n @ #r0t3n @ Quakenet
garfwen
Halfop
Posts: 61 Joined: Wed Mar 12, 2008 5:16 pm
Post
by garfwen » Sat May 30, 2009 9:26 am
Thats not what i mean...
$nick var should be on mysql like
mysql output: "%nick talked with me (%host)"
Eggdrop selects that from DB and sendes "%nick talked with me (%host)"
i want it to send "Dude talked with me (Super!
Dude@host.com )"
------------
Confusing
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sat May 30, 2009 11:54 am
Code: Select all
set txt [string map [list %nick $nick %host $host] [join $txt]]
this will replace %nick and %host with the user's nickname and user@host respectively.
garfwen
Halfop
Posts: 61 Joined: Wed Mar 12, 2008 5:16 pm
Post
by garfwen » Sun May 31, 2009 5:52 am
Thank you