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.

Script Problem for a simple copy script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
E
Evil
Voice
Posts: 17
Joined: Thu May 10, 2007 5:03 am

Script Problem for a simple copy script

Post by Evil »

Hello together,

I have an script to copy news from channel A to Channel B

bind pubm - * forward:pubm
proc forward:pubm {n uh h chan t} {
set target #zielchannel
set source #quellchannel
set newsbot Newsbot-Nickname
if {$chan == $source} {
if {$n == $newsbot} {
putmsg $target "$n: $t"
}
}
}

I will change that " set newsbot Newsbot-Nickname "

I need does the bot only copy the message when a word comes what in Important for me, like an name or only an word in the message.

Thanks for help

BR/Ralf
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Could you repeat your question in a more understandable form?
E
Evil
Voice
Posts: 17
Joined: Thu May 10, 2007 5:03 am

Post by Evil »

I will do my best.... with my badly english

I need a script like this in the begining and the eggdrop read the news in Channel A on repead it in Channel B.

But i don´t need all news so does my eggdrop only repead ths news with our names inside..

for Example: the News look like so in Channel A
Berlin: Die No Name hat den WSC ein Versteck abgenommen

Kopenhagen: Die Hamburg-_-Allstars hat den Rote Pest ein Kaffeehaus abgenommen.

Bern:Die f!ght!nG 4 gLorY hat den Gangs of Roma eine Bank abgenommen.

But I like to search to some Names..... and this in tcl...

hope that helps you to identify my problem :)


The first script copy a Message only from one other bot to another channel
but i like to search in news text for a name to forward this in Chanel B

Best
Regards
Ralf
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

set targChan #zielchannel
set srcChan #quellchannel
set newsBot {GWNEWS-[01][1-5]}

set namesList {
 name1
 name2
 name3
}

bind pubm - * forward:pubm

proc forward:pubm {n uh h chan t} {
 global targChan srcChan newsBot namesList
 if {[string equal -nocase $srcChan $chan]} {
  if {[regexp -nocase $newsBot $n]} {
   set match 0
   foreach nm $namesList {
    if {![string match -nocase *$nm* $t]} {continue}
    set match 1
    break
   }
   if {$match} {
    putmsg $targChan "$n: $t"
   }
  }
 }
}
Edit: Fixed bug.
Edit2: Changed matching method to regexp for newsBot.
Edit3: Tweaked the code.
Last edited by Sir_Fz on Mon Sep 17, 2007 4:38 pm, edited 3 times in total.
E
Evil
Voice
Posts: 17
Joined: Thu May 10, 2007 5:03 am

Post by Evil »

firstly thanks for your help.

after your tip i wrote the names inside like this:
set targChan #gw-test12
set srcChan #gwnews.global
set newsBot GW-Support

set namesList {
[-X-]Evil-One
Sandsturm
Wazzup
sukkerz
Masters
Easyrider
GeisteskrankePsychopaten
United Chemikers
Amplified
Cherusker
Kellogs Bande
becks4al
BWG
The All Stars
Vipers
D4YW4LK3RS
Gangstas 4 Life
Saufköppe
Lukes Gang
The_Pretorians
The Unknown Giants
killerfrösche
Hornet
Feng Sushi
39 Boys
P.F.C.
Stormfront
Salties
DVC
bandito
Holmses
Gertsch`s Gäng
Sanitöter
nudelholz-bande
Don Bigguz
TeilzeitMafiosi
Flügelstuzer
Holy Sanctuary
Die tigers
Knastbrüder AG
Insanes
ogame
unsynetic
Ruff Raider
Raidens Gang
DeutscheGangJäger
Bande der Zeitlosen
calimeros
Hecht
Thok´ra
united fraggers
kleiner gangster
rebell treter
willis-gang
Kenjis-God-Gang
erklärbär
D.A.`s
zecken
B/°
RusskajaMafia
m0wfl0w
Bongomen
Angerfist
CluBBeR
Ravangel
Alkoholikern
The Gracy 88s
Columbian Crime Organisation

}

