Jump to content

Best way to add a prefix to all the global variables for a mod automatically


paladin84

Recommended Posts

I have a huge mod, all the resource files in it already have prefixes, but global variables are not. What is the best way to add a prefix to all the global variables automatically?

I wrote a python script to find all the instance strings in *.baf and *.d files that looks like:

"SOME_STRING","GLOBAL"

using the regexp (\s is all ASCII whitespaces, like space, tab, end of the string):

"[^"]*"\s*,\s*"GLOBAL"

and I am replacing it to be (my prefix is NW):

"NWSOME_STRING","GLOBAL"

I am making sure that the resultant string length is no more than 32 and ignoring all the variables started with "SPRITE_IS_DEAD". Is there anything else I should consider, or this is enough?

Link to comment

Effects — there could be some modifying variables via 0x109 https://gibberlings3.github.io/iesdp/opcodes/bgee.htm#op265

Oh, you can make the process faster by not converting all dlg and bcs files. I had to do the same for 10pp and first check for a rough match in the non-decompiled file:

https://github.com/lynxlynxlynx/gemrb-mods/blob/bf997587928686f8cc3b5f5b57e77ebebf152060/10pp/setup-10pp.tp2#L68

Edited by lynx
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...