mIRC Home    About    Download    Register    News    Help

Print Thread
#260820 22/06/17 06:47 AM
Joined: Jun 2017
Posts: 6
T
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Jun 2017
Posts: 6
Hi,

It's my first attempt at scripting, and it's going bad, i hope someone can help me here.

I want to echo a prebot on this network/chan (Corrupt-Net | #PRE) to another network.
I found a script on this board, tried to tweak it, but i don't seem to make it work.

Here the script :

Quote:
on *:TEXT:*:#PRE:{
var %e = /^\X264|TV-HD|MULTi|COMPLETE|GAMES/0DAY/iS
var %f = /(?:GERMAN|SPANiSH|iTALiAN|XXX|XXX-0DAY)/iS
if ($regex($1-,%e)) {
if (!$regex($1-,%f)) {
if ($network == Corrupt-net) {
var %text = $read(FILENAME,W,$+(*,$2-,*))
var %i = 1
var %netcnt = $scon(0)
while (%i <= %netcnt) {
if ($scon(%i).network == MYNETWORK) {
scon $scon(%i)
.msg #MY-PRE-CHAN <PRE> $1- $date
}
inc %i
}
}
}
}
}



So if someone can point me to where the problem is, i would appreciate it.

Thanks.

the_banana #260821 22/06/17 02:27 PM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
1. It helps if you give an idea what the problem is, so people know where to look. If you add a few lines like

//echo -s $scriptline optional variables

You can see if your code is making it inside if() statements when it should, etc.

2. You didn't report a problem of seeing "no such connection number" error in your status window, so we don't know if you just didn't notice the error, or if the code isn't reaching that point, but the line

scon $scon(%i)
should be
scon %i

3. Your read statement should also use the 'n' switch so that lines containing $identifiers don't get executed.

4. Also, switches are ALWAYS case sensitive, so if the helpfile mentions switch 'w' but not 'W', don't use 'W'. In this case, by using a non-existent switch, you're getting line#1 each time, even if it doesn't contain any text.

Edit to add #5
5. Once you've found which connection has your destination channel, use /break to avoid wasting time continuing to search through the rest of the connections.



Last edited by maroon; 22/06/17 02:51 PM.

Link Copied to Clipboard