OpenB3D TSound Arrays Support

BlitzMax Forums/MiniB3D Module/OpenB3D TSound Arrays Support

RustyKristi(Posted 2016) [#1]
I would like to play randomize sound using an array, I'm getting some error that arrays are not supported for TSound


markcw(Posted 2016) [#2]
Without seeing the code or having an exact error message I'm not sure what's wrong. You'd make an array like Local arr:TSound[] then when you add a new object use a slice arr=arr[..inc+1] and arr[inc]=obj see the language reference for arrays and slices.

You can also use a list with Local list:TList=New List and then ListAddLast list,obj with a loop For t:TSound=EachIn list and as it's in order you can index them like you would an array with this sort of thing count:+1 ; If count=sound5 then Exit, lists are more flexible than arrays.

Also if you're not sure about how something works, start with it on its own before adding it to a project, I do that quite a bit.


RustyKristi(Posted 2016) [#3]
Ok I will try it again. Yea, sometimes in the middle of things, I'm always forgetting to do that. xD