lynx Posted March 10, 2015 Posted March 10, 2015 So 10pp is going along well and I wanted to do a first game test. The weidu script just breaks apart and after reading some examples it is clear why. What I want to do is run a perl script (readable! ) on each decompiled bcs and dlg. The approach that CrevsDaak used were the deprecated DECOMPILE_BCS_TO_BAF variants, but due to errors and reading some examples it looks like it was meant to be used with the closing COMPILE_BAF_TO_BCS immediately, half of the reason for DECOMPILE_AND_PATCH. Perhaps the 2 pairs are gone by now anyway. So the current two-step approach is obviously wrong: https://github.com/lynxlynxlynx/gemrb-mods/blob/master/10pp/setup-10pp.tp2#L61 and something more along these changes would do: http://sprunge.us/cOcX?diff There is a COMPILE that nicely dumps to a file, but not a general DECOMPILE. Does weidu dump the file after decompiling somewhere reachable, with a known name? Or, can its buffer be dumped manually? I could make the script eat and output to stdin/stdout (currently requires files), but that would probably just whizz by weidu... While I'm at it, is there any prefference for single or multiline APPENDs?
Jarno Mikkola Posted March 10, 2015 Posted March 10, 2015 You probably should read what the current weidu readme says about the subject: Use DECOMPILE_AND_PATCH instead. And "Does weidu dump the file after decompiling somewhere reachable, with a known name?" I would assume the answer to the question for DECOMPILE_AND_PATCH is, that the target folder is the override folder.
the bigg Posted March 10, 2015 Posted March 10, 2015 DECOMPILE_AND_PATCH cannot submit the decompiled (BAF|D) file to an external process, thus you have to use DECOMPILE_BCS_TO_BAF instead (which is deprecated not because broken, but because 99% of its use cases are better solved by using DECOMPILE_AND_PATCH, as exemplified in the DECOMPILE_AND_PATCH documentation). BTW: will you kick yourself after learning that WeiDU has a REFACTOR_BCS_TRIGGER command, that knows how to process Boolean logic?
lynx Posted March 10, 2015 Author Posted March 10, 2015 Welcome back. Wisp wrote somewhere that the old implementations will be removed, so it didn't sound like a long term solution. Anyway, that's what the current code uses, but weidu barfs: [./dialog.tlk] claims to be a regular file.In state 135, I expected one of these tokens:[0] EOF[2] ~~[3] <<<<<<<<[14] DEFINE_ACTION_FUNCTION[27] APPEND_COL[29] ACTION_FOR_EACH[31] INCLUDE[34] AT_INTERACTIVE_NOW[37] ADD_SPELL[51] RANDOM_SEED[53] DEFINE_ACTION_MACRO[54] AT_EXIT[55] OUTER_PATCH[63] OUTER_TEXT_SPRINT[65] CLEAR_ARRAYS[77] ACTION_READLN[82] BIFF[85] DECOMPRESS_BIFF[89] COMPILE[93] OUTER_WHILE[96] REQUIRE_FILE[97] ADD_MUSIC[101] WARN[109] ACTION_CLEAR_ARRAY[110] LAUNCH_ACTION_MACRO[123] COPY_ALL_GAM_FILES[130] AT_UNINSTALL[131] FORBID_FILE[132] ADD_SECTYPE[135] CLEAR_MEMORY[136] DEFINE_PATCH_MACRO[145] ACTION_DEFINE_ARRAY[153] LAUNCH_ACTION_FUNCTION[155] ACTION_TO_LOWER[161] APPEND_COL_OUTER[164] ACTION_BASH_FOR[167] STRING_SET[175] OUTER_FOR[178] ACTION_TO_UPPER[181] AT_UNINSTALL_EXIT[183] ALTER_TLK_LIST[192] CLEAR_IDS_MAP[198] APPEND[199] ACTION_GET_STRREF[200] ADD_KIT[201] AT_NOW[212] COPY_EXISTING_REGEXP[219] UNINSTALL[227] COPY_LARGE[231] EXTEND_TOP[232] LOG[235] STRING_SET_EVALUATE[239] ADD_AREA_TYPE[240] CLEAR_INLINED[244] GET_FILE_ARRAY[245] ACTION_GET_STRREF_F[250] OUTER_SPRINT[252] FAIL[253] MKDIR[254] ADD_PROJECTILE[258] ACTION_GET_STRREF_S[259] SILENT[260] LPAREN[264] EXTEND_BOTTOM_REGEXP[265] AT_INTERACTIVE_UNINSTALL_EXIT[266] AT_INTERACTIVE_EXIT[269] ADD_JOURNAL[273] ACTION_MATCH[274] LOAD_TRA[277] PRINT[282] COPY_KIT[283] REINCLUDE[284] AT_INTERACTIVE_UNINSTALL[285] CLEAR_CODES[292] COPY[296] OUTER_PATCH_SAVE[298] MOVE[300] DEFINE_PATCH_FUNCTION[303] DELETE[308] COPY_EXISTING[310] ACTION_PHP_EACH[315] ACTION_DEFINE_ASSOCIATIVE_ARRAY[317] EXTEND_BOTTOM[318] GET_DIRECTORY_ARRAY[320] ACTION_TRY[321] BEGIN[323] DISABLE_FROM_KEY[326] ADD_SCHOOL[333] COPY_RANDOM[353] STRING_SET_RANGE[354] APPEND_OUTER[355] CLEAR_EVERYTHING[356] OUTER_SET[359] ALTER_TLK[369] ACTION_GET_STRREF_FS[370] ACTION_RERAISE[372] ALTER_TLK_RANGE[377] WITH[378] VERBOSE[380] EXTEND_TOP_REGEXP[385] END[386] ACTION_IFParse error (state 135) at DECOMPILE_BCS_TO_BAF[10pp/setup-10pp.tp2] PARSE ERROR at line 70 column 1-26Near Text: DECOMPILE_BCS_TO_BAFGLR parse error ... so for all I know, it has already been deprecated fully. Any ideas? I've read about REFACTOR_BCS_TRIGGER, but that's both not enough and the docs warn against using it. It's not just about appending extra triggers, sometimes you have to copy whole blocks, more or less changed (triggers, actions or both). Might be useful for the dialog extender though, since the grammar is much nastier there. Does weidu care if extra newlines are put between keywords in .d files? Like preprocessing "~Kit(bla,bla)" to "~\nKit(bla,bla)"?
the bigg Posted March 10, 2015 Posted March 10, 2015 I don't think the DECOMPILE_BCS_TO_BAF command will ever be removed, since doing that will break all mods that use it. However, you need a COPY (or friends) command to use DECOMPILE_BCS_TO_BAF, since it's a PATCH (I.E. something that operates on a "current buffer", which MOVE does not create, but COPY and friends do). I'm too rusty on the synthax to write sample code; the recommended algorithm should look like: COPY_EXISTING_REGEXP GLOB ~^.*\.bcs$~ ~override~ COUNT_REGEXP_INSTANCES ~regexp~ ~has_player_6 PATCH_IF has_player_6 THEN BEGIN DECOMPILE_AND_PATCH BEGIN read the current buffer into file_contents INNER_ACTION BEGIN write the variable file_contents to 10pp/tmp/tmp.baf AT_NOW ~perl wrapper.pl 10pp/tmp/tmp.baf 10pp/tmp/tmpout.baf~ read 10pp/tmp/tmpout.baf into file_contents END delete the current buffer write file_contents as the current buffer END END BUT_ONLY Re: REFACTOR_TRIGGER and D files: WeiDU does not, generally speaking, care about whitespaces when compiling a DLG file. IIRC, they do matter for some purpose in the BG1 engine (which is irrelevant, given the GemRB target).
lynx Posted March 10, 2015 Author Posted March 10, 2015 great, thanks. I'll have to read about patch/action differences sometime. CrevsDaak also came around and is fixing stuff for me now.
Wisp Posted March 14, 2015 Posted March 14, 2015 Wisp wrote somewhere that the old implementations will be removedI don't think I've ever said that, but if I did, it's not true.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.