Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

Verification:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?:

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: Taimon
« on: January 09, 2009, 08:03:27 AM »

Taimon: thanks to that example, now I can apply your patch without worrying about it being wrong (I still am not experienced with d treatment).
Neither am I.

By the way, is there any code out there that actually uses I_C_T4?

Quote
Berelinde: the only way to be 100% sure of not having side effects is to use ICT1/3 and a passback.
I'm not really sure what was actually requested. Most of the time, the actions are going to be mutually exclusive, so it would make no sense to include more than one.
Posted by: the bigg
« on: January 09, 2009, 07:16:48 AM »

Taimon: thanks to that example, now I can apply your patch without worrying about it being wrong (I still am not experienced with d treatment).

Berelinde: the only way to be 100% sure of not having side effects is to use ICT1/3 and a passback.
Posted by: Taimon
« on: January 09, 2009, 04:16:09 AM »

No, sorry, I'm talking about something rather different.

Let's take this example from BG1NPC (phase2/dlg/x#ict3.d):
Code: [Select]
/* Firebead */
/* individual passbacks supplied */
I_C_T3 ~%tutu_var%FIREBE~ 2 X#FIREBE2
== ~%GARRICK_JOINED%~ IF ~InParty("garrick") InMyArea("garrick") !StateCheck("garrick",CD_STATE_NOTVALID)~ THEN @476
== ~%tutu_var%FIREBE~ IF ~InParty("garrick") InMyArea("garrick") !StateCheck("garrick",CD_STATE_NOTVALID)~ THEN @479
== ~%JAHEIRA_JOINED%~ IF ~InParty("jaheira") InMyArea("jaheira") !StateCheck("jaheira",CD_STATE_NOTVALID)~ THEN @477
== ~%tutu_var%FIREBE~ IF ~InParty("jaheira") InMyArea("jaheira") !StateCheck("jaheira",CD_STATE_NOTVALID)~ THEN @945
== ~%VICONIA_JOINED%~ IF ~InParty("viconia") InMyArea("viconia") !StateCheck("viconia",CD_STATE_NOTVALID)~ THEN @478
== ~%tutu_var%FIREBE~ IF ~InParty("viconia") InMyArea("viconia") !StateCheck("viconia",CD_STATE_NOTVALID)~ THEN @941
END

Now, this I_C_T3 creates 6 new transitions in FIREBE:2 (one for each ==). If I change this to I_C_T4, I would expect that each of these newly created transitions gets the action of the first original transition in FIREBE:2. (I think it was the one that ends the book quest.)

What actually happens is, that only the first (or the last?) new transition has the original action associated with it.
The patch above tries to fix this.

What you want would probably need a I_C_T5 + 6. ;)
Posted by: berelinde
« on: January 09, 2009, 12:55:27 AM »

Hey, Taimon, this could be really cool.

This is the same problem that I_C_T2 has. Only the first action is performed. If you're I_C_T2-ing into a state with three different transitions with associated actions, only the first will occur, no matter what the other two are, or what the player selects. This is why we've been using I_C_T and I_C_T3 with passbacks. Would the fix you suggest here also apply to I_C_T2?
Posted by: Taimon
« on: January 06, 2009, 02:56:01 PM »

I'm not that familiar with dialogue stuff, but it seems like I_C_T4 is not really doing what it's supposed to be doing.

Let me summarize what I expect it to do:
The same thing as I_C_T3 except that the original action is added to all newly created transitions in the entry state.
But in the current implementation it looks like only the first newly created transition gets the action.

In my ignorance, I tried to fix it even though I'm not sure if it's broken in the first place:
(Correct me if I'm wrong here.)
Code: [Select]
--- src/dc.ml
+++ src/dc.ml
@@ -961,6 +961,11 @@
         );
         let final_trans = Array.to_list ci.c3_exit_trans in
         let keep = ci.c3_keep_first_do_with_first_speaker in
+        (* I_C_T4: make a backup of original first action *)
+        let backup_action = match final_trans with
+          | [] -> None
+          | hd :: tl -> hd.Dlg.action
+        in
         (*
         log_or_print "DEBUG: I_C_T: %b (%d)\n" keep
           (List.length final_trans);
@@ -1058,6 +1063,12 @@
           | [] -> ()
         in
         process_chain ci.c3_dialogue ci.c3_entry_condition ci.c3_entry_weight;
+        if keep then begin
+          (* I_C_T4: restore original first action *)
+          match Array.to_list ci.c3_exit_trans with
+            | [] -> ()
+            | hd :: tl -> hd.Dlg.action <- backup_action ; ()
+        end ;
         begin
         match ci.c3_variable with
         | None -> ()
This should be taken with a grain of salt - not sure if it has any side-effects.