Author Topic: Call for WeiDU Requests!  (Read 9726 times)

Offline Meira

  • Planewalker
  • *****
  • Posts: 188
  • Gender: Female
  • I'm the snow on your lips
    • Amber's Home
Re: Call for WeiDU Requests!
« Reply #50 on: October 13, 2004, 02:03:18 AM »
I was looking through the WeiDU documentation and was surprised to find, that while there are the actions ADD_STATE_TRIGGER and ADD_TRANSITION_TRIGGER, there is no corresponding action to add stateActionStrings to existing dialog states. Would it be possible to have an action (called eg. ADD_ACTION_TEXT) that would enable us to add stateActionStrings to the DO blocks of existing states.

The purpose I personally would need this for is to add a SetGlobal() command into a state in Anomen's banter file in order to track whether a given banter has occurred or not. I would guess that the action would be useful mostly in these kinds of situations, ie. tracking whether an originally "unimportant" conversation has been had by an NPC in order to enable a banter or forcetalk option that is a reaction to that conversation.

Any chances of such an action being added to WeiDU?

Um... So, should we take the silence as a no? Or did this just siip part the radar?  :)







Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Re: Call for WeiDU Requests!
« Reply #51 on: October 13, 2004, 03:04:22 PM »
I guess it slipped by the radar because it's not really well-defined. DO actions are associated with transitions, not states. Given a state that has multiple transitions, some of which have DO actions and some of which don't, how do you see this hypothetical command looking and what do you see it doing?

Offline Darios

  • Planewalker
  • *****
  • Posts: 4
  • Gender: Male
    • Amber: The BG2 NPC Mod Project
Re: Call for WeiDU Requests!
« Reply #52 on: October 18, 2004, 02:24:12 PM »
Yeah, what I meant was to add a DO action to an existing transition in a given state. What I am looking for would be exactly like ADD_TRANSITION_TRIGGER, but it would add the given action string (eg. SetGlobal()) as a DO action to all of the transitions (or to those defined by the TransNumbers) of a given state. I guess the problem is, that it would have to check whether the transition has any DO actions or not; in the former case it would just add the new action after (or before) them but if there are no actions, it would have to add the whole DO element with the action itself. Would this be possible? If this kind of a contingent replacement is not possible, it would be OK if the command added the action string to every transition that already has DO actions.

Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Re: Call for WeiDU Requests!
« Reply #53 on: October 21, 2004, 07:26:29 PM »
I'm forced to admit that I don't really understand what you guys are doing with this or why you want it, but I have coded it up anyway. Look for it in the next WeiDU.

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Call for WeiDU Requests!
« Reply #54 on: October 22, 2004, 01:38:12 PM »
Something that would be really helping is PATCH_IF. It's a more specialized form of WHILE.
Syntax (as per readme standard):
PATCH_IF value THEN BEGIN patch... END [ELSE BEGIN patch... END]
If value is different from zero, the patches after THEN are performed once; otherwise, the patches after ELSE are performed once.
Example (from some stuff I coded up and is now in the g3 tweak pack):
Code: [Select]
     WHILE (("%noloop%" = 0) AND (("%dual1%" BAND 0b00100000) = 0b00100000)) BEGIN //?C or C? from C
          WHILE (("%noloop%" = 0 ) AND ("%class%" = 8)) BEGIN //FC from C
             SET "level1" = ("%level1%" <= "%level2%") ? 0 : ("%level1%" - "%level2%")
             SET "firstlast" = ("%level2%" >= "%firstlast%") ? 0 : ("%firstlast%" - "%level2%")
       SET "noloop" = 1
         END
          WHILE (("%noloop%" = 0 ) AND (("%class%" = 14) OR ("%class%" = 15))) BEGIN //CM or CT from C
             SET "level2" = ("%level2%" <= "%level1%") ? 0 : ("%level2%" - "%level1%")
             SET "secondlast" = ("%level1%" >= "%secondlast%") ? 0 : ("%secondlast%" - "%level1%")
       SET "noloop" = 1
         END
           SET "noloop" = 1
     END
Its meaning was to store how the HPs are calculated in dual classes, for the purpose of maxing them. The problem with cleric to something is that the cleric class is sometimes in the first "level" field, sometimes in the second one, so different calculations are needed.
Using PATCH_IF, the code above would look like:
Code: [Select]
PATCH_IF (("%dual1%" BAND 0b00100000) = 0b00100000) THEN BEGIN //?C or C? from C
     PATCH_IF ("%class%" = 8) THEN BEGIN //FC from C
         SET "level1" = ("%level1%" <= "%level2%") ? 0 : ("%level1%" - "%level2%")
         SET "firstlast" = ("%level2%" >= "%firstlast%") ? 0 : ("%firstlast%" - "%level2%")
     END ELSE BEGIN
         SET "level2" = ("%level2%" <= "%level1%") ? 0 : ("%level2%" - "%level1%")
         SET "secondlast" = ("%level1%" >= "%secondlast%") ? 0 : ("%secondlast%" - "%level1%")
     END
