Author Topic: STATE_WHICH_SAYS  (Read 8614 times)

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: STATE_WHICH_SAYS
« Reply #25 on: January 13, 2008, 12:13:49 PM »
Well, the problem I am having is this:

I have E:\BGT\bg1.tra
@3637  = ~[VICONIA 27] Greetings darthiir, I know that you look upon me as an enemy, but perhaps we could ignore our differences.~ [VICON27]

I also have four separate states to REPLACE that use the same exact string, as they are based on random replies, so that Viconia shuns talking with Kivan entirely;

phase1\dlg\x#kivan.d(56)
Code: [Select]
REPLACE ~%VICONIA_BANTER%~
IF ~~ THEN BEGIN %BGTViconiaState575% // from:
SAY @0
IF ~~ THEN EXIT
END
END

REPLACE ~%VICONIA_BANTER%~
IF ~~ THEN BEGIN %BGTViconiaState583% // from:
SAY @1
IF ~~ THEN EXIT
END
END

REPLACE ~%VICONIA_BANTER%~
IF ~~ THEN BEGIN %BGTViconiaState584% // from:
SAY @2
IF ~~ THEN EXIT
END
END

REPLACE ~%VICONIA_BANTER%~
IF ~~ THEN BEGIN %BGTViconiaState585% // from:
SAY @3
IF ~~ THEN EXIT
END
END
[/size]

I think what I need to do is either *not* install this on BGT (which I know how to code, just splitting this into a separate file and assingning back to the original .tra via USING so as not to mess with current .tras already at translators), which is not a big loss of content, as they are just Viconia swearing at Kivan and not talking, or if at all possible trying to find four instances of the same dialogue and replace them with four different responses.

