Hi all,
I have a standard AGS save/load system set up in my game (https://www.adventuregamestudio.co.uk/site/ags/tutorial/gui/2/) - just wondering if it's possible to "double click" on the desired save-game file name in the list box to load it? Rather than clicking it once, then clicking the Load/Restore button.
I hope that makes sense!
Many thanks,
Shaun
Good question, the listbox event says "OnSelectionChanged", so you need to test whether that event fires if the already selected option is clicked a second time. If it does, you can use a timer to detect a double click.
Great idea - thanks Khris! :) I'll see if that works
This works:
int prevIndex = -1;
// called on every game cycle, even when the game is blocked
function repeatedly_execute_always() {
if (IsTimerExpired(20)) prevIndex = -1;
}
function lstRestoreGamesList_OnSelectionChanged(GUIControl *control)
{
int index = control.AsListBox.SelectedIndex;
if (prevIndex != index) {
prevIndex = index;
SetTimer(20, 20); // half a second
}
else btnRestoreGame_OnClick(btnRestoreGame, eMouseLeft);
}
edit: removed superfluous else if
Thanks so much Khris! It's up and running :)