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.

hostname -> nickname

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
e
edu
Voice
Posts: 31
Joined: Sun Oct 29, 2006 2:10 pm

hostname -> nickname

Post by edu »

Hi

I have a little problem ...

Code: Select all

set edu(bot_host) "*!*@bot.users.undernet.org"


After I've setted that variable I want to find if that 'hostname' is on the channel where the bot is running. I want to switch the hostname into the host's nickname :roll: , ex:

If nickname "eggie" has hostname "*!*@bot.users.undernet.org", I want to 'show' that nickname

Thanks
Seek the truth
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

foreach n [chanlist $chan] {
 if {[string match -nocase $edu(bot_host) $n![getchanhost $n $chan]]} {
  # Found nick: $n
  break
 }
}
But what's the purpose of that? if it's to know if your bot is on the channel then a simple [botonchan $chan] will do that.
e
edu
Voice
Posts: 31
Joined: Sun Oct 29, 2006 2:10 pm

Post by edu »

It's not for the bot, it's for something else

It doesn't work

Code: Select all

set edu(hostname) "*!*@edu.users.undernet.org"
bind pub o|- .find edu:find
proc edu:find {nickname hostname handle channel text} {
	global edu
	foreach n [chanlist $channel] {
		if {[string match -nocase $edu(hostname) $n![getchanhost $n $channel]]} {
			# Found nick: $n
			putquick "PRIVMSG $channel :Found $n"
			break
		}
	}
}
:roll:
Seek the truth
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Try:

Code: Select all

set edu(hostname) "*!*@edu.users.undernet.org"
bind pub o .find edu:find
proc edu:find {nickname hostname handle channel text} {
   global edu
   foreach n [chanlist $channel] {
      if {[string match -nocase $edu(hostname) $n![getchanhost $n $channel]]} {
         set found $n
         break
      }
   }
   if {[info exists found]} {
      putserv "privmsg $channel :Found $n"
   }
}
Post Reply