Author Topic: The IF_EVAL bug has been solved maintaining backwards compatibility.  (Read 4662 times)

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #25 on: November 25, 2005, 12:36:12 PM »
Wow. Can I use it for distribution, can I? can I?
Once I contact Weimer, yes  :)
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 the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #26 on: November 27, 2005, 05:01:02 AM »
- MKDIR ~%a_var%~ works.
- embarassing bugfix in my interpretation of FORBID_FILE  ::)
- AT_* ~NOTEPAD this~ and AT_* ~EXPLORER this~ now work like ~AT_* ~VIEW this~.
- --skip-at-view CLI option makes you skip the readme displaying (EG if you were testing a mod and reinstalling it 10^10 times it gets annoying).

Updated diffs & executable.
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 the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #27 on: November 27, 2005, 10:39:49 AM »
- --quick-log doesn't print the name of installed components in the log (saves around 4 seconds per mod for people with large collections).
- Long-time pending tutorial for SET_2DA_ENTRY_LATER/NOW added.
- READ_2DA_ENTRIES_NOW/READ_2DA_ENTRY_FORMER added, they work somewhat like SET_2DA_ENTRY_LATER / SET_2DA_ENTRIES_NOW and are supposed to be faster. See the (rather skinny) tutorial.
- SET_THE_INTERACTIVE_VARIABLE removed, the variable is set implicitly.
- NO_IF_EVAL_BUG promoted to tp2 flag.
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 the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #28 on: December 13, 2005, 06:53:55 AM »
- The new handling of biff files (IE they are searched in the chitin rather than as files) is now only for strings matching ~data[:/\\]25[^.]*\.bif~ (to solve a bug with some Tutu mods).
- COPY_LARGE allows to copy (no patching, no predicates) files that are greater than Sys.max_string_lenght (IE the usual 16 Mb limit). now it's raised to about 1 Gb.
- if you're overwriting a file that is > Sys.max_string_lenght in size, the backup process works without a glitch.

Soon to follow: OGGDEC and TISUNPACK hardwired in WeiDU: you can in your tp2 OGGDEC [options] ~file1~ ~override~ and weidu will oggdec file1 (with usual directory support) and copy the result to the override, including everything in the backup process; this'll work for result files that are >= Sys.max_string_lenght. Stay tuned for when I can complete the C interfacing and get to compile everything  :)

Unfortunately, I can't add WAV2ACM or MAKE_BIFF support: the former for (c) reasons and because the backup process is optimized for the override, the latter because the modified chitin.key cannot be used by WeiDU. Stay tuned for lucky strikes  ;D
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 Borsook

  • off topic
  • Planewalker
  • *****
  • Posts: 1679
  • Gender: Male
  • not a badger
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #29 on: December 13, 2005, 06:58:31 AM »
Wow! These are really interesting changes! I don't wanna badger you or anything but how goes making it official? I mean it's great but it's a modding tool, we need it to make mods not theoretical exercises!
"Borsook seems like a pretty cool guy who offers his insight where appropriate... just very, very frequently." - Imrahil

Borsook's Chambers - Home of Borsook's Mods

Offline Ascension64

  • Planewalker
  • *****
  • Posts: 472
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #30 on: December 13, 2005, 07:03:31 AM »
Quote
- The new handling of biff files (IE they are searched in the chitin rather than as files) is now only for strings matching ~data[:/\\]25[^.]*\.bif~ (to solve a bug with some Tutu mods).
What sorts of problems in particular?

Quote
- COPY_LARGE allows to copy (no patching, no predicates) files that are greater than Sys.max_string_lenght (IE the usual 16 Mb limit). now it's raised to about 1 Gb.
- if you're overwriting a file that is > Sys.max_string_lenght in size, the backup process works without a glitch.
I thought OCamL could not support this.

Well done anyway.

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #31 on: December 13, 2005, 07:27:19 AM »
Quote
- The new handling of biff files (IE they are searched in the chitin rather than as files) is now only for strings matching ~data[:/\\]25[^.]*\.bif~ (to solve a bug with some Tutu mods).
What sorts of problems in particular?
See http://forums.gibberlings3.net/index.php?showtopic=4973&view=findpost&p=47520 this thread.

