Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: greg on January 16, 2007, 04:39:10 PM
-
Is there a way of overriding Game.GetResponse() so that, if there's only one response available, it automatically selects it?
I tried the following definition:
// newestResponseId tracks the id of the last response added by Game.AddResponse(responseId, stringId).
// If there's only one response, it follows that newestReponseId == responseId.
var newestResponseId;
method GetResponse() {
if (Game.GetNumResponses() == 1) {
return newestResponseId;
}
return Game.GetResponse();
}
However, even though this causes the switch statement to run the proper response (case n, where n == newestResponseId), WME doesn't remove the response from the list of responses (causing the response to appear as an option when the branch exits and returns to its parent branch).
Thanks for your help!
Greg
-
Actually GetResponse() already provides an optional parameter which does just that :)
And to answer the original question, in WME 1.7 there's a new method Game.ClearResponses().