lel Posted August 30, 2013 Author Share Posted August 30, 2013 Anyone happen to know whats wrong with this area? Client side under General```Sub StopSound(soundindex As Long) FSOUND_StopSound Sounds(soundindex).ChannelEnd Sub ```Highlighting "FSOUND_StopSound Sounds(soundindex).Channel"With Runtime error 9 subscript out of range like 90% of all the errors. I was trying to add an event that starts and stops a sound at random. While the sound is playing it seems everything is ok (I'm not 100% sure yet, as my client is crashing on me) I have tried a few things I.E. looking at other peoples code (most other working code is in BASS >.> ) and such. I guess I would be lying if I said I am not starting to go from loving FMOD to hating it. Any help would be appreciated. Link to comment Share on other sites More sharing options...
PD Posted August 30, 2013 Share Posted August 30, 2013 The only thing that comes to mind is that 'soundindex' is larger than the upper limit of the 'Sounds' array. Link to comment Share on other sites More sharing options...
Sealbreaker Posted August 30, 2013 Share Posted August 30, 2013 I think that "Subscript out of range" means that the variable given to the method is not valid in some sort (Too high probably). I don't know how eclipse manages sounds etc. but you should look out for how the sound playing is indexed and if that index is somehow changed or read in a different way which could cause that error.If I knew the engine better I could help more, but I hope that this could give you a clue atleast.Good luck,-seal Link to comment Share on other sites More sharing options...
lel Posted August 30, 2013 Author Share Posted August 30, 2013 Weird, so I actually want to see how sound is starting and not the area that sound is being stopped? Ok I will look into it. Is there any values that " too high" would look like ? Link to comment Share on other sites More sharing options...
lel Posted August 30, 2013 Author Share Posted August 30, 2013 Edit: I forgot my version of FMOD doesn't play sounds under IDE or under source mode if you will.Replacing the (soundindex) with a 1 making it (1) instead of (soundindex) keeps the error from accruing. Now when sounds are set to play again from that event it will play the sound ;however, it freezes the client. No error message or anything. Link to comment Share on other sites More sharing options...
Baron Posted August 30, 2013 Share Posted August 30, 2013 subscript out of range occurs when a value supplied to a function exceeds the limits of its range as declared.Few different methods of approaching a fix.run up the source and stop it like you have attempted to, when it errors hold the mouse over the function and examine each of the variable values to determine which variable has a value that is outside its standard range.My suspicion is that whatever is supplying this sub with index values is supplying more values than there are soundindexs to stop.```Sub StopSound(soundindex As Long) FSOUND_StopSound Sounds(soundindex).ChannelEnd Sub ``` Link to comment Share on other sites More sharing options...
lel Posted August 30, 2013 Author Share Posted August 30, 2013 ```Sub StopSound(soundindex As Long) FSOUND_StopSound Sounds(1).ChannelEnd Sub```Fixes the error. Link to comment Share on other sites More sharing options...
lel Posted August 30, 2013 Author Share Posted August 30, 2013 My new problem is that playing a sound using events causes the sound to keep playing over and over every half a second (or less) this makes the game lag really badly. I think there is a little more detail to this than I know. I was able to make an event where someone gets attacked and a sound played once they got attacked, with no problems.) So I have some investigating to do. Thanks for your replys guys, you helped allot. Link to comment Share on other sites More sharing options...
Stein Posted August 30, 2013 Share Posted August 30, 2013 I wouldn't call that a fix at all, it just stops it from crashing. Link to comment Share on other sites More sharing options...
lel Posted August 30, 2013 Author Share Posted August 30, 2013 I'll agree with that, but do you know of any thing that adjustment would conflict with?(just off the top of your mind) Link to comment Share on other sites More sharing options...
Baron Posted August 31, 2013 Share Posted August 31, 2013 Can't believe i missed that error! I thought you had just cropped out the rest of the routine. Link to comment Share on other sites More sharing options...
lel Posted August 31, 2013 Author Share Posted August 31, 2013 What do you mean you missed it? Do you have the same problem in your engine? Link to comment Share on other sites More sharing options...
Baron Posted August 31, 2013 Share Posted August 31, 2013 > What do you mean you missed it? Do you have the same problem in your engine?No no, in the original post end sub is on the end of same line as the channel as a single word at the end.The end sub has to be seperate from the logic the same way you posted your fix.```Sub StopSound(soundindex As Long)FSOUND_StopSound Sounds(1).ChannelEnd Sub```Also, whoever decided dark purple on black was a good colour scheme has holes in their fricken head. Link to comment Share on other sites More sharing options...
lel Posted August 31, 2013 Author Share Posted August 31, 2013 Oh the End Sub was actually already put in the right spot. That was my goof when pasting the code in the first place v.v 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