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: cmorgan
« on: August 17, 2008, 01:01:21 PM »

Yeah, sorry, still asleep. I should delete those posts for stupidity alone.

REPLACE_STATE_TRIGGER.

I guess what I should have been asking is there something akin to

REPLACE_STATE_TRIGGER_REGEXP

where instead of reading all of the state triggers i could just read one, look for a specific text string (like "wyvern") and replace it, so that we are back to the original request -

Quote
The problem with REPLACE_TRIGGER_TEXT is that you can't make it work for the triggers of a specific state, it's every trigger in the file or nothing.  The text I'm replacing may be perfectly valid in many, even most states, and I may just want to change it in a specific one.  That's why a syntax and functionality like REPLACE_TRANS_ACTION, where you can specific BEGIN [statelist] END BEGIN [transition] END ~TextToBeReplaced~ ~NewText~ would rock.

and it looked like the bigg said yes -

Quote
1. OK then. The various REPLACE_* actions all behave differently now anyway (all the file vs. state/trans list, regex vs. destructive replace), so having more inconsistencies won't harm.

but I have not seen it in the logs, and have not seen what the command would be -

if it isn't possible, there is no problem.
Posted by: Taimon
« on: August 17, 2008, 12:36:05 PM »

But this only deals with transition triggers, not the state trigger. (Or am I missing something here?)
Posted by: cmorgan
« on: August 17, 2008, 11:34:30 AM »

Serves me right for posting when half asleep.

I was looking to see if there was an equivalent to ALTER_TRANS that dealt with state triggers in a non-destructive way - and there is,

REPLACE_TRANS_TRIGGER filename BEGIN stateNumber  list END BEGIN transNumber  list END oldText newText (with regexp.)

Posted by: Taimon
« on: August 17, 2008, 09:03:01 AM »

Ehh, I'm not getting what you want to do.
ALTER_TRANS will not help if you want to modify the state trigger.
REPLACE_TRANS_TRIGGER with regexp if you want to replace something inside a specific transition trigger.
Posted by: cmorgan
« on: August 17, 2008, 12:46:47 AM »

Quote
actually, REPLACE_TRIGGER_TEXT should already do what you want (regexp substitution) on both Trans and State triggers. Is this enough, or is your regexp also matched by a State Trigger where it shouldn't?

The problem with REPLACE_TRIGGER_TEXT is that you can't make it work for the triggers of a specific state, it's every trigger in the file or nothing.  The text I'm replacing may be perfectly valid in many, even most states, and I may just want to change it in a specific one.  That's why a syntax and functionality like REPLACE_TRANS_ACTION, where you can specific BEGIN [statelist] END BEGIN [transition] END ~TextToBeReplaced~ ~NewText~ would rock.

Another way to look at it is, whatever possessed someone to create REPLACE_TRANS_ACTION when REPLACE_ACTION_TEXT was already available, same reasoning here :)
[/quote]

Hey - is this applied in v20800? I don't see mention of it, and really could use it -

http://forums.gibberlings3.net/index.php?s=&showtopic=14602&view=findpost&p=130684

instead of combing through and messsing with everyone's triggers,

REPLACE_TRIGGER_TEXT %CORAN_JOINED% ~!Dead("Wyvern")~  ~!Dead("X#CoranWyvern")~