Quote
Quote
- COPY_LARGE allows to copy (no patching, no predicates) files that are greater than Sys.max_string_lenght (IE the usual 16 Mb limit). now it's raised to about 1 Gb.
- if you're overwriting a file that is > Sys.max_string_lenght in size, the backup process works without a glitch.
I thought OCamL could not support this.

Well done anyway.
OcaML has no limitiations on files, however WeiDU loads files as a string for easiness of patching (which is possible since in OcaML strings aren't null terminated like in C), and strings (on 32 bit machines) are limited to 2^24 - 5 characters (or something-like-that), while 'normal' files are limited to something like 2^30 bytes.

Hint: on 64 bit machines WeiDU can handle basically arbitrary file sizes  :D
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 the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #32 on: December 13, 2005, 12:54:11 PM »
Well, getting the C interface up wasn't the difficult part; however, for some reason or some other I can't get Tisunpack to link correctly with the jpeg library. I'll see wether it's easier to make a variant of AT_*_EXIT that is run when encountered, rather than at the end of the installation or to bash my head against some stupidity.
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 the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #33 on: December 13, 2005, 01:30:37 PM »
AT_*_NOW added, diffs + beta updated.
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 the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #34 on: December 16, 2005, 04:42:06 AM »
  * DEFINE/LAUNCH_ACTION_MACRO (with MACRO_ACTION as synonim) added, they are similar to the so-called functions in bash (or, less precisely, to Basic's GOSUB). On the same line, DEFINE/LAUNCH_PATCH_MACRO (with MACRO_PATCH as synonim). Tutorials pending.
  * OUTER_INNER_PATCH, OUTER_INNER_PATCH_SAVE, OUTER_FOR, OUTER_SET, OUTER_SPRINT added. They work like their non-OUTER cousins, except that they are actions and OUTER_FOR launches actions as well. OUTER_INNER_* have synonims in OUTER_*.
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 the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #35 on: December 19, 2005, 10:21:20 AM »
COUNT_REGEXP_INSTANCES allows you to count the number of occurances of a certain regexp inside the file being edited. Don't assume it's a fast patch, neither assume it'll compute correctly non-trivial regexp.
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 Idobek

  • Dust Bunny
  • Planewalker
  • *****
  • Posts: 431
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #36 on: December 19, 2005, 11:45:37 AM »
Since you're on a roll, please fix this bug.

If I could have some kind of CLEAR_MEMORY command that would unload all files and clear any saved variables that would be good too. I'm thinking this would be a catch all idea that might solve some hard-crashing bugs and uninstall errors. So, I could use it after an ADD_KIT to ensure that WeiDU no longer has kit.ids and kitlist.2da loaded before I attempt to modify them--it is my hypothesis that this is/was causing the hard-crash reported in the Divine Remix forums. If you could code up a CLEAR_MEMORY (or somesuch) diff I could use that to test my theories. Only if you're bored, of course.
The Gibberlings Three Forums

<SimDing0> Did you know G3 has secret forum rules?
<CamDawg> Yep. They're generally of the nature 'don't annoy Idobek.'

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #37 on: December 19, 2005, 12:13:27 PM »
Since you're on a roll, please fix this bug.
I can try to fix it, but subcomponent coding is a big POS, so I'm not sure if this is doable without changing a lot of the functionality.
I usually workaround this by offering a subcomponent group for each predicate group. (I coded macroes to make sure code repetition is kept to a minimum for such problems).

Quote
If I could have some kind of CLEAR_MEMORY command that would unload all files and clear any saved variables that would be good too. I'm thinking this would be a catch all idea that might solve some hard-crashing bugs and uninstall errors. So, I could use it after an ADD_KIT to ensure that WeiDU no longer has kit.ids and kitlist.2da loaded before I attempt to modify them--it is my hypothesis that this is/was causing the hard-crash reported in the Divine Remix forums. If you could code up a CLEAR_MEMORY (or somesuch) diff I could use that to test my theories. Only if you're bored, of course.
I can add clearing of variables in a minute, while there should be no problem with loading files: they are fopen()-d for reading on the disk, loaded in the memory, fclose()-d, you patch their image in the RAM, and then the destination is fopen()-d for writing/creation, the image is written, and it's fclose()-d.

I'll send you diffs with CLEAR_MEMORY in a sec  :)

ancillary notice: the \ -> / conversion for Mac OS X appears to be working.
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 the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #38 on: December 19, 2005, 02:16:16 PM »
Idobek's 'bug' is fixed in the sense that, when launching again the setup program, it'll uninstall the subcomponent whose patch expression became wrong. In doing this, it'll also uninstall the component adding cdcurse.spl, which then means that you'll still install the subcomponent with NOT FILE_EXISTS_IN_GAME ~cdcurse.spl~. If you prefer a different handling, just ask  :)
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 Ascension64

  • Planewalker
  • *****
  • Posts: 472
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #39 on: December 23, 2005, 06:02:02 AM »
Quote
DEFINE/LAUNCH_ACTION_MACRO (with MACRO_ACTION as synonim) added, they are similar to the so-called functions in bash (or, less precisely, to Basic's GOSUB). On the same line, DEFINE/LAUNCH_PATCH_MACRO (with MACRO_PATCH as synonim). Tutorials pending.
Although no one except the bigg knows how to use it yet, this feature looks really useful.  I just have a question regarding these commands, and it is on: whether the patches inside an INNER_* block in *_ACTION_MACRO, and the actions inside an OUTER_* block in *_PATCH_MACRO will work.  Hope that makes sense.

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: The IF_EVAL bug has been solved maintaining backwards compatibility.
« Reply #40 on: December 23, 2005, 06:18:02 AM »
Quote
DEFINE/LAUNCH_ACTION_MACRO (with MACRO_ACTION as synonim) added, they are similar to the so-called functions in bash (or, less precisely, to Basic's GOSUB). On the same line, DEFINE/LAUNCH_PATCH_MACRO (with MACRO_PATCH as synonim). Tutorials pending.
Although no one except the bigg knows how to use it yet, this feature looks really useful.  I just have a question regarding these commands, and it is on: whether the patches inside an INNER_* block in *_ACTION_MACRO, and the actions inside an OUTER_* block in *_PATCH_MACRO will work.  Hope that makes sense.
They work like this (from a mod of mine, soon to be released, contains also example of how to pass parameters via global variables):

Code: [Select]
/* a tp2 flag */
DEFINE_ACTION_MACRO ~FASTER_ROMANCES~ BEGIN
  <<<<<<<< faster_romance/macro/fixme.d
    REPLACE_ACTION_TEXT_REGEXP ~\(^aerie$\)\|\(^kalah2$\)~  ~StartDialogueNoSet()~ ~StartDialogueNoSet([PC])~
    REPLACE_ACTION_TEXT ~baerie~   ~MoveGlobal("AR0607","Aerie",\[1034\.1034\],0)~ ~MoveGlobal("AR0607","Aerie",[1034.1034])~
  >>>>>>>>
/* fix baerie.dlg (and others) ! */ 
  COMPILE ~faster_romance/macro/fixme.d~

  COPY_EXISTING ~sw1h01.itm~ ~override/tb#faster1.txt~
  COPY_EXISTING ~gtimes.ids~ ~override~
    READ_2DA_ENTRIES_NOW ~_#_#_#gtimes~ 2
  BUT_ONLY_IF_IT_CHANGES
 
  COPY_EXISTING_REGEXP GLOB ~.*\.bcs~ ~override~
  DECOMPILE_BCS_TO_BAF
    FOR (i = 0; i < _#_#_#gtimes; i+=1)
    BEGIN
      READ_2DA_ENTRY_FORMER ~_#_#_#gtimes~ i 0 number
      READ_2DA_ENTRY_FORMER ~_#_#_#gtimes~ i 1 string
      REPLACE_TEXTUALLY ~,%string%)~ ~,%number%)~
    END
    REPLACE_EVALUATE ~RealSetGlobalTimer(\(\"[^"]*\",\"[^"]*\"\),\([^)]*\))~
    BEGIN
      temp = multiply * MATCH2 ** (exponentiation nth_root) / divide
      MATCH2 = temp < MATCH2 ? temp : MATCH2
      SPRINT RESULT ~%MATCH2%~
    END
    ~RealSetGlobalTimer(%MATCH1%,%RESULT%)~
  COMPILE_BAF_TO_BCS
  BUT_ONLY_IF_IT_CHANGES
  IF ~^268OB~

  COPY_EXISTING_REGEXP GLOB ~.*\.dlg~ ~override~
  DECOMPILE_DLG_TO_D
    FOR (i = 0; i < _#_#_#gtimes; i+=1)
    BEGIN
      READ_2DA_ENTRY_FORMER ~_#_#_#gtimes~ i 0 number
      READ_2DA_ENTRY_FORMER ~_#_#_#gtimes~ i 1 string
      REPLACE_TEXTUALLY ~,%string%)~ ~,%number%)~
    END
    REPLACE_EVALUATE ~RealSetGlobalTimer(\(\"[^"]*\",\"[^"]*\"\),\([^)]*\))~
    BEGIN
      temp = multiply * MATCH2 ** (exponentiation nth_root) / divide
      MATCH2 = temp < MATCH2 ? temp : MATCH2
      SPRINT RESULT ~%MATCH2%~
    END
    ~RealSetGlobalTimer(%MATCH1%,%RESULT%)~
  COMPILE_D_TO_DLG
  IF ~RealSetGlobalTimer~
  BUT_ONLY_IF_IT_CHANGES
END


/* the components */
/* ****************************************
           FASTER ROMANCES
**************************************** */
/* RealSetGlobalTimer(_,_,x) is changed to be
multiply * x ^ (exponentiation / nth_root) / divide
(but only if the value decreases).

Values for multiply, exponentiation, nth_root and divide are computated
thanks to an external program written in C, included in the mod distribution,
see the file other/compute_faster_romance.c .
If you want me to add different pairs (not necessarily 3600->x and 36000->x),
it can be done fairly trivially, so ask away. (you can even compile and run
the 'compute_faster_romance' program yourself to find out the values yourself).
*/

BEGIN @9001
SUBCOMPONENT @9000
DESIGNATED 2500
// 3600  -> 3300
// 36000 -> 18000

OUTER_SET multiply = 795
OUTER_SET divide = 1000
OUTER_SET exponentiation = 736
OUTER_SET nth_root = 1000

LAUNCH_ACTION_MACRO ~FASTER_ROMANCES~

BEGIN @9002
SUBCOMPONENT @9000
DESIGNATED 2550
// 3600  -> 3000
// 36000 -> 12000

OUTER_SET multiply = 21689
OUTER_SET divide = 999
OUTER_SET exponentiation = 602
OUTER_SET nth_root = 1000

LAUNCH_ACTION_MACRO ~FASTER_ROMANCES~

BEGIN @9003
SUBCOMPONENT @9000
DESIGNATED 2600
// 3600  -> 2700
// 36000 -> 9000

OUTER_SET multiply = 37581
OUTER_SET divide = 1002
OUTER_SET exponentiation = 523
OUTER_SET nth_root = 1001

LAUNCH_ACTION_MACRO ~FASTER_ROMANCES~


basically, all they do is copying-pasting the code in DEFINE where is a LAUNCH (except that they *should* also be recursive), so they should work also in INNER and OUTER.

EDIT: actually, Refinements beta uses INNER_* inside a DEFINE_ACTION_MACRO and it works.

Also, macroes are recursive (IE a macro can call itself), so EG you can calculate a factorial:
Code: [Select]
DEFINE_ACTION_MACRO ~factorial~ BEGIN
  ACTION_IF i != 1 THEN
  BEGIN
    OUTER_SET factor = factor * i
    OUTER_SET i = i - 1
     LAUNCH_ACTION_MACRO ~factorial~
  END
END

BEGIN ~calculate a factioral~
OUTER_SET ~i~ = 5
OUTER_SET ~i_backup~ = ~%i%~
OUTER_SET ~factor~ = 1
LAUNCH_ACTION_MACRO ~factorial~
PRINT ~%i_backup%! = %factor%~
Take your time to make a mental note *never* to use global variables like that in a real programming language. Unfortunately, WeiDU ties our hands  :(
« Last Edit: December 23, 2005, 06:33:38 AM by the bigg »
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).

 

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