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.

relay script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

relay script

Post by blake »

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: Select all

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
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Instead of:

Code: Select all

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

Code: Select all

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.
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

Done the above just crashed it
Any further help would be appreciated
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

What exactly have you tried that crashed it? :roll:
Once the game is over, the king and the pawn go back in the same box.
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

caesar wrote:What exactly have you tried that crashed it? :roll:
you should use:

Code: Select all


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
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

Code: Select all

# 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: Select all

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

!leave #chan - this makes the bot leave the channel
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

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
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

change

Code: Select all

#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: Select all

#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: Select all

#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: Select all

#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 :)
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

Brill Thank you doggo
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

Hey

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

Code: Select all

# 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: Select all

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
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

# 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."
		}
	}
}
Last edited by speechles on Thu Jul 14, 2011 3:17 pm, edited 5 times in total.
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

thanks speechless

following error

Code: Select all

[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)
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

blake wrote:thanks speechless

following error

Code: Select all

[22:59:46] missing close-brace
    while executing
"proc juggle_chan {nick u h text {j 0}} { ]
DOH! :shock: I missed a ending curly-brace in there, my bad. Try the edited code above it should work now. ;)
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

Thanks speechless working great now
User avatar
heartbroken
Op
Posts: 110
Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there

wanna ask something

Post by heartbroken »

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
Post Reply