|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 332 |
i want to be able to change the $mp3dir within a running script my intention was to set it a a %var and then swap it to additional %vars but i couldnt seem to work that out i looked into the /writeini command but it say not to change it while in use ? is it not possible ? my point for doing so is i have 4 mp3 folders and i want to switch from one to another on a random/continous play option thx for any help you can offer
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,321 |
Use %mp3dir instead of $mp3dir and set it for whatever directory you like.
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 332 |
oh man that never crossed my mind lol thx
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 332 |
ok i got it working almost like i want except for i need to go back to the beging of a line instead of all the way back to the top of the alias ? how would i do that i have
alias contplay {
set %mp3dir $rand(1,4)
if ( %mp3dir == 1 ) { set %p3dir c:\documents and settings\desktop\skynyrd tunes\ }
if ( %mp3dir == 2 ) { set %p3dir c:\documents and settings\desktop\motown\ }
if ( %mp3dir == 3 ) { set %p3dir c:\documents and settings\desktop\tunes\ }
if ( %mp3dir == 4 ) { set %p3dir c:\documents and settings\desktop\alternative\ }
:top
set %z 1
set %rand $findfile(%p3dir,*.mp3,$rand(1,$findfile(%p3dir,*.mp3,*)))
run -np %rand
msg $active 1 $+ $chr(91) $+ $+ $rand(1,7) $+ Continuous-Play $+ 1 $+ $chr(93) 1 $&
$+ $chr(91) $+ $+ $rand(1,7) $+ $nopath(%rand) $+ 1 $+ $chr(93)
set %starttime $mp3(%rand).length / 1000
inc %z
.timersong 1 %starttime /contplay
if ( %z > 10 ) {
set %mp3dir $rand(1,4)
goto top
}
} the problem is the the /contplay takes me all the way back to the top i need to go back to the beginning of the line any ideas i looked at /return and while loops but i didnt see it would fix my problem ? can you set a timer on a goto command ? as in .timersong 1 %starttime goto mid and then just add in a :mid ? [EDIT: formatting changes only to fit the forum better]
Last edited by Hammer; 15/02/03 07:43 AM.
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 332 |
ok the .timer goto bit doesnt work ? that was my last idea
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,321 |
I'm not understanding why you even have a goto at all! Your script should end when you start the timer to re-issue the /contplay command when the MP3 ends.
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
|
|
|
|
Joined: Dec 2002
Posts: 204
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 204 |
Are you wanting it to continue for 10 songs, then reset to 0? if so here is your code modified for that purpose without using goto: alias contplay {
if (%z < 10) {
inc %z
var %mp3dir $rand(1,4)
if ( %mp3dir == 1 ) { var %p3dir c:\audio-visual\audio\311 }
if ( %mp3dir == 2 ) { var %p3dir c:\audio-visual\audio\a-teens }
if ( %mp3dir == 3 ) { var %p3dir c:\audio-visual\audio\angels }
if ( %mp3dir == 4 ) { var %p3dir c:\audio-visual\audio\alabama }
var %rand $findfile(%p3dir,*.mp3,$rand(1,$findfile(%p3dir,*.mp3,0)))
run -np %rand
msg $active 1 $+ $chr(91) $+ $+ $rand(1,7) $+ Continuous-Play $+ 1 $+ $chr(93) $&
1 $+ $chr(91) $+ $+ $rand(1,7) $+ $nopath(%rand) $+ 1 $+ $chr(93)
var %starttime $mp3(%rand).length / 1000
.timersong 1 %starttime contplay
}
else set %z 0
}
this will keep playing songs untill %z reaches 10, and then it resets %z to 0. If this isnt what ya want, please try explainin what yer trying to do p.s. please disregard my music selection :0 i knwo i have bad tastes [edit] i changed your global variables (/set) to temp variables (/var) bacause I didnt see any need to have global variables, other than %z which is set when you inc %z, in an alias like this. Also rand(1,$findfile(%p3dir,*.mp3,*)) i changed to rand(1,$findfile(%p3dir,*.mp3,0))
Last edited by keeker; 15/02/03 08:39 AM.
keek: Scots - intr.v. keeked, keekĀ·ing, keeks To peek; peep.
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 332 |
ok you almost got what i want i want to inc %z to 10 when %z is greater than 10 i want to reset the directory then play ten songs from that directory and switch again th point of the goto in answer to Hammer's Question was supposed to do that but obviously it doesnt ? hope that helps make sense of it thx for the help ok i think i got it
alias contplay {
if ( %mp3dir == 1 ) { set %p3dir c:\documents and settings\desktop\skynyrd tunes\ }
if ( %mp3dir == 2 ) { set %p3dir c:\documents and settings\desktop\motown\ }
if ( %mp3dir == 3 ) { set %p3dir c:\documents and settings\desktop\tunes\ }
if ( %mp3dir == 4 ) { set %p3dir c:\documents and settings\desktop\alternative\ }
set %rand $findfile(%p3dir,*.mp3,$rand(1,$findfile(%p3dir,*.mp3,*)))
run -np %rand
msg $active 1 $+ $chr(91) $+ $+ $rand(1,7) $+ Continuous-Play $+ 1 $+ $chr(93) 1 $&
$+ $chr(91) $+ $+ $rand(1,7) $+ $nopath(%rand) $+ 1 $+ $chr(93)
set %starttime $mp3(%rand).length / 1000
inc %z
.timersong 1 %starttime /contplay
if ( %z > 10 ) {
set %z 0
set %mp3dir $rand(1,4)
.timersong off
/contplay
}
} not sure if it works i havent gotten to 10 yet but that might better explain what i wanted and i took out the goto [EDIT: RE-formatted, yet again, the long line to better fit the forum.
Cheech: there is no reason to post long lines like that; they simply mess up the formatting of the forum, making anything with a long reply line require users to use the horizontal scroll bar. Since your long line is just a series of commands, putting each command on a separate line only makes sense. How you actually store it in your mIRC editor is entirely up to you.
-Hammer]
Last edited by Hammer; 16/02/03 04:16 AM.
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 332 |
ok i took out that last /contplay that was unnecessary and its workin fine i have one more question and then i will be finished with it every so often you run accross a file that doesnt play and you get this error * /run: unable to open 'c:\documents and settings\desktop\motown\Motown Smokey Robinson - you really got a hold on me.mp3' (line 6, script4) is there anyway to make it keep going when that happens as it is scripted currently it halts the script when that happens ? thx
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
alias contplay {
if !$1 {
var %a = $rand(1,4)
if %a == 1 { set %p3dir c:\documents and settings\desktop\skynyrd tunes\ }
if %a == 2 { set %p3dir c:\documents and settings\desktop\motown\ }
if %a == 3 { set %p3dir c:\documents and settings\desktop\tunes\ }
if %a == 4 { set %p3dir c:\documents and settings\desktop\alternative\ } }
}
var %b = $findfile(%p3dir,*.mp3,$r(1,$findfile(%p3dir,*.mp3,0)),run -np $1-)
msg $active $+(1[,$r(1,7),Continuous-Play1] [,$base($r(1,7),10,10,2),$nopath(%b),1])
.timersong 1 $calc($mp3(%rand).length / 1000) contplay $calc(($1 + 1) % 10)
}
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 332 |
can you explain what you changed i'm not sure i c what you did ?
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
Firstly, the temporary /vars now have shorter names alias contplay {
if !$1 {
[color:green]; If the command was simply "contplay" or "contplay 0", the above is $true, and we set the directory[/color]
var %a = $rand(1,4)
if %a == 1 { set %p3dir c:\documents and settings\desktop\skynyrd tunes\ }
if %a == 2 { set %p3dir c:\documents and settings\desktop\motown\ }
if %a == 3 { set %p3dir c:\documents and settings\desktop\tunes\ }
if %a == 4 { set %p3dir c:\documents and settings\desktop\alternative\ } }
}
[color:green]; else we have jumped to here
; $r(N,N) is a shortened version of $rand(N,N)
; next line is the same except the /run -np 'filename' is moved into the $findfile()[/color]
var %b = $findfile(%p3dir,*.mp3,$r(1,$findfile(%p3dir,*.mp3,0)),run -np $1-)
[color:green]; next line is the same except using $+() instead of bulk "$+" ;s and "$chr()" 's[/color]
msg $active $+(1[,$r(1,7),Continuous-Play1] [,$base($r(1,7),10,10,2),$nopath(%b),1])
[color:green]; next we will set the timer to repeat
; adding the iteration; eg contplay 1, 2, 3,.., 9, 0
; $calc(($1 +1) % 10) = $null/0 add 1 and then % (modulo) 10, to result in
; 1 2 3 4 5 6 7 8 9 and finally, 9 + 1 % 10 = 0 again, so the dir will be reset[/color]
.timersong 1 $calc($sound(%b).length / 1000) contplay $calc(($1 + 1) % 10)
} edit-- Changed the last line to use $sound instead of $mp3, and also to use the %b var instead of %rand
Last edited by Nimue; 16/02/03 02:37 AM.
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 332 |
ok i hate to be a bother just trying to learn as i go ? by putting the $+( then all this stuff ) it makes it so i dont have to use the $chr() ? and by changing up the /run that takes care of the error *unable to run etc..... ? if thats all true then i understand that part but i still dont understand the $base identifier i looked in the help but unfortunaly that didnt make any sense ?
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
The error may be caused by double spaces in the filename. You could change var %b = $findfile(%p3dir,*.mp3,$r(1,$findfile(%p3dir,*.mp3,0)),run -np $1-) to var %b = $findfile(%p3dir,*.mp3,$r(1,$findfile(%p3dir,*.mp3,0)),run -np $1-).shortfn to see if it helps.
|
|
|
|
|