Mike1072 Posted July 12, 2015 Share Posted July 12, 2015 Thanks for the help guys. Another question in a similar vein: Let's say my mod installs a kit (in this case my Magus kit with clab 'QDMAGUS' and internal name 'QDMAGUS'). The Magus by default installs with a base description including the string 'May cast arcane spells.'. If another component is installed, I want to update that phrase ('May cast arcane spells.') to say more stuff ('May cast arcane spells and may craft arcane items.'). How would I go about finding the string ref using WeiDu? (Basically, how do I efficiently find the string ref of the description of a mod kit?) You can load up KITLIST.2DA and scan through entries until you find your kit. The HELP column will contain the string reference for its description. OUTER_SET strref = (0 - 1) COPY_EXISTING - ~kitlist.2da~ ~override~ COUNT_2DA_COLS num_cols READ_2DA_ENTRIES_NOW ~r2en_kitlist~ num_cols FOR (row = 1; row < r2en_kitlist; row += 1) BEGIN READ_2DA_ENTRY_FORMER ~r2en_kitlist~ row 1 kitname PATCH_IF (~%kitname%~ STRING_EQUAL_CASE ~QDMAGUS~) BEGIN READ_2DA_ENTRY_FORMER ~r2en_kitlist~ row 4 strref END END ACTION_IF (strref >= 0) BEGIN PRINT ~QDMAGUS description string reference is %strref%~ END Link to comment
Aquadrizzt Posted July 13, 2015 Author Share Posted July 13, 2015 Thanks again Mike1072. One more question for you: How would one go about editing weapprof.2da based on kit name? Is there Weidu for reading column-wise vs. by row? For example, I want to give certain kits (i.e. QDELDSOR) the ability to place a proficiency point in crossbows. Link to comment
Mike1072 Posted July 13, 2015 Share Posted July 13, 2015 You can do it the same way as above, except looping through columns instead of rows. Because you want to include the header row (which has one less column than the other rows), you have to be more careful when dealing with the column indices. COPY_EXISTING ~weapprof.2da~ ~override~ COUNT_2DA_COLS num_cols READ_2DA_ENTRIES_NOW ~r2en_weapprof~ (num_cols - 1) FOR (col = 3; col < (num_cols - 1); col += 1) BEGIN READ_2DA_ENTRY_FORMER ~r2en_weapprof~ 0 col kitname PATCH_IF (~%kitname%~ STRING_EQUAL_CASE ~QDELDSOR~) BEGIN SET_2DA_ENTRY_LATER ~s2el_weapprof~ 24 (col + 1) 1 END END SET_2DA_ENTRIES_NOW ~s2el_weapprof~ (num_cols - 1) Link to comment
Aquadrizzt Posted July 13, 2015 Author Share Posted July 13, 2015 Damn I was missing a pair of parens... Thanks for the help. Link to comment
Aquadrizzt Posted July 13, 2015 Author Share Posted July 13, 2015 Yet another question. How would I go about writing a loop that looks through all spells in an associative_array and finds their description strings? (The associative array is between spell and level.) Link to comment
Mike1072 Posted July 14, 2015 Share Posted July 14, 2015 What's stored in the array? The spell's filename? ACTION_DEFINE_ASSOCIATIVE_ARRAY spells BEGIN sppr101 => 1 sppr201 => 2 END ACTION_PHP_EACH spells AS spell => level BEGIN COPY_EXISTING ~%spell%.spl~ ~override~ READ_STRREF UNIDENTIFIED_DESC description END Link to comment
Aquadrizzt Posted July 14, 2015 Author Share Posted July 14, 2015 More questions because I honestly have never worked with dialog beyond compiling it on install. Is it possible to add transitions to specific states without compiling first? And if so how? Otherwise, how would I use EXTEND_TOP to achieve the same effect on a compiled dialog file? Link to comment
Aquadrizzt Posted July 15, 2015 Author Share Posted July 15, 2015 I seem to have figured out a solution to my problem using careful application of regexp. Thanks for all the help. Link to comment
Galactygon Posted August 9, 2015 Share Posted August 9, 2015 I would like to ask something about regexps: I am intending to change variable names by patching some tp2 files(!) This is not something I would do at installation but something for later use instead of using ConText's find and replace function. I have some variables that for example are consistently called "%index%" but I also have variables that are called "%find_index%", "%delete_index%", etc. lots of different variations when I do stuff to extended headers/feature blocks. I have these variables often in expressions and often without "% and %". Specifically, what I want to do is rename for my own benefit all variables that are called "index" into "add_index" but not the variables "find_index" or any other variation I have that are called xyz_index. How do I do this with regexps and REPLACE_EVALUATE? Link to comment
lynx Posted August 9, 2015 Share Posted August 9, 2015 Without using strict look-behind (weidu does not support it), something like this should do: \([^_]\)index -> \1add_index Link to comment
Galactygon Posted August 11, 2015 Share Posted August 11, 2015 Thanks, this seems to have did the trick. Link to comment
Aquadrizzt Posted August 24, 2015 Author Share Posted August 24, 2015 More questions about .DLG files. Is it possible to get the strref of a state/trigger text/action text using Weidu? And if so, how? Link to comment
Aquadrizzt Posted October 11, 2015 Author Share Posted October 11, 2015 To clarify the goal of the above post, basically I was wondering if it is possible for Weidu to look at a .dlg (or a .d from a decompilation) file, determine each state, look at the strref of the trigger text and action text of that state, and then do something with that strref? Link to comment
Mike1072 Posted October 12, 2015 Share Posted October 12, 2015 Since the .dlg format is known (IESDP), yes, you could write WeiDU code to do that. I don't think there are any built-in WeiDU commands that can get it for you. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.