(Did I mention that my brain is seriously exploding here? I think my brainmatter is leaking out of my ears.)


Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: STATE_WHICH_SAYS
« Reply #26 on: January 13, 2008, 01:49:47 PM »
Unfortunately, the current implementation of STATE_WHICH_SAYS doesn't allow for multiple states with the same SAY @x text. I guess you'll have to wait for ADD_PRINGLES  :)
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 cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: STATE_WHICH_SAYS
« Reply #27 on: January 13, 2008, 03:04:51 PM »
I can conceive of absolutely no good reason anyone but me would even *want* to do this (I don't want to myself - I like commenting on states rather than destructively rewriting the game, but sometimes an author's gotta do what an author's gotta do, and I gotta recode it as best I can), as it is destructive REPLACE behavior in the first place, so I am all good. Easy fix for me - just don't do it! (And no request here for a WeiDU implementation of

ACTION_IF COMPONENT_INSTALLED ~Setup-MegaInstall~ 0 BEGIN
  REWRITE_WHOLE_GAME_FOR_FULL_MEGA_INSTALL_COMPATIBILITY_WITH_PRINGLES_AND_ICECREAM %OS% %GAMETYPE% %LANGUAGE%
END

You already support AT_INTERACTIVE_EXIT del c\*.*  :D

Offline Ascension64

  • Planewalker
  • *****
  • Posts: 472
Re: STATE_WHICH_SAYS
« Reply #28 on: January 13, 2008, 09:53:42 PM »
Hey m you could try the approach of querying backup files to work out the correct state number to change. Probably the only solution at this time now, I think.

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: STATE_WHICH_SAYS
« Reply #29 on: January 14, 2008, 10:12:09 AM »
I think it is a great solution, and am playing around with it and trying it out - it might not solve the Mega's problem, as I think you have to do some magical (and hard) work to get BGT to accomodate some of that, but for most purposes, Ascension64, your roughed out suggestion of

Code: [Select]
COPY - ~BGT/backup/0/EDWINJ.DLG~ ~BGT/backup/0/EDWINJ.DLG~
  READ_LONG 0x8 EDWINJ_num_states
  SET BGTEdwinJState0 = EDWINJ_num_states
  SET BGTEdwinJState1 = EDWINJ_num_states + 1
  SET BGTEdwinJState2 = EDWINJ_num_states + 2
  SET BGTEdwinJState3 = EDWINJ_num_states + 3
  SET BGTEdwinJState4 = EDWINJ_num_states + 4

<<<<<<<< abc/makeEDWINJ3true.d
ADD_STATE_TRIGGER EDWINJ %BGTEdwinJState3% ~True()~
>>>>>>>>

COMPILE EVALUATE_BUFFER ~abc/makeEDWINJ3true.d~


I am trying out
Code: [Select]
ALWAYS
  ACTION_IF FILE_EXISTS_IN_GAME ~FW0100.are~ THEN BEGIN
    /* Tell the player it is using Tutu stuff */
    PRINT @1000
    INCLUDE ~BG1NPC\lib\g3_tutu_cpmvars.tpa~
  END ELSE BEGIN
    ACTION_IF FILE_EXISTS_IN_GAME ~AR7200.are~ THEN BEGIN
      /* Tell the player it is using BGT stuff */
      PRINT @1001
      INCLUDE ~BG1NPC\lib\g3_bgt_cpmvars.tpa~
      /* Tell the player it is not Tutu or BGT */
      END ELSE BEGIN FAIL @1002
    END
  END


with a modification of g3_bgt_cpmvars.tpa

COPY - ~BGT/backup/0/EDWINJ.DLG~ ~BGT/backup/0/EDWINJ.DLG~
  READ_LONG 0x8 EDWINJ_num_states
  OUTER_SPRINT BGTEdwinJState0 = EDWINJ_num_states
  OUTER_SPRINT BGTEdwinJState1 = EDWINJ_num_states + 1
  OUTER_SPRINT BGTEdwinJState2 = EDWINJ_num_states + 2
  OUTER_SPRINT BGTEdwinJState3 = EDWINJ_num_states + 3

and set the original values as expected in
And then leave current behavior later on:

COMPILE EVALUATE_BUFFER ~BG1NPC/Phase2/DLG/X#EDINT.D~

Or is this a misuse of OUTER_SPRINT? I need the variables to persist over several operations on several different components, but of course they are loaded in the ALWAYS section so that if someone just grabs or changes one component it will work too.

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: STATE_WHICH_SAYS
« Reply #30 on: January 14, 2008, 10:15:38 AM »
Code: [Select]
COPY - ~BGT/backup/0/EDWINJ.DLG~ ~BGT/backup/0/EDWINJ.DLG~
As I said in the other thread, change to
Code: [Select]
COPY - ~BGT/backup/0/EDWINJ.DLG~ ~.../inlined/BGT/backup/0/EDWINJ.DLG~otherwise you risk shadowing the real backup and messing up stuff in some chain-uninstall combos.

Quote
Or is this a misuse of OUTER_SPRINT? I need the variables to persist over several operations on several different components, but of course they are loaded in the ALWAYS section so that if someone just grabs or changes one component it will work too.
OUTER_SET since you're doing arithmetics, otherwise it's good (OUTER_SET and SET differ in synthax, not semantics).
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 cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: STATE_WHICH_SAYS
« Reply #31 on: January 14, 2008, 10:22:40 AM »
Got it - I will report back with test results and a crosscheck of code!  Will edit in results here:

OK, first problem. Latest 1.05b installs perfectly fine, but does not create a/leave a backup of any of these files.

ERROR: error loading [BGT/backup/0/EDWIN.DLG]

BGT\Backup\0 on a clean patched install only leaves VICONIP.dlg, EDWINP.dlg, MINSCP.dlg

plus JAHEIRA.BCS and a small set of changes. When you APEND, does WeiDU always make a backup?

I can structure with something like this, I think...

    /* Items and Variables that need special handling */
    OUTER_SPRINT "KICKED_OUT" "IWasKickedOut"
   
    ACTION_IF FILE_EXISTS ~BGT/backup/0/EDWIN.DLG~ BEGIN
      COPY - ~BGT/backup/0/EDWIN.DLG~ ~.../inlined/BGT/backup/0/EDWIN.DLG~
      READ_LONG 0x8 EDWIN_num_states
    END ELSE BEGIN
      OUTER_SET EDWIN_num_states = <<INSERT what here? The number of states looks form decompiled to work out to 74
    END

      OUTER_SET BGTEdwinState0 = EDWIN_num_states
      OUTER_SET BGTEdwinState1 = EDWIN_num_states + 1
      OUTER_SET BGTEdwinState2 = EDWIN_num_states + 2
      OUTER_SET BGTEdwinState3 = EDWIN_num_states + 3
      OUTER_SET BGTEdwinState4 = EDWIN_num_states + 4
      OUTER_SET BGTEdwinState5 = EDWIN_num_states + 5
      OUTER_SET BGTEdwinState6 = EDWIN_num_states + 6
      OUTER_SET BGTEdwinState7 = EDWIN_num_states + 7
      OUTER_SET BGTEdwinState8 = EDWIN_num_states + 8
« Last Edit: January 14, 2008, 02:12:00 PM by cmorgan »

Offline Ascension64

  • Planewalker
  • *****
  • Posts: 472
Re: STATE_WHICH_SAYS
« Reply #32 on: January 14, 2008, 09:22:04 PM »
WeiDU won't make a backup if the file isn't already in the override before patching.

If not backed up, use ToB v26498 num_states.

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: STATE_WHICH_SAYS
« Reply #33 on: January 15, 2008, 05:17:27 PM »
Cool - based on your idea, the bigg's feedback, and Nythrun's quiet coaching, we haev a new testing possibility:

/* Nythrun's, Ascension64's, and the biggs Fluid State Solution: EdwinJ */
OUTER_SET edwinj_num_states = 0
ACTION_IF FILE_EXISTS_IN_GAME ~AR7200.are~ THEN BEGIN
  ACTION_IF FILE_EXISTS ~bgt/backup/0/edwinj.dlg~ THEN BEGIN
    COPY - ~bgt/backup/0/edwinj.dlg~ ~nowhere~ /<<<< or does this need to be .../inlined/BGT/backup/0 ? <<<
      READ_LONG 8 edwinj_num_states
  END ELSE BEGIN
    OUTER_SET edwinj_num_states = 188
    ACTION_IF MOD_IS_INSTALLED ~setup-bg2fixpack.tp2~ "0" THEN BEGIN
       OUTER_SET edwinj_num_states = edwinj_num_states + 3
    END
  END
END
OUTER_FOR (i1 = 0; i1 < 378; i1 += 1) BEGIN
  SET EVALUATE_BUFFER ~BGTEdwinJState%i1%~ = i1 + edwinj_num_states
END


Given the limited number of materials on each particular file, I may try removing the OUTER_FOR iteration and setting individual discreet states, but it is ready for testing (so I need to get some stuff set up for it on a clean installl).

 

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