Fallout 2 mod gsay_option script command

QuantumApprentice

Where'd That 6th Toe Come From?
There are a whole bunch of Nicole's dialogue lines I want to play from a basic debug menu I created, but instead of creating a unique procedure for every single line of dialogue, is it possible to have a generic response procedure that you just call from the base dialogue menu and just pass in the relevant line number?
Here's what I've been trying to make so far, this compiles but the game throws an error during dialogue and won't display any options using this code.

Code:
variable string;
variable MSG_LINE_NMBR;

#define OPTION(string, y)                          \
   MSG_LINE_NMBR := y;                             \
   gsay_option(54, string, Nicole_Debug, 50)

procedure Nicole_Debug begin
   gsay_reply(54, MSG_LINE_NMBR);
   gsay_option(54, "debug menu", Nicole_Debug, 50);
end

procedure Nicole_Debug_A begin
   gsay_reply(54, 297);

   OPTION("debug reply1", 297);
//   gsay_option(54, "debug reply1", Nicole_Debug, 50);

   gsay_option(54, "165 Nic_22 Rippers", Nicole_Debug1, 50);
   gsay_option(54, "310 Nic_95 Rippers3", Nicole_Debug3, 50);
   gsay_option(54, "226 Nic_42 Rippers2", Nicole_Debug2, 50);
   gsay_option(54, "311 Nic_97 Rippers4", Nicole_Debug4, 50);

   gsay_option(54, "169 Nic_23 Charitable", Nicole_Debug5, 50);
   gsay_option(54, "172 Nic_24 Careful" , Nicole_Debug6, 50);

   gsay_option(54, "next",                Nicole_Debug_B, 50);
   gsay_option(54, "end dialogue", NicoleEnd, 50);
end

I don't want to have to create a unique procedure for every single dialogue line I want to play, but I can't seem to figure out how to create a generic reply procedure and pass the line number at the same time.

Specifically
OPTION("debug reply1", 297);
is replacing
// gsay_option(54, "debug reply1", Nicole_Debug, 50);
to try and pass the line number into the wrapped function.

Any hints?
 
First things first, you should use the macros N/B/GOption() instead of gsay_option() and Reply() instead of gsay_reply().

It is possible to call a procedure and give it a variable, for example
Code:
procedure somethingsomething begin
variable myTest := 1;
   call MyProcedure(myTest);
end

procedure MyProcedure(variable myTest) begin
   display_msg("variable: " + myTest);
end

However, I have never seen anyone using it with dialog procedures, so I don't know if it's working with that (probably not).
 
I thought about trying it that way, but my problem is getting the dialogue options to show up first, without setting the global variable until after the specific dialogue option is selected.
I thought creating a macro would allow me to do that, but sadly it doesn't seem to be the case.
I tried creating a procedure to wrap the option command in, but the global variable always gets set to the last number that's passed to it, preventing me from selecting options I tried to add earlier in the list.
This is what I came up with, let me know if there's a better way.
Code:
variable string;
variable MSG_LINE_NMBR;

procedure Nicole_Debug begin
   gsay_reply(54, MSG_LINE_NMBR);
   gsay_option(54, "debug menu", Nicole_Debug_A, 50);
end

procedure debug1(variable x, variable y) begin
   MSG_LINE_NMBR := x;
   giQ_Option(1, 54, y, Nicole_Debug, 1);
end

procedure Nicole_Debug_A begin
   gsay_reply(54, 297);

//   OPTION("debug reply1", 297);
   call debug1(297, "debug reply1");
//   gsay_option(54, "debug reply1", Nicole_Debug, 50);
   call debug1(226, "226 Nic_42 Rippers2");
//   gsay_option(54, "165 Nic_22 Rippers", Nicole_Debug1, 50);
   call debug1(310, "310 Nic_95 Rippers3");
