Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: DeleteResponse ?  (Read 4630 times)

0 Members and 1 Guest are viewing this topic.

deadworm222

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 197
  • Wintermute Army
    • View Profile
DeleteResponse ?
« on: April 08, 2004, 04:18:51 PM »

Is there any way to delete a response in the inventory system, or to replace the response text? I have the basic situation, where you first have a question like: "What's the time?" and then want to replace it with something like "What did you say the time was, again?".
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:DeleteResponse ?
« Reply #1 on: April 08, 2004, 04:21:57 PM »

You can use the Game.AddResponseOnceGame method, but to change the question, you'll have to script a condition anyway.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

deadworm222

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 197
  • Wintermute Army
    • View Profile
Re:DeleteResponse ?
« Reply #2 on: April 09, 2004, 10:48:00 AM »

Hmmm, so far I haven't been able to use AddResponseOnceGame, because it only adds the response once, and if there are two or more responses visible, and you choose either one of them, the responses added with AddResponseOnceGame disappear. I could try to implement something that would use ResetResponse, but I so far haven't figured out anything that would help me there.
Logged

Drax

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 78
  • This engine rocks!
    • View Profile
    • Ganja Joe - And the myth of the holy pot
Re:DeleteResponse ?
« Reply #3 on: April 09, 2004, 10:56:47 AM »

isn't it possible to store the text in a global variable and if the text ist asked the first time then just store the other string in it.

Code: [Select]
global text="old text";
Code: [Select]
actor.Talk(text);
and the after the question is asked:
Code: [Select]
text="new text";


I think it should work.

Edit: as response it should work the same way
« Last Edit: April 09, 2004, 10:59:18 AM by DraX »
Logged
I'm Lost!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:DeleteResponse ?
« Reply #4 on: April 09, 2004, 11:49:32 AM »

Hmmm, so far I haven't been able to use AddResponseOnceGame, because it only adds the response once, and if there are two or more responses visible, and you choose either one of them, the responses added with AddResponseOnceGame disappear

No, only the chosen response will disappear. But it must be used in conjunction with the StartDlgBranch and EndDlgBranch methods.


Drax: Yes, that's right, that would work nicely.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

deadworm222

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 197
  • Wintermute Army
    • View Profile
Re:DeleteResponse ?
« Reply #5 on: April 10, 2004, 09:35:49 AM »

I use StartDlgBranch and the other one. Perhaps I just wasn't alert enough to notice which responses are deleted and which aren't - there were also some other problems with the clauses, I actually had the clause system all wrong. But It'd be great if the WME manual would have a dialogue scripting tutorial at some point ;)
« Last Edit: April 10, 2004, 09:40:11 AM by deadworm222 »
Logged

Aaron

  • Guest
Re: DeleteResponse ?
« Reply #6 on: June 24, 2005, 09:50:22 AM »

I'm trying to figure out just how the StartDlgBranch and EndDlgBranch work, because they simply do not apply to my natural resource of logical thinking.

What do they do specifically, and where do you use theme exactly? A code sample would be more suitable than anything else really...
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: DeleteResponse ?
« Reply #7 on: June 24, 2005, 10:08:40 AM »

Hmm, I see the dialogue article effectively disappeared from the docs... >:( So here it is:



In addition to the original Game.AddResponse() and Game.GetResponse() methods, this build introduces new methods Game.AddResponseOnce() and Game.AddResponseOnceGame().

Game.AddResponseOnce(id, text)
This method will add a dialogue response and once this response is selected by the player, it will disappear from the list of responses until the dialogue is finished.


Game.AddResponseOnceGame(id, text)
This method will add a dialogue response and once this response is selected by the player, it will disappear from the list of responses and it will never reappear in the current game session.



Using these two methods you don't need to explicitly code whether a certain response should appear only once. The engine will remember which responses have been previously selected by the player and it will hide them automatically.


If you need to revive an automatically hidden response, you can use Game.ResetResponse(id) method.

As an addition to this new functionality the Game.GetResponse() method now has an optional logical parameter, which specifies what to do when there's only one response left for player to select. If you pass a true value as a parameter to the GetResponse method and there is only one response available, the engine will select it automatically.

For your further convenience, WME now provides a new Game.LastResponse attribute, which holds a text of the previously selected response.

But there's a small complication. In order to make the Game.GetResponseOnce* methods work, you must explicitly define where your dialogue branch starts and where it ends so that the engine is able to track to which dialogue which response belongs. You can mark a dialogue start using the new Game.StartDlgBranch(name) method and end it using a Game.EndDlgBranch() method.

OK, let's show the new functions in an example:


Code: [Select]
function MyTestDialogue()
{
  Game.StartDlgBranch("MyTestDialogue"); // start a new dialogue branch

  var EndBranch = false;

  while(!EndBranch) // loop until the player ends this dialogue
  { 
    Game.AddResponseOnce(0, "You can select this response only once in this dialogue");
    Game.AddResponseOnceGame(1, "You can select this response only once in the entire game");
    Game.AddResponse(2, "Ok, I have to go now.");
   
    var res = Game.GetResponse(true); // automatically select last response
   
    actor.Talk(Game.LastResponse);
   
    if(res==2) EndBranch = true;  // response #2 exits the dialogue
  }
  Game.EndDlgBranch(); // end this dialogue branch
}
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.037 seconds with 21 queries.