egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Making a script work in 2 channels

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Sbarkeri
Voice


Joined: 11 Aug 2009
Posts: 15

PostPosted: Tue Jan 12, 2010 4:12 pm    Post subject: Making a script work in 2 channels Reply with quote

Hi, I have the following script and it works fine however I would like to edit it so that it works in another channel

Code:
bind pub -|- !uac pub:uac
proc pub:uac {nick host hand chan text} {
  if {![string match [string tolower $chan] "#clanbase.crew.mw2"]} {
   return 0
  }
  if {[llength $text] == 0} {
   putserv "MODE #clanbase.mw2 -c"
   putserv "PRIVMSG #clanbase.mw2 :** NOTICE ** The gamecrew can provide limited support for UAC2, if you are having problems please visit: http://uac2.com/forums/ and wait for a UAC2 admin to respond to your issue."
   putserv "MODE #clanbase.mw2 +c"
  } else {
   set target [lindex [split $text] 0]
   putserv "MODE #clanbase.mw2 -c"
   putserv "PRIVMSG #clanbase.mw2 :** NOTICE FOR $target ** The gamecrew can only provide limited support for UAC2, if you are having problems please visit: http://uac2.com/forums/ and wait for a UAC2 admin to respond to your issue."
   putserv "MODE #clanbase.mw2 +c"
  }
}


You will notice that this script sends a message to the client channel (#clanbase.mw2) then someone in the admin channel (#clanbase.crew.m2) says !uac UserName. However I would like to extend this script so that it also works in #clanbase.cod4 and #clanbase.crew.cod4, I want it to have the same message etc. however just to extend it to work in both channels.

Cheers.
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Thu Jan 14, 2010 4:11 am    Post subject: Reply with quote

Code:
 set uac_chans "#clanbase.mw2 #clanbase.cod4 #clanbase.crew.cod4"

 bind pub -|- !uac pub:uac

 proc pub:uac {nick host hand chan text} {
  global uac_chans
  if {[lsearch "$uac_chans" "$chan"] == -1} {
   return 0
  }
  if {[llength $text] == 0} {
   pushmode $chan -c
   puthelp "PRIVMSG $chan :** NOTICE ** The gamecrew can provide limited support for UAC2, if you are having problems please visit: http://uac2.com/forums/ and wait for a UAC2 admin to respond to your issue."
   pushmode $chan +c
  } else {
   set target [lindex [split $text] 0]
   pushmode $chan -c
   puthelp "PRIVMSG $chan :** NOTICE FOR $target ** The gamecrew can only provide limited support for UAC2, if you are having problems please visit: http://uac2.com/forums/ and wait for a UAC2 admin to respond to your issue."
   pushmode $chan +c
  }
 }

_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
Sbarkeri
Voice


Joined: 11 Aug 2009
Posts: 15

PostPosted: Sat Jan 16, 2010 10:53 pm    Post subject: Reply with quote

Thanks but I kind of think you misunderstood my problem a little. What your script will do is respond to the !uac command when it is said in any of the 4 channels however what I want it to do is for an admin to say "!uac" or "!uac nick" in of the #xxx.crew channels and for the message to display in the standard channel. For example I will say "!uac Test" in #clanbase.crew.cod4 and in #clanbase.cod4 the message "**Notice for Test** Blah Blah" will appear. My script that I posted in the first post already does this for one pair of channels however I would like to work for the other pair too. So that the messages will appear in like so

!uac Sent Here ---> Notice Displayed Here
#Clanbase.crew.mw2 ---> #clanbase.mw2
#Clanbase.crew.cod4 ---> #clanbase.cod4


Cheers[/b]
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Sun Jan 17, 2010 10:53 am    Post subject: Reply with quote

Understood Very Happy *after next post* probably :/
Code:
 bind pub -|- !uac pub:uac

 proc pub:uac {nick host hand chan text} {
  set c [lindex [split [string tolower $chan] #] 1]
  if {([regexp -- {^(clanbase.crew.mw2|clanbase.crew.cod4|clanbase.mw2|clanbase.cod4)$} "$c"])&&([llength $text] == 0)} {
   if {[string match "*.cod4" "$c"]} {
    set dest "#clanbase.cod4"
   } else {
    set dest "#clanbase.mw2"
   }
   putserv "MODE $dest -c"
   putserv "PRIVMSG $dest :** NOTICE ** The gamecrew can only provide limited support for UAC2, if you are having problems please visit: http://uac2.com/forums/ and wait for a UAC2 admin to respond to your issue."
   putserv "MODE $dest +c"
  } elseif {([regexp -- {^(clanbase.crew.mw2|clanbase.crew.cod4)$} "$c"])&&([llength $text] > 0)} {
    set targets [lrange [split $text] 0 end]
    if {[string match "*.crew.cod4" "$c"]} {
     set dest "#clanbase.cod4"
    } else {
     set dest "#clanbase.mw2"
    }
     putserv "MODE $dest -c"
     putserv "PRIVMSG $dest :** NOTICE FOR $targets ** The gamecrew can only provide limited support for UAC2, if you are having problems please visit: http://uac2.com/forums/ and wait for a UAC2 admin to respond to your issue."
     putserv "MODE $dest +c"
  }
 }

_________________
TCL the misunderstood


Last edited by TCL_no_TK on Sun Jan 17, 2010 2:51 pm; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail
Sbarkeri
Voice


Joined: 11 Aug 2009
Posts: 15

PostPosted: Sun Jan 17, 2010 1:10 pm    Post subject: Reply with quote

Sorry to sound so fussy however this is still going to send the message to the channel the user types the bind in as the pushmode and pushhelp and being sent to the $chan which as we all know is set to whatever channel the bind was originally posted in. Here is what I wanted to happen:

Code:
User Types "!uac" or "!uac NICK" in #clanbase.crew.cod4 or #clanbase.crew.mw2

If channel = #clanbase.crew.cod4 Then
Send PRIVMSG (*NOTICE* BLAH BLAH) to #clanbase.cod4
If bind "!uac" has a NICK Then Send PRIVMSG (*NOTICE FOR NICK* BLAH BLAH)

If channel = #clanbase.crew.mw2 Then
Send PRIVMSG to #clanbase.mw2
If bind "!uac" has a NICK Then Send PRIVMSG (*NOTICE FOR NICK* BLAH BLAH)


Hope that kind of made it a little clearer, sorry for any inconveinience!
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Sun Jan 17, 2010 2:52 pm    Post subject: Reply with quote

Not at all, dont think my brain works as well with old age now Razz i've edited my last post anyway, hopefully this should do the trick Wink if not you can always post again Arrow
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
Sbarkeri
Voice


Joined: 11 Aug 2009
Posts: 15

PostPosted: Sun Jan 17, 2010 3:59 pm    Post subject: Reply with quote

Aha Very Happy Thanks As Always, glad we got there eventually Razz
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Sun Jan 17, 2010 4:20 pm    Post subject: Reply with quote

lol me too Razz
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber