![](templates/Classic/images/spacer.gif) |
Asellion Newbie
Joined: 29 Jul 2011 Posts: 4 Location: United States
|
Posted: Fri Jul 29, 2011 11:58 pm
#Play |
Hi everyone,
New to Cmud, trying to get my scripts over. One such script are the sound ones I use for combat. I have a bunch of sound files in a folder that I use, and I randomize the files to keep things dynamic. In Zmud the exact syntax was:
#PLAY C:\ZMUD\RESOURCE\SOUNDS\MISS*.wav"
The key thing there is the *. What is the equal of this in cmud?
When I use a direct file name it works fine, so I know it's not an issue of the files not being in the correct directory or something. As far as I can tell it's just the *.
I'd prefer to not have to hardcode anything, since sometimes I may have 2 files or 20 files for a given trigger. Any ideas?
Thanks everyone.
-Asellion |
|
|
![](templates/Classic/images/spacer.gif) |
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Sat Jul 30, 2011 12:05 am |
As far as I know, you can't use wildcards in path names like that. I'm assuming you use numbers after the file names? You could do something like #PLAY %concat("C:\ZMUD\RESOURCE\SOUNDS\MISS",%random(1,x),".wav") if you do... Of course, you would need to store the max numbers for each file in a variable that way...
|
|
|
![](templates/Classic/images/spacer.gif) |
Asellion Newbie
Joined: 29 Jul 2011 Posts: 4 Location: United States
|
Posted: Sat Jul 30, 2011 12:20 am |
Hrm you used to be able to in zmud. Well, your suggestion is a good start and seems to work pretty well, so thank you for taking the time to respond. I do appreciate it. =)
|
|
|
![](templates/Classic/images/spacer.gif) |
shalimar GURU
![](images/avatars/114658559147aeed8fee539.gif)
Joined: 04 Aug 2002 Posts: 4717 Location: Pensacola, FL, USA
|
Posted: Sat Jul 30, 2011 12:22 am |
$files=this|that|the other
$thisFile= %item($files, %random(1, %numitems($files)))
#PLAY $thisFile |
|
_________________ Discord: Shalimarwildcat |
|
|
![](templates/Classic/images/spacer.gif) |
Asellion Newbie
Joined: 29 Jul 2011 Posts: 4 Location: United States
|
Posted: Sat Jul 30, 2011 12:27 am |
That seems a bit of work (I have a few hundred files) for what used to be a one character command. =)
Another question - #Play used to stop and play a new file of the same type when it was executed. For example if I had a .mid playing, and then executed another #play on a midi file, the first file would stop playing and the second would start. Now it seems that the first one continues to play and the other one is either ignored or only plays if the first one finishes before the second one would finish.
I've tried #play stop to get around this issue but it doesn't seem to work. Any ideas on how to get back to the previous behavior?
Thanks again guys.
Edit: I'm a putz, it's #play off. |
|
|
![](templates/Classic/images/spacer.gif) |
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Sat Jul 30, 2011 1:14 am |
Making a list of every single file would be a lot of work, yes, but I don't think it's necessary. Was I correct in assuming you're just using a number after the file 'type', to distinguish between the different miss sounds, hit sounds, etc? If that's the case, you really only need to store the max for each type in a variable. Example code:
Code: |
#VAR maxfilenums {miss=13|hit=17|etc}
#ALIAS playfile {#IF %iskey(@maxfilenums,%1) {#PLAY off;#PLAY %concat("C:\ZMUD\RESOURCE\SOUNDS\",%1,%random(1,%db(@maxfilenums,%1)),".wav")} {#SAY %concat("Unknown file type: ",%1,".")}} |
|
|
|
![](templates/Classic/images/spacer.gif) |
Asellion Newbie
Joined: 29 Jul 2011 Posts: 4 Location: United States
|
Posted: Sat Jul 30, 2011 1:27 am |
You are correct and that's an excellent idea, thanks!
|
|
|
![](templates/Classic/images/spacer.gif) |
|
|