mIRC Homepage
Posted By: pheonix example - 03/08/03 05:41 PM
Code:
alias getmp3 {
  var %mp3.dir C:\Documents and Settings\MAT\My Documents\mats folder\My Music\
  $findfile(%mp3.dir,$+(*,$1,*,.mp3),0,echo -a $nopath($1-))
}


i type: /getmp3 tidy
it returns:
tidy boys - bits and pieces.mp3
tidy boys - chainsaw.mp3
tidy boys - cant top it.mp3
tidy boys - colours.mp3
tidy boys - devotion.mp3
tidy boys vs tidy girls - blow ya load.mp3
tidy boys - dance 2 the house.mp3
-
* /7: not connected to server (line 7, script.ini)
line 7 = $findfile line

(this last line does not allow me to make a while loop for such a situation which is what i need it for)
Posted By: codemastr Re: example - 03/08/03 05:48 PM
Thats because $findfile returns a value. You have to store the value somewhere, or do something with it.

alias getmp3 {
var %mp3.dir C:\Documents and Settings\MAT\My Documents\mats folder\My Music\
.echo -q $findfile(%mp3.dir,$+(*,$1,*,.mp3),0,echo -a $nopath($1-))
}
Posted By: pheonix Re: example - 03/08/03 06:12 PM
i know that but i dont see why it returns 7 at all....
Posted By: codemastr Re: example - 03/08/03 06:21 PM
Because it returns the number of files matched. lets do some counting, shall we?

tidy boys - bits and pieces.mp3 -1
tidy boys - chainsaw.mp3 - 2
tidy boys - cant top it.mp3 - 3
tidy boys - colours.mp3 - 4
tidy boys - devotion.mp3 - 5
tidy boys vs tidy girls - blow ya load.mp3 - 6
tidy boys - dance 2 the house.mp3 - 7

7, 7 matched files. I don't see why that is so hard to grasp.
Posted By: pheonix Re: example - 03/08/03 08:56 PM
i also noticed that but shouldnt it have a switch or something........
Posted By: Collective Re: example - 03/08/03 09:30 PM
Code:
alias getmp3 {
  var %mp3.dir C:\Documents and Settings\MAT\My Documents\mats folder\My Music\
  .echo -q $findfile(%mp3.dir,$+(*,$1,*,.mp3),0,echo -a $nopath($1-))
}
Posted By: pheonix Re: example - 03/08/03 09:34 PM
now it echos a 7 on the last line anyway....
Posted By: Collective Re: example - 03/08/03 09:37 PM
If it echo's a 7 then you either have an echo alias or have copied it wrong, probably by accidentally removing the . in the .echo command.

Many scripts use the exact same way of doing things, which is why it was mentioned in this Feature Suggestion.

Edit: I also just noticed that codemastr posted the exact same script..
Posted By: pheonix Re: example - 04/08/03 01:59 PM
i copied and pasted codemastr's which echo's 7 at the end.
wont .echo -q make it wait till after the findfile command then echo the number of matches
Posted By: starbucks_mafia Re: example - 04/08/03 02:15 PM
Code:
alias getmp3 { 
var %mp3.dir = C:\Documents and Settings\MAT\My Documents\mats folder\My Music\ 
.!echo -q $findfile(%mp3.dir,$+(*,$1,*,.mp3),0,echo -a $nopath($1-))
}


There is no way in hell that that alias will echo the number of matches. The -q switch means that the /echo will be silent (won't echo) if there's a . prefixed before it. The ! is there to make sure it uses the built-in /echo and not any aliases for /echo you might have. If that echoes the number of matches then you're either doing something very wrong or your computer has issues.
Posted By: pheonix Re: example - 04/08/03 02:16 PM
just like i said, i pasted it exactly......
Posted By: starbucks_mafia Re: example - 04/08/03 02:23 PM
If you pasted my exact code, fixed the newlines (sometimes when you paste it will be put all on one line), and you're still getting the number of matches then there's something very wrong. It's possible you've got another alias by the same name, so use the search feature to check that isn't the case. Otherwise... all I can recommend is that you reinstall mIRC. There's nothing else I can do to help.
Posted By: pheonix Re: example - 04/08/03 02:28 PM
if you noticed my posts in scripts n popups you would notice i quit mirc, so therefore ive only just reinstalled and this is my only file loaded.
Posted By: Collective Re: example - 04/08/03 03:29 PM
Then apparantly it works for everyone but you, since the same method is used for hundreds of scripts (many very popular ones).

Remove the alias and type //echo -a $isalias(getmp3), perhaps you have an old version of the alias still loaded?
Posted By: pheonix Re: example - 04/08/03 03:47 PM
nope i have 1 file loaded, with 2 aliases, the other is to loop through using /getmp3 so i can use it like /listmp3 a t f
which would do: /getmp3 a,/getmp3 t,/getmp3 f.
fixed it now.
© mIRC Discussion Forums