Array index out of bounds error

Started by Jabbage, Tue 05/09/2023 21:27:06

Previous topic - Next topic

Jabbage

Hi all,

I've been using the VerbCoin template which comes with AGS for a game, and I've got to hold my hands up and say that I don't really understand how it works, at least not in enough depth to troubleshoot it! I've generally tried to leave the verb coin scripting well alone beyond cosmetic changes and hoped for the best.

Some friends who have play tested my game have had this popup:




I haven't been able to get this message to occur myself which makes it difficult to know exactly what circumstances it's been happening, and it seems to have happened at different points of the games for different people.

Here is the line of the VerbCoin code it's refering to



If anyone has any pointers for what might be the issue here, or things I could try to look into for more clues about the issue, that would be so helpful!  :-D
Thank you!

morganw

It might be a mistake in the VerbCoin code that it does not verify that the GUI button being clicked is actually one that is used by the VerbCoin.
(It was me that [re]wrote it, but it was a while ago and I'm not sure many people have actually used it in a game).

Do you have other clickable GUI buttons showing at the same time that the VerbCoin itself is showing?

Jabbage

Ahhhhhh yeah, I have a gui with some clickable buttons at the corner of the screen which is visible in most rooms.

Thank you for your work on it, I really like it!  :grin:

morganw

I'll try to look at it over the next couple of days and make a fixed version.

morganw

It looks like the mistake was in the part of the code that updates the text label at the bottom of the screen. You should be able to fix it by changing line 504 in VerbCoin.asc
from:
Code: ags
      else if (control != null && control.AsButton != null && control.Enabled && context_text != null)
to:
Code: ags
      else if (control != null && control.OwningGUI == interface && control.AsButton != null && control.Enabled && context_text != null)

https://github.com/adventuregamestudio/ags-template-source/commit/2337ff1fff54681d3ae67c221fc4584ee22b4900.patch

Jabbage

Amazing, thank you so much! I really appreciate it!

SMF spam blocked by CleanTalk