I worked with a little trick keeping track of inventory items in my inv box.
now I upgraded to ags27 and the following erro occurs after I pick up my second inv item in the game.
I get the error (which I never got in AGS256):
---------------------------
Adventure Game Studio
---------------------------
An internal error has occured. Please note down the following information.
If the problem persists, contact Chris Jones.
(ACI version 2.70.864)
Error: run_text_script1: error -6 running function 'repeatedly_execute':
Error: Array index out of bounds (index: -1, bounds: 0..300)
in Global script (line 51)
---------------------------
OK
---------------------------
function repeatedly_execute() {
// put anything you want to happen every game cycle here
GetLocationName(mouse.x,mouse.y,location_name);
get_gui = GetGUIAt(mouse.x,mouse.y);
got_inv = character[EGO].activeinv;
if (hadgot_inv != got_inv){ // something changed in active inv
if (got_inv != -1){
character[EGO].inv[got_inv] = 0;
*line51=>* character[EGO].inv[hadgot_inv] = 1;
UpdateInventory();
}
hadgot_inv = character[EGO].activeinv;
}
}
any suggestions??
Looks like hadgot_inv == -1 at that point.
Before line 51, check
if (hadgot_inv != -1)
ok, i'llt ry that.
does it make sense then that this code did work well in AGS256??
regards, Martijn
It does. Since then AGS started making better checks. Meaning, it was probably something you COULDN't do even then, and therefore it was sheer luck that made it still work. 2.7 doesn't allow that anymore.