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: [null] in ResponseBox first line  (Read 4377 times)

0 Members and 1 Guest are viewing this topic.

goldenTouch

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 26
    • View Profile
    • Spare Time Gaming
[null] in ResponseBox first line
« on: January 15, 2008, 10:36:44 PM »

Hi,

I couldn't find this question elsewhere in the forum, and I just tested the example from the WME Resource Center on creating dialogues.
By using the Game.AddResponse etc. I created the exact same responses as the example shows.
However, the first line in the ResponseWindow says [null] and when I click it, the actions (actor speaking, and the other character responding) are the same as for the next item in line.

Where does this [null] value come in?

PS! The [null] value disappears when I click one of the responses below - even if the other responses are still there.
« Last Edit: January 15, 2008, 10:39:42 PM by goldenTouch »
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: [null] in ResponseBox first line
« Reply #1 on: January 15, 2008, 11:15:03 PM »

could you please post your code? Don't forget it's indexed from 0. :)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

goldenTouch

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 26
    • View Profile
    • Spare Time Gaming
Re: [null] in ResponseBox first line
« Reply #2 on: January 16, 2008, 09:39:54 AM »

The script is located in Thomas.script - Thomas is an actor generated by the WME (the guy with the cowboy hat).
The method starts with on "Talk" - "Talk" is a valid name here as I have developed a VerbCoin that sends "Talk" to the actor script.

This is the entire code:
(please note that I have the if (actor.HasItem("book") == false) > as opposed to true. This was a test because I didn't bother implementing the book in the scene at the moment.

Code: [Select]
#include "scripts\base.inc"

on "Talk"
{
basic();

}

function basic()
{
var options;
options[0] = "Nice weather, isn't it?";
options[1] = "Can you tell me anything about your collegues?";
options[2] = "What's this book for?";
options[3] = "Bye!";

var selected;
while (selected != 3)
{
Game.AddResponseOnceGame(0, options[0]);
Game.AddResponse(1, options[1]);
if (actor.HasItem("book") == false) Game.AddResponse(2, options[2]);
Game.AddResponse(3, options[3]);

Game.Interactive = true;
selected = Game.GetResponse();
Game.Interactive = false;

actor.Talk(options[selected]);

switch (selected)
{
case 0:
Thomas.Talk("Not really");
break;
case 1:
Thomas.Talk("Who exactly is of interest to you?");
colleagues();
break;
case 2:
Thomas.Talk("I don't know, but it looks really neat!");
break;
case 3:
Thomas.Talk("See ya!");
break;

} // end switch

} // end while

Game.Interactive = true;
}


function colleagues()
{
var options;
options[0] = "Marc?";
options[1] = "Peter?";
options[2] = "Dirac?";
options[3] = "Back to my other questions.";

Game.StartDlgBranch();
var selected;
while (selected != 3)
{
Game.AddResponseOnce(0,options[0]);
Game.AddResponse(1,options[1]);
Game.AddResponseOnce(2,options[2]);
Game.AddResponse(3,options[3]);

Game.Interactive = true;
selected = Game.GetResponse();
Game.Interactive = false;
actor.Talk(options[selected]);

switch (selected)
{
case 0:
Thomas.Talk("He was a hero of a game that was never released.");
break;
case 1:
Thomas.Talk("Would you believe it? Peter went missing.");
Thomas.Talk("We're so scared!");
break;
case 2:
Thomas.Talk("Strange fellow.");
break;
case 3:
Thomas.Talk("As you wish.");
break;

} // end switch

} // end while

Game.Interactive = true;
Game.EndDlgBranch();
}

(Sorry for not being more creative with the dialogues at the moment... :P)
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: [null] in ResponseBox first line
« Reply #3 on: January 16, 2008, 12:34:24 PM »

goldenTouch, I've copy pasted your code as-is and it doesn't make any glitches. The only thing I've done is replacing Thomas with actor (because I don't have Thomas defined) but it's just a minor cosmetic issue. What WME version are you using?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

goldenTouch

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 26
    • View Profile
    • Spare Time Gaming
Re: [null] in ResponseBox first line
« Reply #4 on: January 16, 2008, 01:49:32 PM »

I'm using the latest version.
I can look at it some more tonight. I'm at work right now, so I don't have time to check it out yet.
Logged

goldenTouch

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 26
    • View Profile
    • Spare Time Gaming
Re: [null] in ResponseBox first line
« Reply #5 on: January 17, 2008, 10:52:53 AM »

I went through some old code in the game, and I had tested the Game.AddResponse function once before without completing it (and totally out of context).
I removed the lines and the [null] value is gone.
Logged
 

Page created in 0.042 seconds with 19 queries.