Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: The Man on March 31, 2014, 06:09:50 PM

Title: Scale the response window
Post by: The Man on March 31, 2014, 06:09:50 PM
Hello, everybody! I'll get straight to the point.
I wanted to scale my Response window according to the number of choices the players has got. Searching around the forum I have found this piece of code posted by Mnemonic:


Code: [Select]
var num = Game.GetNumResponses();
var resp= Game.GetResponsesWindow();

var height = num*20; // height of each line
resp.Height = height ;

Now, forgive me for my ignorance but where should I exactly put this code? In the window definition script? If so, where exactly?
Title: Re: Scale the response window
Post by: Mnemonic on March 31, 2014, 06:17:21 PM
Just before you call Game.GetResponse(); i.e. the moment when the responses are added and you are about to display the response box.
Title: Re: Scale the response window
Post by: The Man on March 31, 2014, 06:31:53 PM
It doesn't seem to work! I know I'm doing something wrong, but I can't understand what! Here's my code:

Code: [Select]
function FabbroDialogue1()
{

var Responses;
var Selected;
var Loop = true;

  while(Loop)
  {
   
    Responses[41] = "Sa dirmi quanto dovrebbero durare questi lavori?";
    Responses[26] = "Ho bisogno della sua incredibile abilità col saldatore.";
Responses[28] = "Eppure io non le vedo.";
Responses[30] = "Diamine, il tricheco aveva ragione.";
Responses[1] = "La lascio al suo lavoro, mentre io andrò a godermi questa splendida giornata soleggiata. Forse andrò persino al mare.";

 
    Game.AddResponseOnceGame(41, Responses[41]);

if (devosaldare==true)
{
    Game.AddResponseOnceGame(26, Responses[26]);
}

if (provocazione2==true)
{
    Game.AddResponseOnceGame(28, Responses[28]);
}

if (provocazione4==true)
{
    Game.AddResponseOnceGame(30, Responses[30]);
}

    Game.AddResponse(1, Responses[1]);

var num = Game.GetNumResponses();
var resp= Game.GetResponsesWindow();

var height = num*20;
resp.Height = height ;
   
Selected = Game.GetResponse();
actor.Talk(Responses[Selected]);

[...]