mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2004
Posts: 3
N
Noiz Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Apr 2004
Posts: 3
Hi there..
Well, im new to scripting and this is my first script smile

This is my script:
Code:
 
on *:TEXT:!favorits:#: { 
/msg $chan $read(favorits.txt) 
} 

My problem is that, with this code, it only reads some random line in the txt file.
What I want it to is read the whole file and not some random line or some specfic line.
I could use some help laugh


#Slaske @ Quakenet
Joined: Feb 2004
Posts: 14
L
Pikka bird
Offline
Pikka bird
L
Joined: Feb 2004
Posts: 14
Try this

on *:TEXT:!favorits:#: {
play $chan $mircdirfavorits.txt 100
}

LittleJohnsr



Last edited by LittleJohnsr; 28/04/04 06:20 PM.
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
use a higher number than 100 though, unless it's a really small file, otherwise you risk flooding off. (1000 = 1 second), adjust as needed for the network you are on.

Joined: Apr 2004
Posts: 3
N
Noiz Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Apr 2004
Posts: 3
Weee.. grin

Thx m8s.. :tongue:

It works perfect now..

i'll be back soon with a new problem laugh


#Slaske @ Quakenet
Joined: Feb 2004
Posts: 14
L
Pikka bird
Offline
Pikka bird
L
Joined: Feb 2004
Posts: 14
Your welcome and Wolfie is right that was a fat finger moment should have been 1000 blush

Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
I stated to adjust as necessary, because if it's a short file (say 4 lines, which is still a flood risk in itself)..

4 lines listed real fast is no biggy.. If the IRC allows, say, 20 lines before flooding, then a small file is nothing, and 100 is ok. 1000 is still too fast and can cause flooding if it lasts for too long... etc..

Being one paranoid of flooding...
Code:
on *:TEXT:!favorits:#:if (!$hget(faves,$+($cid,#))) { play $chan favorits.txt 1000 | hadd $+(-mu,$calc(30 + $lines(favorits.txt))) faves $+($cid,#) $ticks } }

That *should* prevent someone from activating it from the time it starts to 30 seconds after it stops (if you set it for 1 line per second)

Joined: Apr 2003
Posts: 25
S
Ameglian cow
Offline
Ameglian cow
S
Joined: Apr 2003
Posts: 25
You could try this..

on *:TEXT:!favorits:#: {
if (%nospam.favorits) { return }
else {
set -u20 %nospam.favorits true
var %y = 0
var %z
while ( %y <= $lines(favorits.txt) ) {
var %z = %z $read(favorits.txt,%y)
inc %y
}
msg $chan %z
}
}

Not tested.

Last edited by SS217; 28/04/04 08:17 PM.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

I've made you a quick script that will open a dcc chat to the persons typing !favorits in your channel, and it will msg your favorites to them through the dcc chat, which is lagless, so they'll have it instantly, without having to worry about getting flooded off the server, since dcc chat is a direct connection between you and the other person.

I've added an extra option, that if you are unable to connect to them in 15 seconds, that you will play the file to them as stated in the previous replies by the other people.

Put the following into your remotes:
Code:
 
on *:TEXT:!favorits:#: if !$timer($nick) { .timer $+ $nick 1 15 check.dcc $nick | dcc chat $nick } 
on *:OPEN:=:{
  if $timer($nick) {
    .timer [ $+ [ $nick ] ] off
    var %x = 1, %file = $+(",$mircdir,favorits.txt,")
    while %x &lt;= $lines(%file) { msg =$nick [Favorits] $read(%file,%x) | inc %x }
  }
}
alias check.dcc { 
  if $chat($1).status != active { 
    close -c $1   
   .notice $1 I was unable to open a dcc chat to you. Here come my favorits: 
    play $1 $+(",$mircdir,favorits.txt,") 1000 
  }
}


Note how I use $+(",$mircdir,favorits.txt,"), this will make sure that the file will be found, if the path to the file would contain spaces. E.g. c:\program files\mirc\favorits.txt

Btw, the correct word is 'favorites', though everyone is free to use whatever word they want of course smile

Hope this was somewhat helpful for you!

Greetz


Gone.
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
No offense, but that wouldn't work. If the file has 25 lines in it, 25 characters each line (and that's small when you think about it), that's 625 characters. My experience has been that it the IRC won't allow that much on one line. And that's a low estimate of what could be in the file.

Joined: Apr 2004
Posts: 3
N
Noiz Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Apr 2004
Posts: 3
well...
I must say that im suprised to get all that response.
But its not that kinda advance script (its my first script).
So im using Wolfie's code, and it works great.. laugh

But thx for all that help..
i'll be back with new problems :P

/Noiz


#Slaske @ Quakenet

Link Copied to Clipboard