END
 
This is both faster to write and loops are much less probable.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Re: Call for WeiDU Requests!
« Reply #55 on: October 22, 2004, 03:49:43 PM »
There would have been a standard "IF" if it hadn't already been taking by some older syntax. Sure, I'll add PATCH_IF for you.

Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Re: Call for WeiDU Requests!
« Reply #56 on: October 22, 2004, 04:01:03 PM »
Added.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: Call for WeiDU Requests!
« Reply #57 on: October 22, 2004, 04:04:13 PM »
I'm forced to admit that I don't really understand what you guys are doing with this or why you want it, but I have coded it up anyway. Look for it in the next WeiDU.

Possible explanation here is to accomplish the setting of some flag that the game would not have set for you otherwise. Or consider, for instance, what I did to fix the "AerieRomanceActive stays at 1 if you sleep with her" issue with an I_C_T or an EXTEND (I forget which) that simply does a DO and an EXIT, but I could have just added a DO instead.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline Smoketest

  • Planewalker
  • *****
  • Posts: 59
  • Gender: Male
Re: Call for WeiDU Requests!
« Reply #58 on: November 13, 2004, 04:08:42 PM »
I did some playing with the --transitive flag last night and noticed it has some bugs in the '// from:' readout. Specifically, it seems to get confused as to who externed to the current state after going through certain chains, and several times it duplicates or even triplicates extern references. You can get an idea of what I mean by decompiling GORODR1.DLG in ToB with --transitive (with comments enabled) and examining the resulting .D file. This bug also sometimes shows up outside the comment in the form of the wrong resref for a BEGIN dlgfile state# sequence. It's not serious because these states aren't being recompiled, but it is a bit misleading when being read/studied.

Also, I found that a quick way to use this and still have a compilable dialog is to place multi-line comment symbols prior to the first externed state and after the last externed state, or prior to the returning point in the master dialog. I also had to comment-out the warning message at the top of the file, but once that was done, I had a compilable file. So could you have WeiDU comment-out these externed states since they are just for reference?

Example of commenting out externed states that worked for me:
Code: [Select]
IF ~InPartySlot(LastTalkedToBy,0)
Global("zGarOdr1Job","GLOBAL",0)
Global("TalkedTozGarOdr1","GLOBAL",0)
Global("OdrenRitualDone","GLOBAL",0)~ THEN BEGIN 3 // from:
  SAY #62356 /* ~Ah!  The Child of Bhaal has come!  We had hoped that our call for aid would draw you here...praise to the Watcher for hearing our prayers!~ [ODREN10] */
  IF ~~ THEN DO ~SetGlobal("TalkedTozGarOdr1","GLOBAL",1)~ EXTERN ~GORPOL1~ 0
END

/* comment begins here; externed dialogs begin
IF ~~ THEN BEGIN GORPOL1 0 // from:
  SAY #62357 /* ~Praise be to Helm!~ */
  IF ~~ THEN EXTERN ~GORGAR1~ 0
END

IF ~~ THEN BEGIN GORGAR1 0 // from:
  SAY #62358 /* ~Does this mean we have a chance, Odren?  Does this mean our duty is not lost to us?~ */
  IF ~~ THEN GOTO 4
END
*/  // comment ends here; Odren's dialog continues

IF ~~ THEN BEGIN 4 // from: GORGAR1:0.0
  SAY #62360 /* ~Be at peace, Sister Garlena.  <CHARNAME> has yet to hear our story, let alone agreed to aid us.  We get ahead of ourselves, here.~ */
  IF ~~ THEN GOTO 5
END
Also notice that GORGAR1's state didn't display GORPOL1's externing transition info in the 'from' list. and GORPOL1 doesn't show the link from GORODR1 3.0. Not critical perhaps, but it would be nice for completeness.

I like this feature because it makes it easier to follow the flow of conversation when fixing dialog bugs. It's also a decent alternative to looking through a tree for interjection points. (The fewer tools I have to use, the better.)

Thanks.
« Last Edit: November 13, 2004, 04:24:18 PM by Smoketest »

Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Re: Call for WeiDU Requests!
« Reply #59 on: November 16, 2004, 01:17:13 AM »
I could comment all of that out as I print it out, but (1) it would break syntax highlighting for the resulting file and (2) if you wanted a compile-able D file, wouldn't you just not specify --transitive? I'm probably not sure of what you're trying to do.

A quick scan of GORODR1.D --transitive didn't show anything wrong -- can you point to a specific state number?

Anyway, I'm guessing that the problem with the "from" comments is that I build up a set of "from souces" in order as I print out the states. To be really correct it would need to be two passes, which would slow things down by, perhaps, 30 percent.

If people want accurate from comments I can try to code that up.

Offline Smoketest

  • Planewalker
  • *****
  • Posts: 59
  • Gender: Male
