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 with a chat script plz

Old posts that have not been replied to for several years.
Locked
M
Mark
Voice
Posts: 11
Joined: Fri Oct 08, 2004 9:47 am
Contact:

Help with a chat script plz

Post by Mark »

lol, ok, different question, since i solved my last one, lets say i have this bot in two different channels, how could i make it ONLY talk in #chat, and not in #trivia?, is there a thing like mirc where if ( $chan == #chat )? if so let me know, and if not help me out please
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

tcl makes creating variables simplistic.

Code: Select all

set chatchan "#channel1"
It would be more helpful to direct you to the suninet tclguide, an invaluable beginner's resource.
M
Mark
Voice
Posts: 11
Joined: Fri Oct 08, 2004 9:47 am
Contact:

Post by Mark »

can ya help me with this? i thought i got it, but it didnt work.

Code: Select all

proc PublicMSG {nick uhost hand chan rest} {
	global botnick
	global commandpath
	global initfile

#make sure the bot doesn't talk to himself.
  if {[string tolower $nick] == [string tolower $botnick]} {
    return 0
  }
  elseif ($chan == $chan(one) {
  regsub -all {\"} $rest {} rest
  set f [open "|$commandpath -i $initfile -s name $nick -u $nick \"$rest\"" "r"]

  putchann $chan $nick [gets $f]

  while {[eof $f] != 1} {
    putchan $chan [gets $f]
  }
  }
  close $f
}
any idea's?
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

Code: Select all

set pubchan "#mychan"
proc PublicMSG {nick uhost hand chan rest} {
	global botnick commandpath initfile pubchan
  if {[string tolower $nick] == [string tolower $botnick]} {return 0}
  elseif ($chan == $chan(one) {
  regsub -all {\"} $rest {} rest
  set f [open "|$commandpath -i $initfile -s name $nick -u $nick \"$rest\"" "r"]
  putchan $pubchan $nick [gets $f]
  while {[eof $f] != 1} { putchan $pubchan [gets $f] }
  }
  close $f
}
I didn't test the code for syntax or error, but using some basic structure rules in your procedures helps alot. If you haven't read this tclguide yet, you're missin out :mrgreen:
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Re: Help with a chat script plz

Post by awyeah »

Mark wrote:lol, ok, different question, since i solved my last one, lets say i have this bot in two different channels, how could i make it ONLY talk in #chat, and not in #trivia?, is there a thing like mirc where if ( $chan == #chat )? if so let me know, and if not help me out please
It can be:
if {([string equal -nocase "#chat" $chan])} { # do stuff }
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked