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 

relay script

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Tue Sep 07, 2010 10:15 am    Post subject: relay script Reply with quote

Hey im using this script which I have slightly modified that relays text from one channel to another we currently use this as a script that has a training function on my irc

Code:
setudef flag pipe
set pipechannel "#Trainingroom1"
 
bind pubm - * pipemsgecho
proc pipemsgecho { n u h c t } {
   if {[lsearch -exact [channel info $c] {+pipe}] != "-1"} {
     global pipechannel
     putserv "privmsg $pipechannel :$t"
   }
}


Currently i have to join the partyline of my bot and do .chanset channel +pipe

What im looking to be able to do is send a privmsg to the bot such as +pipechannel #channelname the bot will then need to join the #channame and set the .chanset #channame +pipe this will also need to be able to do the opposite with -pipechannel #channel name the bot then leaves the channel and set .chanset #channame -pipe

Thanks for any help
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Sep 07, 2010 11:21 am    Post subject: Reply with quote

Instead of:
Code:

if {[lsearch -exact [channel info $c] {+pipe}] != "-1"} {

you should use:
Code:

if {[channel get $c pipe]} {
   # channel is +pipe, do something
} else {
   # channel is -pipe, do something else
}

As for the rest, it's a simple bind for msg and a combination of 'channel set' +/-pipe.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Wed Sep 08, 2010 5:00 am    Post subject: Reply with quote

Done the above just crashed it
Any further help would be appreciated
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Sep 08, 2010 5:55 am    Post subject: Reply with quote

What exactly have you tried that crashed it? Rolling Eyes
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Wed Sep 08, 2010 8:32 am    Post subject: Reply with quote

caesar wrote:
What exactly have you tried that crashed it? Rolling Eyes


you should use:
Code:


if {[channel get $c pipe]} {
   # channel is +pipe, do something
} else {
   # channel is -pipe, do something else
}


I did so and the bot died on rehash

to be honest im baffled on were to start full stop with how to get it to join a channel and set the chanset option im okay on changing stuff and some how modifying things that i have all ready its just knowing how start something from scratch that gets me stumped
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
doggo
Halfop


Joined: 05 Jan 2010
Posts: 97

PostPosted: Wed Sep 08, 2010 10:48 am    Post subject: Reply with quote

Code:
# Rls: egghelp.org +pipe
# Date: 08/09/10
# Coded by: doggo
# Contact: #alt.binaries.inner-sanctum@EFNET
#############################################

#the channel flag and the channel name for all the piped stuff to go to.
setudef flag pipe
set pipechannel "#PIPED_TO_CHANNEL" # change this to your own

#the binds set to bot master ONLY
bind pubm -|- * pipe_proc
bind pub m|m !join join_chan
bind pub m|m !leave leave_chan

#the pipe : pipes all puplic msg's on a +piped channel to the one you set above
proc pipe_proc { nickname hostname handle channel arg } {
   if {[channel get $channel pipe] == 1 } {
        putquick "PRIVMSG $::pipechannel :$arg"
      } else {
      putlog "Attention $channel is not +pipe."
   }
}

#joins the channel and sets the joined channel +pipe.
proc join_chan {nick uhost hand chan arg} {
set _join "[lindex $arg 0]"
set success 0
if {[expr { $_join == "" || [expr { [string index $_join 0] != "#"}] } ]} {
   puthelp "PRIVMSG $nick :!join <#channel>"
   return 1   
   } else {
      set success 1
      channel add $_join
      putserv "PRIVMSG $nick :Joined $_join."
   }
if { $success == "1" } {
         channel set $_join +pipe
         putserv "PRIVMSG $nick :Set $_join +pipe"
      } else {
         putserv "PRIVMSG $nick :Error setting +pipe on $_join."
   }
}

# no need to set -pipe as all channel records are removed anyway.
proc leave_chan {nick uhost hand chan arg} {
set leave "[lindex $arg 0]"
if {[expr { $leave == "" || [expr { [string index $leave 0] != "#"}] } ]} {
   puthelp "PRIVMSG $nick :Command usage:!leave <#channel>."
   return 1   
   } else {
      channel remove $leave
      putserv "PRIVMSG $nick :left $leave."
   }
}

putlog "egghelp.org +pipe by doggo #alt.biniries.inner-sanctum @EFNET"



hope this helps, works as you wanted just change the binds to suit..

will only work if user has the +m flag and the bot is on the channel

Code:
!join #chan - this joins the channel and sets +pipe

!leave #chan - this makes the bot leave the channel

_________________
NON geeky!! http://gotcode4u.com/
Back to top
View user's profile Send private message Visit poster's website
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Wed Sep 08, 2010 4:02 pm    Post subject: Reply with quote

Thanks doggo works exactly how i need it to but one small problem about 3 of my bots will be using this script and will all be in the same channel but need to pipe text from different channels so is it possible to change it to msg bind rather then pubm
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
doggo
Halfop


Joined: 05 Jan 2010
Posts: 97

PostPosted: Wed Sep 08, 2010 7:59 pm    Post subject: Reply with quote

change

Code:
#the binds set to bot master ONLY
bind pubm -|- * pipe_proc
bind pub m|m !join join_chan
bind pub m|m !leave leave_chan


to

Code:
#the binds set to bot master ONLY
bind pubm -|- * pipe_proc
bind msg m|m !join join_chan
bind msg m|m !leave leave_chan


and

Code:
#joins the channel and sets the joined channel +pipe.
proc join_chan {nick uhost hand chan arg} {

# no need to set -pipe as all channel records are removed anyway.
proc leave_chan {nick uhost hand chan arg} {


to

Code:
#joins the channel and sets the joined channel +pipe.
proc join_chan {nick uhost hand arg} {

# no need to set -pipe as all channel records are removed anyway.
proc leave_chan {nick uhost hand arg} {


and your good to go Smile
_________________
NON geeky!! http://gotcode4u.com/
Back to top
View user's profile Send private message Visit poster's website
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Thu Sep 09, 2010 7:58 am    Post subject: Reply with quote

Brill Thank you doggo
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Thu Jul 14, 2011 10:37 am    Post subject: Reply with quote

Hey

Ive been using this code on an older bot 6 19 im now trying to use it on 6 20 without success

Code:
# Rls: egghelp.org +pipe
# Date: 08/09/10
# Coded by: doggo
# Contact: #alt.binaries.inner-sanctum@EFNET
#############################################

#the channel flag and the channel name for all the piped stuff to go to.
setudef flag pipe
set pipechannel "#PIPED_TO_CHANNEL" # change this to your own

#the binds set to bot master ONLY
bind pubm -|- * pipe_proc
bind msg m|m !join join_chan
bind msg m|m !leave leave_chan

#the pipe : pipes all puplic msg's on a +piped channel to the one you set above
proc pipe_proc { nickname hostname handle arg } {
   if {[channel get $channel pipe] == 1 } {
        putquick "PRIVMSG $::pipechannel :$arg"
      } else {
      putlog "Attention $channel is not +pipe."
   }
}

#joins the channel and sets the joined channel +pipe.
proc join_chan {nick uhost hand arg} {
set _join "[lindex $arg 0]"
set success 0
if {[expr { $_join == "" || [expr { [string index $_join 0] != "#"}] } ]} {
   puthelp "PRIVMSG $nick :!join <#channel>"
   return 1   
   } else {
      set success 1
      channel add $_join
      putserv "PRIVMSG $nick :Joined $_join."
   }
if { $success == "1" } {
         channel set $_join +pipe
         putserv "PRIVMSG $nick :Set $_join +pipe"
      } else {
         putserv "PRIVMSG $nick :Error setting +pipe on $_join."
   }
}

# no need to set -pipe as all channel records are removed anyway.
proc leave_chan {nick uhost hand chan arg} {
set leave "[lindex $arg 0]"
if {[expr { $leave == "" || [expr { [string index $leave 0] != "#"}] } ]} {
   puthelp "PRIVMSG $nick :Command usage:!leave <#channel>."
   return 1   
   } else {
      channel remove $leave
      putserv "PRIVMSG $nick :left $leave."
   }
}

putlog "egghelp.org +pipe by doggo #alt.biniries.inner-sanctum @EFNET"


This is the error im getting

Code:
wrong # args: should be "set varName ?newValue?"
    while executing
"set pipechannel "#Trainingroom" # change this to your own "
    (file "scripts/pipe.tcl" line 9)
    invoked from within
"source scripts/pipe.tcl"
    (file "eggdrop.conf" line 1359)


Any ideas on how to correct this as ive said above i had no problems on an older version bot

Many thanks
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Thu Jul 14, 2011 2:16 pm    Post subject: Reply with quote

Code:
# the channel flag and the channel name for all the piped stuff to go to.
# change this to your own
set pipechannel "#PIPED_TO_CHANNEL"

# flag
setudef flag pipe

# the binds set to bot master ONLY
bind pubm -|- * pipe_proc
bind msg m|m !join [list juggle_chan 0]
bind msg m|m !part [list juggle_chan 1]

# pipe flag
# pipes all puplic msg's on a +piped channel to the one you set above
proc pipe_proc {n u h channel text} {
   if {[channel get $channel pipe]} {
      putserv "PRIVMSG $::pipechannel :$text"
   }
}

# juggle channel
# determine join or part and act accordingly
proc juggle_chan {j nick u h text} {
   set chan [lindex [split $text] 0]
   if {![string length $chan] || [string first {#} $chan] != 0} {
      # 0 = join
      if {$j == 0} {
         puthelp "PRIVMSG $nick :!join <#channel>"
      # anything else, part
      } else {
         puthelp "PRIVMSG $nick :!part <#channel>"
      }
   } else {
      # 0 = join
      if {$j == 0} {
         channel add $chan
         channel set $chan +pipe
         putserv "PRIVMSG $nick :Joined $chan. Set +pipe on $chan."
      # anything else, part
      } else {
         channel remove $chan
         putserv "PRIVMSG $nick :Parted $chan. Unset +pipe on $chan."
      }
   }
}

_________________
speechles' eggdrop tcl archive


Last edited by speechles on Thu Jul 14, 2011 3:17 pm; edited 5 times in total
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Thu Jul 14, 2011 2:59 pm    Post subject: Reply with quote

thanks speechless

following error

Code:
[22:59:46] missing close-brace
    while executing
"proc juggle_chan {nick u h text {j 0}} { ]
   set chan [lindex [split $text] 0]
   if {![string length $chan] || [string first {#} $chan] != 0} {
  ..."
    (file "scripts/pipe.tcl" line 23)
    invoked from within
"source scripts/pipe.tcl"
    (file "eggdrop.conf" line 1345)
[22:59:46] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)

_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Thu Jul 14, 2011 3:11 pm    Post subject: Reply with quote

blake wrote:
thanks speechless

following error

Code:
[22:59:46] missing close-brace
    while executing
"proc juggle_chan {nick u h text {j 0}} { ]


DOH! Shocked I missed a ending curly-brace in there, my bad. Try the edited code above it should work now. Wink
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Thu Jul 14, 2011 4:07 pm    Post subject: Reply with quote

Thanks speechless working great now
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
heartbroken
Op


Joined: 23 Jun 2011
Posts: 106
Location: somewhere out there

PostPosted: Fri Jul 15, 2011 10:18 am    Post subject: wanna ask something Reply with quote

hi ..

may i ask you something about this code ?

i would like to ask that how can we set a nick or some of nicks in +piped channel .i mean if we would like to see only these nicks what typed in +piped channel ?.
how can we set nick/s in channel with this code ?

thnx..
_________________
Life iS Just a dReaM oN tHE wAy to DeaTh
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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