Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Automatically Select Last Dialogue Response  (Read 2224 times)

0 Members and 1 Guest are viewing this topic.

greg

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 18
    • View Profile
Automatically Select Last Dialogue Response
« 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:

Code: [Select]
// 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
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Automatically Select Last Dialogue Response
« Reply #1 on: January 16, 2007, 04:45:37 PM »

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().
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.016 seconds with 23 queries.