which it looks like allows regexp so I could look for both !Dead("Wyvern") and Dead("Wyvern") (or perhaps even just change the "Wyvern" if it isn't case sensitive) but scares me on regexp searches of the folks who have big lists of mods and little patience for research just want to toss them on, do you actually have a variant on

REPLACE_TRIGGER_ACTION %CORAN_JOINED%  BEGIN  END BEGIN 0 END ~Dead("wyvern")~ ~Dead("X#CoranWyvern")~
I know I can completely replace the trigger using

ALTER_TRANS DOGHMA // file name
BEGIN 9 END // state number (can be more than one)
BEGIN 3 END // transition number (can be more than one)
BEGIN // list of changes, see below for flags
  "TRIGGER" ~Global("RevealUmar","GLOBAL",1)
           OR(4)
             PartyHasItem("miscbl")
             PartyHasItem("miscbm")
             PartyHasItem("miscbn")
             PartyHasItem("miscbo")~
END

There are eight flags you can use in the list of changes. If you do not use a particular flag, the previous value of the transition will be retained (i.e. not specifying an ACTION flag will preserve the current action of the transition).

    * TRIGGER: The trigger condition for the transition. i.e "TRIGGER" ~Global("foo","GLOBAL",0)~
    * ACTION: The action performed if the transition is selected. i.e. "ACTION" ~SetGlobal("foo","GLOBAL",1)~
    * REPLY: The player’s reply, if any. i.e. "REPLY" ~#57922~
    * JOURNAL: Can add or change the journal entry. i.e. "JOURNAL" ~@100~
    * SOLVED_JOURNAL: Same as JOURNAL, except for entries into the solved section of the journal.
    * UNSOLVED_JOURNAL: Same as JOURNAL, except for entries into the unsolved section of the journal.
    * EPILOGUE: Specifies where the transition leads to (GOTO, EXTERN, or EXIT) i.e. EPILOGUE" ~EXTERN BVICONI 0~
    * FLAGS: Used to set transition flags manually, though I can’t imagine why one would do this.


ALTER_TRANS %CORAN_JOINED% BEGIN 0 END BEGIN 0 END BEGIN "TRIGGER" ~Dead("X#CoranWyvern")~ END

but I believe this blows away the existing trigger, right... which is not what I want to do.
Posted by: Qwinn
« on: May 17, 2008, 02:13:04 PM »

Nythrun:  In the end, I went with your APPEND_FILE_EVALUATE solution, which allowed me to add the quests with no line feed issues.  Thanks for that solution :)

Qwinn

P.S.  The inline bit, while I would -love- to use it, isn't working.  I had to make the added two quests an actual separate file.  When trying the inline bit, even if I pull up my .tph in notepad, delete all the carriage returns in the inlined portion and add them back in, when I rerun the append_file_evaluate on the inline part it will still screw them up.  Gah.  No idea why.

Posted by: Qwinn
« on: May 08, 2008, 07:58:55 PM »

Yup, sure did.  Will test it shortly, I'm literally in the last hour or two of my initial coding phase for all 3 mods.

Qwinn
Posted by: the bigg
« on: May 08, 2008, 07:13:03 AM »

Coded and uploaded the beta (you got my PM Qwinn?).
Posted by: the bigg
« on: May 08, 2008, 06:23:46 AM »

WeiDU reads the whole file as 8 bit reads, so it can't lose the ending CR.

The problem is that not all files actually end with CRLF (for some reason, Windows users forget to end their files with a CRLF, thus breaking all *nix utilities and then some).
Posted by: Taimon
« on: May 08, 2008, 06:05:29 AM »

