Arrays again.. heavens above I loathe these things.
-
Got a problem yet again with arrays, I am beginning to loathe them beyond words as array problems seem to crop up in everything I do and I get beyond frustrated by it constantly happening.
So before I condemn yet another failed game to the bin, I plead for help yet again. (yes, I'm getting tired of me too, let alone you)
This is what I'm getting
The array is setup before the main game loop here
and here is where it is called during the game
What's the cure? (apart from clubbing me over the head in the attempt to knock some sense in)
Thank you again
-
That happened to me and I fixed it by adding 1 to where you have pipes[8] so it would be pipes[9] and it worked and when I put it back it still worked but idk if this will work for you.
-
I'll give it a go, thanks!
(Edit: changing it to 9 makes it error the instant I run it.) -
Well good luck then š
I see no issuesYour so smart you broke it with good code
-
Humor me. Throughout your function please change āIā to ā_Iā or some other variable name (Bob?) and let me know...
-
I did as you asked Martin and well.. I might be jinxing it by saying this but its been running for like 4 mins with no issue yet.
Thank you so much, it seems the fault was not me and here I was beating myself over the head for being stupid.
-
A for loop over an array:
for i = 0 to len(array) loop // do something with array[i] repeat
should never give an array index out of bounds message
However I have seen this message sometimes in relation to a memory leak. This is where memory is being allocated by the system but never freed. The end result is that you run out of usable memory. Again this shouldn't be your problem. I have an example where this happens consistently and I have raised an issue for someone to look into it.
I would like to get more examples so if this happens to you can you please share the program and let me know
-
@SteveZX81 said in Arrays again.. heavens above I loathe these things.:
Thank you so much, it seems the fault was not me and here I was beating myself over the head for being stupid.
I program professionally for a living and make array-related mistakes in Fuze all the time, lol :D So don't sweat it even when it is you!
One common one I do is loop to "len(array) -1", since lots of languages work that way. Doh!
-
I think @pianofire 's point here is most salient. You should never receive that error message in a for loop like this:
for i = 0 to len(array) loop // do something with array[i] repeat
What's happening here is not a result of your programming Steve!
If you start to do
0 to len(array) - 1
, you will run into the issue of the final element not being worked on. Unless of course, that is what you need it to do! -
It's a bug in Fuze. Nothing to do with Steve.