bind pubm - * forward:pubm

proc forward:pubm {n uh h chan t} {
global targChan srcChan newsBot namesList
if {[string equal -nocase $srcchan $chan]} {
if {[string equal -nocase $newsBot $n]} {
foreach nm $namesList {
if {![string match -nocase *$nm* $t]} {continue}
putmsg $targChan "$n: $t"
break
}
}
}
}

But I have a error message

Tcl error [forward:pubm]: can't read "srcchan": no such variable

thanks for help again

BR/Ralf
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I fixed the error above. Just change $srcchan to $srcChan.

You might want to skip the brackets [] in nicks which contain them. example, add exam\\[p\\]le instead of exam[p]le (since [] have special meaning in string match).
E
Evil
Voice
Posts: 17
Joined: Thu May 10, 2007 5:03 am

Post by Evil »

ok the Message error are fixed but I have another problem :)

in srcChan are 15 bots like GWNEWS-01 - 15.
GW-Support are my eggdrob in target channel

with set newsBot GW-Support are the script not working / posting
when I set newsBot GWNEWS-01 comes only the news from this bot.

since i have an error in my reasoning.. did you have an idea to fix that ?
E
Evil
Voice
Posts: 17
Joined: Thu May 10, 2007 5:03 am

Post by Evil »

did you found a solution for thhis ?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Use GWNEWS-* or GWNEWS-??
E
Evil
Voice
Posts: 17
Joined: Thu May 10, 2007 5:03 am

Post by Evil »

in the srcChan are 15 bots from GWNEWS-01 - GWNEWS-15

and I like to forward only the news with the following names ( see in the top script ) to the target channel.

So I thing i have to change " set newsBot GW-Support " this part ?

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

Post by Sir_Fz »

Try the edited code above. GWNEWS-[01][1-5] means nicknames GWNEWS-01 to GWNEWS-15.
t
tsukeh
Voice
Posts: 31
Joined: Thu Jan 20, 2005 6:22 am

Post by tsukeh »

Sir_Fz wrote:Try the edited code above. GWNEWS-[01][1-5] means nicknames GWNEWS-01 to GWNEWS-15.
How about these bots?

GWNEWS-06
GWNEWS-07
GWNEWS-08
GWNEWS-09
GWNEWS-10
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Should I repeat myself or you can read again? or try the code?
t
tsukeh
Voice
Posts: 31
Joined: Thu Jan 20, 2005 6:22 am

Post by tsukeh »

Trying code then:

Code: Select all

$ tclsh
% set newsBot {GWNEWS-[01][1-5]}
GWNEWS-[01][1-5]
% set newsBots {GWNEWS-01 GWNEWS-02 GWNEWS-03 GWNEWS-04 GWNEWS-05 GWNEWS-06 GWNEWS-07 GWNEWS-08 GWNEWS-09 GWNEWS-10 GWNEWS-11 GWNEWS-12 GWNEWS-13 GWNEWS-14 GWNEWS-15}
GWNEWS-01 GWNEWS-02 GWNEWS-03 GWNEWS-04 GWNEWS-05 GWNEWS-06 GWNEWS-07 GWNEWS-08 GWNEWS-09 GWNEWS-10 GWNEWS-11 GWNEWS-12 GWNEWS-13 GWNEWS-14 GWNEWS-15
% foreach n $newsBots { if ![regexp -nocase $newsBot $n] { puts $n } }
GWNEWS-06
GWNEWS-07
GWNEWS-08
GWNEWS-09
GWNEWS-10
%

Not sure if I am misreading something..
z
zigana
Voice
Posts: 7
Joined: Thu Jul 26, 2007 11:06 am

Post by zigana »

Try this one.

Code: Select all

set newsBot {GWNEWS-(0[1-9]|1[0-5])$}
Post Reply