xNCx Posted August 2, 2010 Share Posted August 2, 2010 What is wrong with this code? ...wait 100 0209: $id = random_int 1 6 if $id == 1then 03CF: load_wav 'BNK4_1' as $idendif $id == 2then 03CF: load_wav 'BNK4_21' as $idendif $id == 3then 03CF: load_wav 'COK1_5' as $idendif $id == 4then 03CF: load_wav 'COK1_6' as $idendif $id == 5then 03CF: load_wav 'COK4_14' as $idendif $id == 6then 03CF: load_wav 'COK4_25' as $idendwait 103D1: play_wav $id... It plays only 2 of 6 files . Link to comment Share on other sites More sharing options...
toonskull Posted August 2, 2010 Share Posted August 2, 2010 You are probably not allowing it to play the wav file before it loads the next. You need a wait loop. 03CF: load_wav 'BNK4_1' as 1 :loop1wait 0if 03D0: wav 1 loaded jf @loop103D1: play_wav 1:loop2wait 0if 03D2: wav 1 ended jf @loop2040D: unload_wav 1 Link to comment Share on other sites More sharing options...
james227uk Posted August 2, 2010 Share Posted August 2, 2010 Unless I misunderstood your reply, that doesn't seem to be what he wants. It seems as though he has a random choice pick for audio, but the game only picks 2 of the 6 at random. Link to comment Share on other sites More sharing options...
xNCx Posted August 2, 2010 Author Share Posted August 2, 2010 That helped thank you very much! @James: It helped. However I don't understand why 2 of 6 files could load and the other 4 not before? Link to comment Share on other sites More sharing options...
toonskull Posted August 3, 2010 Share Posted August 3, 2010 (edited) That helped thank you very much! @James: It helped. However I don't understand why 2 of 6 files could load and the other 4 not before? James is correct that random comand is kind of weird (not your code). I think you might need to say; 0209: $id = random_int 0 5 and readjust your numbers to match 0 to 5. BTW ...0209: $id = random_int 0 5if $id == 0then 03CF: load_wav 'BNK4_1' as 1:loop1wait 0if 03D0: wav 1 loadedjf @loop103D1: play_wav 1:loop2wait 0if03D2: wav 1 endedjf @loop2040D: unload_wav 1end... Edited August 3, 2010 by toonskull Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now