Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Scale the response window  (Read 3640 times)

0 Members and 1 Guest are viewing this topic.

The Man

  • Occasional poster
  • **
  • Karma: 1
  • Offline Offline
  • Posts: 67
    • View Profile
Scale the response window
« 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?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Scale the response window
« Reply #1 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.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

The Man

  • Occasional poster
  • **
  • Karma: 1
  • Offline Offline
  • Posts: 67
    • View Profile
Re: Scale the response window
« Reply #2 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]);

[...]

Logged
 

Page created in 0.036 seconds with 21 queries.