You need to take into account that, if the file is text and not empty, buff will usually end with CRLF or just LF.
(However, I'm not sure if this is somehow stripped when WeiDU reads the file.)
So buff ^ "\r\n" leads to a double CRLF which should get replaced by the regexp with just one CRLF.
Posted by: the bigg
« on: May 08, 2008, 05:18:44 AM »

For whatever reason, both APPEND and APPEND_OUTER (which share 99% of the code) are adding a CRLF between the file and the new content, as well as basically changing broken expressions like CRCRCRLF to CRLF - but the regexp backfired. This behaviour is also present in W185, so I can't risk changing it and starting World War MDCLXVI again. I can cook up APPEND{_OUTER} file what DONT_FUCK_UP_CRLF though.
Posted by: Nythrun
« on: May 08, 2008, 01:22:23 AM »

On Windows, APPEND_OUTER is always adding a CRLF before any appended text (such that APPEND_OUTER any.file ~~ is still adding two bytes of trash).

It looks, however, like it's also taking it upon itself to replace every instance of CRLFCRLF with CRLF.

Some form of the following (with "proper" linefeeding in the inlined file) for a tide-me-over?
Code: [Select]
<<<<<<<<inlinedfilesarecool/ini.update

[%Quest1%]
title=64151
descAssigned=64940
descCompleted=64941
assignedChecks=1
aVar1=Sheryl_Quest
aValue1=3
aCondition1=EQ
completeChecks=1
cVar1=Sheryl_Quest
cValue1=4
cCondition1=EQ

[%Quest2%]
title=64943
descAssigned=64944
descCompleted=64945
assignedChecks=1
aVar1=Ulthera_Quest
aValue1=3
aCondition1=EQ
completeChecks=1
cVar1=Ulthera_Quest
cValue1=4
cCondition1=EQ
>>>>>>>>
COPY_EXISTING quests.ini quests.ini
  COUNT_REGEXP_INSTANCES ~^\[[0-9]+\]~ Quest1
  REPLACE_EVALUATE ~questcount=%Quest1%~ BEGIN
    SET NewTotal = Quest1 + 2
  END              ~questcount=%NewTotal%~
  SET Quest2 = Quest1 + 1
  APPEND_FILE_EVALUATE ~inlinedfilesarecool/ini.update~
UNLESS ~Ulthera_Quest~
Posted by: Qwinn
« on: May 07, 2008, 07:38:08 PM »

Sorry, sorry, sorry, really sorry, I wasn't specific enough.  It's APPEND_OUTER that did it, not just APPEND.

Here's exactly what I did.  All the COPY is doing is counting the number of existing quests in the file and updating the questcount in the first line. 

The file still has all of it's blank lines after the BUT_ONLY_IF_IT_CHANGES.  It loses them during the APPEND_OUTER. 

Code: [Select]
COPY ~quests.ini~ ~quests.ini~
  COUNT_REGEXP_INSTANCES CASE_INSENSITIVE ~descAssigned=~ "Quest1"
  SET "NewTotal" = "Quest1" + 2
  SET "Quest2" = "Quest1" + 1
  REPLACE_TEXTUALLY
    ~questcount=%Quest1%~ ~questcount=%NewTotal%~
 BUT_ONLY_IF_IT_CHANGES

APPEND_OUTER ~quests.ini~
~[%Quest1%]
title=64151
descAssigned=64940
descCompleted=64941
assignedChecks=1
aVar1=Sheryl_Quest
aValue1=3
aCondition1=EQ
completeChecks=1
cVar1=Sheryl_Quest
cValue1=4
cCondition1=EQ
[%Quest2%]
title=64943
descAssigned=64944
descCompleted=64945
assignedChecks=1
aVar1=Ulthera_Quest
aValue1=3
aCondition1=EQ
completeChecks=1
cVar1=Ulthera_Quest
cValue1=4
cCondition1=EQ~

Again, sorry for wasting your time looking at other versions of APPEND.

Let me know if you still can't replicate it, and I'll send you the quests.ini I get after I run this bit on it.

Qwinn
Posted by: the bigg
« on: May 07, 2008, 07:26:24 AM »

I can't replicate #4 (quests.ini losing blank lines) with either APPEND or APPEND_FILE. Can you zip your quests.ini up and email it to thebigg@spellholdstudios.net?
Posted by: Qwinn
« on: May 07, 2008, 03:37:33 AM »

Alright, fair enough.  No worries.

Believe me, if all I get out of my wish list is #1 and #2, I'll still be delighted :)

Oh, PS, the three mods will not be all one component, no, heh.  The Fixpack will be a single component, but the UB will be around 9 components and the Tweak Pack is currently at 2 and hopefully at least 5 by release.

Qwinn