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.

mysql $var

Help for those learning Tcl or writing their own scripts.
Post Reply
g
garfwen
Halfop
Posts: 61
Joined: Wed Mar 12, 2008 5:16 pm

mysql $var

Post by garfwen »

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
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Include $nick in your output line:

Code: Select all

putserv "PRIVMSG $nick :$nick $txt"
r0t3n @ #r0t3n @ Quakenet
g
garfwen
Halfop
Posts: 61
Joined: Wed Mar 12, 2008 5:16 pm

Post by garfwen »

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 :oops:
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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.
g
garfwen
Halfop
Posts: 61
Joined: Wed Mar 12, 2008 5:16 pm

Post by garfwen »

Thank you
Post Reply