App attempting to access item -1 of a list, I don't get why

When I start the game, initiating mineSet and gameSet, the app says that it tried to access item -1 of the list global buttons, but I don't know why, so could any of you find it? Also, sorry for bad code, it's my first app.

This looks like MineSweeper.

  • Don't hardwire number limits, instead use length of list.

  • There are < and > options buried in those comparison blocks, if you use the pulldown. Don't make your tests paper thin, make them solid walls

  • Use the Blocks Editor right click option to use external sockets, so your blocks don't look like the plastic holders of six packs of soda cans

  • Use the Clean Up Blocks option, to allow your scroll wheel access to all the blocks without having to zoom out to space.

  • Use a table (lists of lists) for your Buttons, so you can address by row and column:


Randomized selection:

thanks but is there a fix for my problem?

STart with the blocks I circled.

done, same issue :frowning:

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

possibly because sometimes you subtract index values...

and your criteria goes negative.

good thinking but as shown right above, it eliminates blocks that would make that index go negative so that problem does not happen.

Breakdown your game startup.

Test each procedure/action by itself. Which one generates the error ?


App attempting to access item -1 of a list, I don't get why** so why are you getting the error that your you attempt to access item -1; that can happen if you do not provide code prevent that from happening. It is logical that one of your comparisons is allowing negative values. Why not check?

solved, turns out i forgot to eliminate the possibility of picking game start button in the "when button clicked" function causing it to be confused because that button isn't in the buttons list. ;/

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.