mIRC Home    About    Download    Register    News    Help

Print Thread
#11142 15/02/03 02:51 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
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 smile

#11143 15/02/03 03:01 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Use %mp3dir instead of $mp3dir and set it for whatever directory you like. laugh


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#11144 15/02/03 03:03 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
oh man that never crossed my mind lol thx smile

#11145 15/02/03 05:01 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
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
Code:

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.
#11146 15/02/03 05:28 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
ok the .timer goto bit doesnt work ? that was my last idea

#11147 15/02/03 07:50 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
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
#11148 15/02/03 08:11 AM
Joined: Dec 2002
Posts: 204
K
Fjord artisan
Offline
Fjord artisan
K
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:

Code:
 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 smile

p.s. please disregard my music selection :0 i knwo i have bad tastes smile

[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.
#11149 16/02/03 12:38 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
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 smile


ok i think i got it
Code:
 

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 smile

[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.
#11150 16/02/03 01:21 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
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 smile

#11151 16/02/03 01:25 AM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Code:
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)
}

#11152 16/02/03 01:37 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
can you explain what you changed i'm not sure i c what you did ?

#11153 16/02/03 02:10 AM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Firstly, the temporary /vars now have shorter names smile
Code:
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.
#11154 16/02/03 02:17 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
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 ?

#11155 16/02/03 02:26 AM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
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.


Link Copied to Clipboard