Jump to content

Variable timers: tp2


Kulyok

Recommended Posts

Until we get a tutorial or open access mod, here is what we have ended up with (splitting the print behavior so it works regardless of error or not on users' part):

 

/* BRANWEN ROMANCE */
BEGIN @1014  /* The BG1 NPC Project: Branwen's Romance Core (teen content) */
 GROUP @1010  /* The BG1 NPC Project: Romances */
 REQUIRE_FILE ~override/X#BG1NPCCore.G3~ @1004 /* BG1 NPC Required Changes component is not installed. */

 /* makes sure PIDs go last */
 UNINSTALL ~bg1npc.tp2~ 200

 /* Branwen romance timer */
PRINT @1106 /* ~Select Branwen's Romance Speed:~ */

PRINT @1102 /* @1102  = ~Please choose one of the following:
[1] 1 hour real time (standard) minimum between LoveTalks
[2] 45 minutes real time minimum between LoveTalks
[3] 30 minutes real time minimum between LoveTalks
[4] 15 minutes real time minimum between LoveTalks
[5] 1 hour 30 minutes (extended) real time minimum between LoveTalks~ */

OUTER_SPRINT ~brantimer~ ~placeholder_value~
OUTER_WHILE (!(IS_AN_INT ~brantimer~) OR (~brantimer~ > 0x5) OR (~brantimer~ < 0x1)) BEGIN
 PRINT @1108 /* ~Please select 1, 2, 3, 4, or 5 and press enter.~ */
 ACTION_READLN ~brantimer~
END
  ACTION_IF ("brantimer" = 1) THEN BEGIN
  APPEND ~gtimes.ids~ ~3600 BRROM_TIMER~
  PRINT @1109
  END
  ACTION_IF ("brantimer" = 2) THEN BEGIN
  APPEND ~gtimes.ids~ ~2700 BRROM_TIMER~
  PRINT @1110
  END
  ACTION_IF ("brantimer" = 3) THEN BEGIN
  APPEND ~gtimes.ids~ ~1800 BRROM_TIMER~
  PRINT @1111
  END
  ACTION_IF ("brantimer" = 4) THEN BEGIN
  APPEND ~gtimes.ids~ ~900 BRROM_TIMER~
  PRINT @1112
  END
  ACTION_IF ("brantimer" = 5) THEN BEGIN
  APPEND ~gtimes.ids~ ~5400 BRROM_TIMER~
  PRINT @1113
  END

 COPY ~BG1NPC/Core/X#component.xx~ ~override/X#BranwenRomance.G3~

/* Script Prep */
COPY ~BG1NPC/Phase3/BRROM/BAF/P#BRROM.baf~ ~BG1NPC/PLATFORM/P#BRROM.baf~
  EVALUATE_BUFFER
COPY ~BG1NPC/Phase3/BRROM/BAF/P#BRROD.baf~ ~BG1NPC/PLATFORM/P#BRROD.baf~
  EVALUATE_BUFFER

 /* script */
EXTEND_TOP  ~%BRANWEN_BCS%.BCS~ ~BG1NPC/PLATFORM/P#BRROM.baf~
EXTEND_TOP   ~%tutu_var%BRANWD.BCS~ ~BG1NPC/PLATFORM/P#BRROD.baf~

 /* dialogue */
COMPILE EVALUATE_BUFFER ~BG1NPC/Phase3/BRROM/DLG/P#BRLT.D~

Link to comment

Yes, zero is excluded (variables are not interpreted as signed by default) :)

 

Is there a particular reason why you're checking for the presence of one of your own flag files rather than the presence of a DESIGNATED component? I've had bad behavior with failed installs not unrolling all COPYs before and you might end up with a flag file in the override and no mod to go with it (it's unlikely, but you never know) :love:

Link to comment

Actually, it is because several things:

prior flakiness with our coding of UNINSTALL and differences in component number (people just seem to refuse to read directions :)

Quick and easy A_I F_E_I_G usage for other mods detecting, especially SCS and hopefully UB

 

But the big one:

Quick and easy mass uninstall from the first component. With GROUP, SUBCOMPONENT, and FORCED_SUBCOMPONENT (though this code now does away with the need for FORCED_SUBCOMPONENT), WeiDU acts as if the ASK_EVERY is set, and force a player to uninstall each component one at a time. Using R_F and a flag file pulls all installed components from the "temporarily" to "permanently" uninstalled status if the Required Changes component is installed.

 

Basically, it is a way to get to have our cake and eat it to... folks can see GROUPs or not, can modify what they want, but if they pull the Required Changes component, everything else immediately uninstalls. Cool posts on FORCED_SUBCOMPONENT behavior on the WeiDU forums, where I was experimenting with this and the bigg was trying to explain it to me...

as always, I am teachable, so if there is a way to do this better, please let me know, and I will try it out!

Link to comment

I wasn't suggesting removing the flag files, only changing the checks in BG1NPC from REQUIRE_FILE to REQUIRE_COMPONENT ~Setup.BG1NPC~ "0" - you can check for your own .tp2 and it works fine, including the batch uninstall EVEN_IF_GROUP_IS_USED :)

 

Hmm, might be useful to have a predicate (COMPONENT_IS_INSTALLED ~tp2~ ~num~) or some such thing....

Link to comment

If I understand you correctly, a better way to code this might be (since our tp2 is actually "BG1NPC.tp2" rather than Setup-BG1NPC.tp2" for legacy purposes, and Ascension64 just had to change that for BGT tweaks and possible SCS BGT):

 

/* BRANWEN ROMANCE */
BEGIN @1014  /* The BG1 NPC Project: Branwen's Romance Core (teen content) */
 GROUP @1010  /* The BG1 NPC Project: Romances */

 REQUIRE_COMPONENT ~BG1NPC~ "0" @1004 /* BG1 NPC Required Changes component is not installed. */

 /* makes sure PIDs go last */
 UNINSTALL ~bg1npc.tp2~ 200
 /* flag file for other mods to detect */
COPY ~BG1NPC/Core/X#component.xx~ ~override/X#BranwenRomance.G3~

and that it will still do everything that checking for the flag file will do, plus make sure that if something messes up in a partial install and doesn't roll everything all the way back (I have had this happen once, too :) ) it should continue to function correctly?

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...