Thanks for the clarification, @Khris! Noted down that this is a function too, only with the name 'bool'!
I'm still trying to figuring out why it's not working, though. It says 'varaible is required on the left of assignment i' on the 'for (i = 0; i < this.ItemCount; i++)' line...
Code: ags

// saving a game
bool ItemExists(this ListBox*, String item) {
for (i = 0; i < this.ItemCount; i++) {
if (item == this.Items[i]) return true;
}
return false;
}
function btnSaveGame_OnClick(GUIControl *control, MouseButton button)
{
int gameSlotToSaveInto = find_save_slot(txtNewSaveName.Text);
if (gameSlotToSaveInto < 0)
{
Display("No more free save slots!");
}
// game save cannot be empty message
else if (txtNewSaveName.Text == "")
{
Display("Game save cannot be empty!");
}
// check if no save slot was clicked on in the saves list box
else if (lstSaveGamesList.SelectedIndex == -1)
{
SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
close_owning_gui(control);
}
// show the confirm overwriting dialogue
else if (lstSaveGamesList.ItemExists(txtNewSaveName.Text))
{
open_gui(gOverwriteSave);
}
}