//   gsay_option(54, "310 Nic_95 Rippers3", Nicole_Debug3, 50);
//   gsay_option(54, "226 Nic_42 Rippers2", Nicole_Debug2, 50);
   gsay_option(54, "311 Nic_97 Rippers4", Nicole_Debug4, 50);

   gsay_option(54, "169 Nic_23 Charitable", Nicole_Debug5, 50);
   gsay_option(54, "172 Nic_24 Careful" , Nicole_Debug6, 50);

   gsay_option(54, "next",                Nicole_Debug_B, 50);
   gsay_option(54, "end dialogue", NicoleEnd, 50);
end

Actually now that I think of it, my earlier macro probably would have had the same effect...if it didn't crash first.
I'm not using the macro's from command.h because then I'd have to import a header that I don't want to just yet, and either way I'd still have to pass the line number to reply with along somehow.

Is there no way to display a dialogue option and still pass along extra information if that dialogue option is selected? Seems like all the scripts just handle that stuff inside each individual dialogue procedure.
 
Macros aren't working that way. They are just a short forms of the big code you put behind it. If you put your "OPTION"-macro 10 times after each other, the compiled script will have 10 times the big code that it represents.

OPTION("debug reply1", 297);
OPTION("debug reply2", 298);
OPTION("debug reply3", 299);
OPTION("debug reply4", 300);

turns into

MSG_LINE_NMBR := 297;
gsay_option(54, "debug reply1", Nicole_Debug, 50)
MSG_LINE_NMBR := 298;
gsay_option(54, "debug reply2", Nicole_Debug, 50)
MSG_LINE_NMBR := 299;
gsay_option(54, "debug reply3", Nicole_Debug, 50)
MSG_LINE_NMBR := 300;
gsay_option(54, "debug reply4", Nicole_Debug, 50)

So MSG_LINE_NMBR is always 300, because it's the last value you are passing to the variable. That's why your idea isn't working.
 
yeah, I was afraid of that.

Any ideas how to work around this? is there an alternative way to display dialogue options that allows me to pass information to the called procedure?
 
As I said before
I have never seen anyone using it with dialog procedures, so I don't know if it's working with that (probably not).

If it were possible, someone likely would have done it already.
 
I have absolutely no idea what you want to do, but maybe this helps...

Code:
procedure start;
procedure talk_p_proc;
procedure Nicole_Debug;
procedure Nicole_Debug1;
procedure Nicole_Debug2;
procedure Nicole_Debug3;
procedure Nicole_Debug4;
procedure Nicole_Debug5;
procedure Nicole_Debug6;
procedure Nicole_Debug_B;
procedure Nicole_End;

procedure talk_p_proc begin           
   start_dialog_at_node(Nicole_Debug);
end                                   


procedure Nicole_Debug begin
   Reply(54);

   NOption(55, Nicole_Debug, 0);
   NOption(56, Nicole_Debug1, 0);
   NOption(57, Nicole_Debug2, 0);
   NOption(58, Nicole_Debug3, 0);
   NOption(59, Nicole_Debug4, 0);
   NOption(60, Nicole_Debug5, 0);
   NOption(61, Nicole_Debug6, 0);
  
   NOption(62, Nicole_Debug_B, 0);
   NOption(63, Nicole_End, 0);
end                           

procedure Nicole_Debug1 begin
  
end

procedure Nicole_Debug2 begin
  
end

procedure Nicole_Debug3 begin
  
end

procedure Nicole_Debug4 begin
 
end           

procedure Nicole_Debug5 begin
  
end

procedure Nicole_Debug6 begin
  
end                       

procedure Nicole_Debug_B begin
  
end                           

procedure Nicole_End begin
  
end
Code:
{54}{}{[debug menu]

{55}{}{debug reply1}
{56}{}{165 Nic_22 Rippers}
{57}{}{226 Nic_42 Rippers2}
{58}{}{310 Nic_95 Rippers3}
{59}{}{311 Nic_97 Rippers4}
{60}{}{169 Nic_23 Charitable}       
{61}{}{172 Nic_24 Careful}

{62}{}{next}
{63}{}{end dialogue}}
 
Back
Top