mIRC Home    About    Download    Register    News    Help

Print Thread
#74642 09/03/04 08:16 PM
Joined: Mar 2004
Posts: 10
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Mar 2004
Posts: 10
Hi !
I am trying to get my script to scan a text file .. and if he find the words that he is looking for .. WRITE them to the room ..

I am not getting very far he will read the file but will only do a random msg not the specific one. This is how far I got

on ^*:text:*>>>>*:#: {
if ($2 isin $read(dedike.txt)) {
msg $chan ok {
else echo Unknown
}
}
If for instance the words Buddy Holly have been put in the dedike.txt file by someone .. and the script has to scan to see if Buddy Holly is there each time a record is played on the chat radio .. if a Buddy Holly record is played .. I want it to write in the channel ... the sentence about Buddy Holly ..that is in the text file ..

gosh hope that makes sense confused

I read all the $read and /write help files but I couldn't find anything

thankx in advance

caspi

#74643 09/03/04 11:59 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
$read is slow if call it intensively, like when reading several lines from a file. It's better to use one-instance commands like /filter, /loadbuf or the new file handling feature (/help /fopen). Here is an example:
  • On *:text:>>>> *:#:{
    var %limit = 6
    window -h @@
    filter -fw dedike.txt @@ * $+ $$2-*
    if !$filtered {
    msg # Sorry - no results!
    }
    else {
    if $filtered > %limit {
    dline @@ $calc(%limit + 1) $+ -
    aline @@ Too many results ( $+ $ifmatch $+ ). Please narrow your query.
    }
    else aline @@ Finished
    savebuf @@ tmp.txt
    msg # Query: $2-. Listing results...
    .play # tmp.txt
    .remove tmp.txt
    }
    close -@ @@
    }
If you wonder what a specific command does, look it up in the help file: /help /command. If you have more questions regarding this code please post them below. Enjoy laugh

/filter tutorial

#74644 10/03/04 12:08 PM
Joined: Mar 2004
Posts: 10
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Mar 2004
Posts: 10
wow thanx ..

I am trying to go through that tutorial ... it is quite difficult for me ...

What I do not understand in the thread above is the two @@ you always put ...

do I have to put something there ??

I tried the whole thread as it is but it is not replying yet ...

I really thought it would be much easier to get a script to write out a line from a text file

is there no easier way ??

Is it possible to read variables ?? sort of like $read ($var %_dedication) ??

can that be a possibility ??
thannx for your patience

caspi

#74645 10/03/04 07:21 PM
Joined: Mar 2004
Posts: 10
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Mar 2004
Posts: 10
Can I do something like this ????

it doesn't read this the $2- is wrong

on *:text:*now playing*:#: {
/filter -ff dedike.txt temp.txt $+(*,$2-,*)
msg $chan $read(temp.txt)
.remove temp.txt
}

I am sooooo frustrated

#74646 11/03/04 02:14 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Quote:
I am trying to go through that tutorial ... it is quite difficult for me ...

It's not a tutorial for beginners, but it would be cool if you master this command.


Quote:
What I do not understand in the thread above is the two @@ you always put ...

@@ is merely a window name. You can change it to anything you like, as long as it begins with a @.


Quote:
Is it possible to read variables ?? sort of like $read ($var %_dedication) ??

Easily, //msg #channel %variable


Quote:
Can I do something like this ????

it doesn't read this the $2- is wrong

on *:text:*now playing*:#: {
/filter -ff dedike.txt temp.txt $+(*,$2-,*)
msg $chan $read(temp.txt)
.remove temp.txt
}

The reason my script was long is that I wanted to limit the amount of results, but you can definitely go in the easier way as you just posted.

But, if you want to send the whole file to the channel (and not only a random line), change msg $chan $read(temp.txt) to play $chan temp.txt

Also, keep in mind that $2- returns the second word, on to the end of the sentence (so if somebody said "I am playing song name.mp3", $2- will be "am playing song name.mp3"). Is this what you really want?

#74647 11/03/04 12:24 PM
Joined: Mar 2004
Posts: 10
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Mar 2004
Posts: 10
HI and thanx so much ..

this thing is driving me nuts ... basically the whole thing works ONLY if I put for ex a singer's name in the *$2-* bit like this

On *:text:*radio track-*:#: {
var %limit = 6
/window -h @prova
/filter -fw dedike.txt @prova *dido*

but it refuses to recognise the text with any of these:

*$2-*
$+(*,$2-,*)
* $+ $$2-*

the text which goes to the channel is without font and as follows:
RADIO TRACK- -REM - Day Sleepers <<<< - - BE YOU OWN DJ AND CHOOSE THE TRACKS FROM HERE --->playlist.cgi

so that seems to be the problem ...

I also tried this

on *:text:*radio track-*:#: {
/filter -ff dedike.txt temp.txt *dido*
.read temp.txt
.remove temp.txt

identical problem

it does however recognise this

on *:text:*RADIO TRACK-*:#:/msg $chan $+(*,$2-,*)
on *:text:*RADIO TRACK-*:#:/write trial.txt $+(*,$2-,*)

would there be any way of filtering TWO text files

so I could compare dedike.txt with trial.txt and write the results to a third file ??????

sorry to bug you with this but it is really important for my radio =))))

thanxxxxxxxxxxxxx

seta



#74648 11/03/04 03:14 PM
Joined: Mar 2004
Posts: 10
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Mar 2004
Posts: 10
Just to say an ENORMOUS

(((((( THANK YOU =)))))))

to ONLINE .....

for your kindess and skill

(K)


#74649 11/03/04 04:04 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
You're welcome laugh *hands a cookie*


Link Copied to Clipboard