My game keeps crashing and I know why. However, I don't know how to fix the problem.
In my game, I want the graphic of the currently active item to change if i press on the look button.
If no item is active however, the game will crash.
Code: ags
I tried doing the following, but it did not work:
Code: ags
I get "Type mismatch: cannot convert 'int' to 'null*'"
Is there a way to make AGS check if there's a currently active item?
In my game, I want the graphic of the currently active item to change if i press on the look button.
If no item is active however, the game will crash.
//Somewhere in GlobalScript.asc
function blook_Click(GUIControl *control, MouseButton button) {
mouse.Mode = eModeLookat;
inventory[game.inv_activated].Graphic = 78;
}
I tried doing the following, but it did not work:
//Somewhere in GlobalScript.asc
function blook_Click(GUIControl *control, MouseButton button) {
mouse.Mode = eModeLookat;
if (game.inv_activated != null){
inventory[game.inv_activated].Graphic = 78;
}
}
I get "Type mismatch: cannot convert 'int' to 'null*'"
Is there a way to make AGS check if there's a currently active item?