| View previous topic :: View next topic |
| Author |
Message |
Evil Voice
Joined: 10 May 2007 Posts: 17
|
Posted: Mon Jul 23, 2007 12:30 pm Post subject: Script Problem for a simple copy script |
|
|
Hello together,
I have an script to copy news from channel A to Channel B
| Quote: | 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 |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon Jul 23, 2007 3:50 pm Post subject: |
|
|
Could you repeat your question in a more understandable form? _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Evil Voice
Joined: 10 May 2007 Posts: 17
|
Posted: Mon Jul 23, 2007 4:20 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon Jul 23, 2007 6:24 pm Post subject: |
|
|
| Code: | 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. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts
Last edited by Sir_Fz on Mon Sep 17, 2007 4:38 pm; edited 3 times in total |
|
| Back to top |
|
 |
Evil Voice
Joined: 10 May 2007 Posts: 17
|
Posted: Tue Jul 24, 2007 3:27 am Post subject: |
|
|
firstly thanks for your help.
after your tip i wrote the names inside like this:
| Quote: | 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 |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jul 24, 2007 6:44 am Post subject: |
|
|
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). _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Evil Voice
Joined: 10 May 2007 Posts: 17
|
Posted: Tue Jul 24, 2007 7:14 am Post subject: |
|
|
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 ? |
|
| Back to top |
|
 |
Evil Voice
Joined: 10 May 2007 Posts: 17
|
Posted: Wed Aug 01, 2007 3:47 am Post subject: |
|
|
| did you found a solution for thhis ? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
Evil Voice
Joined: 10 May 2007 Posts: 17
|
Posted: Tue Aug 07, 2007 3:00 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Aug 09, 2007 5:14 pm Post subject: |
|
|
Try the edited code above. GWNEWS-[01][1-5] means nicknames GWNEWS-01 to GWNEWS-15. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
tsukeh Voice
Joined: 20 Jan 2005 Posts: 31
|
Posted: Fri Aug 10, 2007 2:51 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Aug 10, 2007 6:07 pm Post subject: |
|
|
Should I repeat myself or you can read again? or try the code? _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
tsukeh Voice
Joined: 20 Jan 2005 Posts: 31
|
Posted: Sat Aug 11, 2007 9:00 am Post subject: |
|
|
Trying code then:
| Code: |
$ 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.. |
|
| Back to top |
|
 |
zigana Voice
Joined: 26 Jul 2007 Posts: 7
|
Posted: Sat Aug 11, 2007 9:27 am Post subject: |
|
|
Try this one. | Code: | | set newsBot {GWNEWS-(0[1-9]|1[0-5])$} |
|
|
| Back to top |
|
 |
|