Re: Call for WeiDU Requests!
« Reply #60 on: November 21, 2004, 08:23:46 PM »
I could comment all of that out as I print it out, but (1) it would break syntax highlighting for the resulting file and (2) if you wanted a compile-able D file, wouldn't you just not specify --transitive?

1. If the editor allows multiline comments, this would leave the transitive states commented out but the original dialog would still be highlighted properly, so I don't see the problem here.

2. Why should I have to work with two different D files when having one with the extra info commented out would do? I'm basically trying to save a step here. If I decompile a dialog without --transitive (normal procedure), fine. If I happen to want to use --transitive, it'd be nice if I didn't have to also generate a non --transitive D for compilation.

Quote
A quick scan of GORODR1.D --transitive didn't show anything wrong -- can you point to a specific state number?

Sure. I'll put my comments in commented parenthesis within the code blocks. Here's a section that has missing references to the calling DLG/State/Transition. (I've removed the dialog text so you can focus on the comments.)

Code: [Select]
IF ~InPartySlot(LastTalkedToBy,0)
Global("zGarOdr1Job","GLOBAL",0)
Global("TalkedTozGarOdr1","GLOBAL",0)
Global("OdrenRitualDone","GLOBAL",0)~ THEN BEGIN 3 // from:
  SAY #62356
  IF ~~ THEN DO ~SetGlobal("TalkedTozGarOdr1","GLOBAL",1)~ EXTERN ~GORPOL1~ 0
END

IF ~~ THEN BEGIN GORPOL1 0 // from: (no mention of GORODR1:3.0)
  SAY #62357
  IF ~~ THEN EXTERN ~GORGAR1~ 0
END

IF ~~ THEN BEGIN GORGAR1 0 // from: (no mention of GORPOL1:0.0)
  SAY #62358
  IF ~~ THEN GOTO 4
END

IF ~~ THEN BEGIN 4 // from: GORGAR1:0.0
  SAY #62360
  IF ~~ THEN GOTO 5
END

Here's were problems begin to show themselves:

Code: [Select]
IF ~~ THEN BEGIN 7 // from: 6.0 5.1 5.0
  SAY #62373
  IF ~~ THEN EXTERN ~GORPOL1~ 1
END

IF ~~ THEN BEGIN GORPOL1 1 // from: (no mention of GORODR1:7.0)
  SAY #62374
  IF ~True()~ THEN GOTO 8 // (no mention of target DLG; GORODR1 8)
  IF ~IsValidForPartyDialog("Cernd")
GlobalGT("Chapter","GLOBAL",7)~ THEN EXTERN ~CERND25J~ 6
  IF ~IsValidForPartyDialog("Keldorn")
GlobalGT("Chapter","GLOBAL",7)~ THEN EXTERN ~KELDO25J~ 8
  IF ~IsValidForPartyDialog("Anomen")
GlobalGT("Chapter","GLOBAL",7)~ THEN EXTERN ~ANOME25J~ 28
END

IF ~~ THEN BEGIN ANOME25J 28 // from: GORGAR1:3.0 (should be GORPOL1:1.3)
  SAY #70518
  IF ~~ THEN GOTO 8 // (no mention of target DLG; GORODR1 8)
END

IF ~~ THEN BEGIN KELDO25J 8 // from: KELDO25J:8.0 ANOME25J:28.0 GORPOL1:1.0 GORPOL1:1.0 (? incorrect references, a duplication, and the wrong transition number in GORPOL1; should be GORPOL1:1.2)
  SAY #70519
  IF ~~ THEN GOTO 8 // (no mention of target DLG; GORODR1 8)
END

IF ~~ THEN BEGIN CERND25J 6 // from: 5.2 (should be GORPOL1:1.1)
  SAY #70520
  IF ~~ THEN GOTO 8 // (no mention of target DLG; GORODR1 8)
END

IF ~~ THEN BEGIN 8 // from: CERND25J:6.0 KELDO25J:8.0 ANOME25J:28.0 GORPOL1:1.0 GORPOL1:1.0 (duplicated GORPOL1 reference)
  SAY #62375
  IF ~~ THEN GOTO 9
END

That's all I'll submit. It carries on that way through the rest of the file. I don't know how you couldn't have seen it.

Quote
To be really correct it would need to be two passes, which would slow things down by, perhaps, 30 percent.

I grew up with two-pass assemblers, so this is no biggy. And what's 30% for an option that isn't heavily used? Do one pass if --transitive isn't specified, and two if it is. Something to consider, at least.

Quote
If people want accurate from comments I can try to code that up.

I want accurate //from comments, please.
« Last Edit: November 21, 2004, 08:25:25 PM by Smoketest »

Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Re: Call for WeiDU Requests!
« Reply #61 on: December 01, 2004, 06:23:57 PM »
You are right. I have fixed the comment problem and added the second pass.

Offline Smoketest

  • Planewalker
  • *****
  • Posts: 59
  • Gender: Male
Re: Call for WeiDU Requests!
« Reply #62 on: December 02, 2004, 08:34:16 PM »
Thank you.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

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:
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)?: