erebusant Posted March 30, 2010 Share Posted March 30, 2010 I have 58 (BGT based) spawn point bafs totalling 20 Mb of data I need to update in order to upgrade and enhance the Bonehill Tutu area spawns. How would one code a tool that would take each baf either individually or en mass, and 1st, list all .cre's that could possibly be spawned by the script, 2nd make a list of all .cre's available in a Tutu game, 3rd compare the 1st list against the 2nd list, and 4th, output a final list for each baf that lists any .cre being called by the script that does not exist in a Tutu game? Once I get that list I can do a relatively simply find/replace action with wordpad to replace any .cre that will induce a CTD due to not existing if it gets called. Link to comment
cmorgan Posted March 30, 2010 Share Posted March 30, 2010 Hopefully, someone with much higher level skills will help on this one, but in the meantime... I have done similar things the ancient, old-fashioned text editor way in the past. Using NotePad++ "find in files", searching for CreateCreature or similar, all BGT files. Saved, reordered into a list with the option to remove duplicates. Replace All Instances = CreateCreature(" with nothing (leave the box for replacement blank, and it will simply erase it). Open in Crimson or ConTEXT or something with a good column editor and remove the extraneous end data, or, if the list only has entries ending ") then do the same {replace all instances of ") with [blank box] }. That should have created a full list of BGT .cres calles in those .bafs. Repeat with Tutu. Cross compare docs in either a text editor, or winmerge, and use patch or list filters to determine list. Needless to say, that is a serious PITA to do, so I really hope there is a way-cool weidu or grep or quckly-coded-perl-or-some-other-coder - master who can help leverage another tool to do the job faster and with much less pain Doggone - i didn;t comprehend the question well enough, because you need to also export Tutu .bcs that spawn creatures with weidu first to do this - Link to comment
Miloch Posted April 2, 2010 Share Posted April 2, 2010 Well, I think you asked me this a bit ago and I said it'd take some WeiFU with REPLACE_EVALUATE and FILE_EXISTS_IN_GAME and stuff even more fun. If you can post a sample script (preferably short but comprehensive) and maybe a few more details on what you want to do with it, I might be able to hack up some code. As for generating a list of all Tutu CREs, that's already available and has been for ages thanks to Nythrun (see the CRE Lister in my signature - has both the code to run it and the actual output). Link to comment
erebusant Posted April 3, 2010 Author Share Posted April 3, 2010 The idea would be to take every .cre referenced in the baf and compare it against the Tutu CRE list, and then out put a 3rd list from the comparison that will say something to the effect of "Hold on there, Sparky. If you try to call one of these CRES you will cause a CTD because they do not exist in Tutu!" Following is a sample from one of the scripts that is running: IF Range([PC],35) TimeOfDay(NIGHT) NumInParty(2) OR(6) CheckStat(StrongestOf(Myself),6,LEVEL) CheckStat(StrongestOf(Myself),6,LEVEL2) CheckStat(StrongestOf(Myself),6,LEVEL3) CheckStat(StrongestOf(Myself),7,LEVEL) CheckStat(StrongestOf(Myself),7,LEVEL2) CheckStat(StrongestOf(Myself),7,LEVEL3) !CheckStatGT(StrongestOf(Myself),7,LEVEL) !CheckStatGT(StrongestOf(Myself),7,LEVEL2) !CheckStatGT(StrongestOf(Myself),7,LEVEL3) Global("SpawnReset5593701","BH1400",0) Global("RandomSet5593701_3","BH1400",1) THEN RESPONSE #4 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #4 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #5 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #6 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #6 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #5 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #5 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #5 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WOLF01",[559.3701],0) // Wolf CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg CreateCreature("WORG",[559.3701],0) // Worg SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #10 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #10 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf CreateCreature("WOLFDI",[559.3701],0) // Dire Wolf SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #6 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("BEARBL",[559.3701],0) // Black Bear CreateCreature("BEARBL",[559.3701],0) // Black Bear SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #4 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("WOLFWE",[559.3701],0) // Wolfwere SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #1 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBARC01",[559.3701],0) // Hobgoblin Archer CreateCreature("HOBELITE",[559.3701],0) // Hobgoblin Elite CreateCreature("HOBCAP01",[559.3701],0) // Hobgoblin Captain - Hobgoblin Captain SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #1 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBARC01",[559.3701],0) // Hobgoblin Archer CreateCreature("HOBARC01",[559.3701],0) // Hobgoblin Archer CreateCreature("HOBELITE",[559.3701],0) // Hobgoblin Elite CreateCreature("HOBCAP01",[559.3701],0) // Hobgoblin Captain - Hobgoblin Captain SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #1 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBARC01",[559.3701],0) // Hobgoblin Archer CreateCreature("HOBELITE",[559.3701],0) // Hobgoblin Elite CreateCreature("HOBSHA01",[559.3701],0) // Hobgoblin Shaman SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #1 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBARC01",[559.3701],0) // Hobgoblin Archer CreateCreature("HOBELITE",[559.3701],0) // Hobgoblin Elite CreateCreature("HOBWIZ01",[559.3701],0) // Hobgoblin Wizard - Hobgoblin Wizard SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #1 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBARC01",[559.3701],0) // Hobgoblin Archer CreateCreature("HOBELITE",[559.3701],0) // Hobgoblin Elite CreateCreature("HOBELITE",[559.3701],0) // Hobgoblin Elite CreateCreature("SHOBSL01",[559.3701],0) // Hobgoblin Slayer SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #1 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBARC01",[559.3701],0) // Hobgoblin Archer CreateCreature("HOBWIZ01",[559.3701],0) // Hobgoblin Wizard - Hobgoblin Wizard CreateCreature("HOBSHA01",[559.3701],0) // Hobgoblin Shaman SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #1 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBARC01",[559.3701],0) // Hobgoblin Archer CreateCreature("HOBCAP01",[559.3701],0) // Hobgoblin Captain - Hobgoblin Captain CreateCreature("HOBCAP01",[559.3701],0) // Hobgoblin Captain - Hobgoblin Captain SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #1 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBARC01",[559.3701],0) // Hobgoblin Archer CreateCreature("HOBARC01",[559.3701],0) // Hobgoblin Archer CreateCreature("HOBCAP01",[559.3701],0) // Hobgoblin Captain - Hobgoblin Captain CreateCreature("HOBCAP01",[559.3701],0) // Hobgoblin Captain - Hobgoblin Captain SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #1 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBARC01",[559.3701],0) // Hobgoblin Archer CreateCreature("HOBCAP01",[559.3701],0) // Hobgoblin Captain - Hobgoblin Captain CreateCreature("HOBCAP01",[559.3701],0) // Hobgoblin Captain - Hobgoblin Captain SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #1 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("HOBWAR01",[559.3701],0) // Hobgoblin Warrior CreateCreature("HOBSHA01",[559.3701],0) // Hobgoblin Shaman CreateCreature("HOBCAP01",[559.3701],0) // Hobgoblin Captain - Hobgoblin Captain SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #5 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("DOGWA",[559.3701],0) // War Dog CreateCreature("DOGWA",[559.3701],0) // War Dog CreateCreature("DOGWA",[559.3701],0) // War Dog SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #5 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("DOGWA",[559.3701],0) // War Dog CreateCreature("DOGWA",[559.3701],0) // War Dog CreateCreature("DOGWA",[559.3701],0) // War Dog CreateCreature("DOGWA",[559.3701],0) // War Dog SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #5 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("DOGWA",[559.3701],0) // War Dog CreateCreature("DOGWA",[559.3701],0) // War Dog CreateCreature("DOGWA",[559.3701],0) // War Dog SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) RESPONSE #5 SetGlobal("SpawnReset5593701","BH1400",1) CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("BANDIT",[559.3701],0) // Bandit CreateCreature("DOGWA",[559.3701],0) // War Dog CreateCreature("DOGWA",[559.3701],0) // War Dog CreateCreature("DOGWA",[559.3701],0) // War Dog CreateCreature("DOGWA",[559.3701],0) // War Dog SetGlobalTimer("14005593701","BH1400",EIGHT_HOURS) END Link to comment
erebusant Posted April 3, 2010 Author Share Posted April 3, 2010 Well, using the combination of Notepad ++ and Miloch's at turns this endeavor into a manageable task. I use Notepad ++ to eliminate every line that does not have a CreateCreature in it, and then only need to scroll through the list of and note the ones without an _ in front of their names. Then it's a simple matter of cross-checking them against Miloch's outputed lists and use replace in notepad if the comparable CRE is available in Tutu, and if it isn't (ie; GNLCAP01) then copy that CRE into the game during the Bonehill Tutu install. Link to comment
Miloch Posted April 3, 2010 Share Posted April 3, 2010 This is easy enough to automate too. Install this to your Tutu game, put all your bafs in the bafcheck/bafs folder, run setup-bafcheck.exe and *BOOM*! Mission accomplished. All your new bafs are in the newbafs folder (funnily enough) and you'll get a log of any missing CREs to baf_log.txt. For your test script, that looks something like this: Script Creature Exists? bhtest _worg Y bhtest wolf01 Y bhtest _wolfdi Y bhtest _bearbl Y bhtest _wolfwe Y bhtest hobwar01 Y bhtest hobarc01 Y bhtest _obelite Y bhtest hobcap01 Y bhtest hobsha01 Y bhtest hobwiz01 Y bhtest shobsl01 N bhtest _bandit Y bhtest _dogwa Y You'll notice it's added the Tutu underscore where it could, otherwise it's substituted the BG2 resource, all of which exist in Tutu. For this reason, you'll probably see very few nonexistent CREs. There is only one above (shobsl01) which might be a BH CRE (in which case just run this with BH installed). Code for those who are interested: <<<<<<<< ...bafcheck-inlined/baf_log.txt Script Creature Exists? >>>>>>>> COPY ~.../bafcheck-inlined/baf_log.txt~ ~bafcheck~ ACTION_BASH_FOR ~bafcheck/bafs~ ~^.+\.baf$~ BEGIN //Get each BAF in the bafs folder COPY ~%BASH_FOR_FILESPEC%~ ~bafcheck/newbafs/%BASH_FOR_FILE%~ //Copy to newbafs folder SPRINT sf ~%BASH_FOR_RES%~ //Store script filename TO_LOWER sf //Lowercase it REPLACE_EVALUATE ~CreateCreature("\(.+\)"~ BEGIN //Scan all spawned creatures SPRINT t-cre ~%MATCH1%~ //Store in a variable TO_LOWER t-cre //Lowercase it ln = STRING_LENGTH ~%t-cre%~ //Count the number of characters PATCH_IF ln > 7 BEGIN //If it's 8 characters INNER_PATCH ~%t-cre%~ BEGIN READ_ASCII 1 t-crn (ln - 1) //Trim leftmost character END SPRINT t-crn ~_%t-crn%~ //Prefix with an underscore END ELSE BEGIN //If under 8 characters SPRINT t-crn ~_%t-cre%~ //Prefix with an underscore END PATCH_IF FILE_EXISTS_IN_GAME ~%t-crn%.cre~ BEGIN //If such a Tutu CRE exists SPRINT t-cre ~%t-crn%~ //Make it the creature spawned END PATCH_IF NOT FILE_EXISTS_IN_GAME ~%t-cre%.cre~ BEGIN //If the actual CRE doesn't exist SPRINT t-yn ~N~ END ELSE BEGIN SPRINT t-yn ~Y~ END PATCH_IF NOT FILE_CONTAINS_EVALUATED(~bafcheck/baf_log.txt~ ~%sf% %t-cre%~) BEGIN INNER_ACTION BEGIN APPEND_OUTER ~bafcheck/baf_log.txt~ ~%sf% %t-cre% %t-yn%~ END END END ~CreateCreature("%t-cre%"~ BUT_ONLY END Link to comment
erebusant Posted April 4, 2010 Author Share Posted April 4, 2010 Perfect! It ran all 58 scripts in 21 minutes and came up with 7 CRE's that needed to be copied into the game for a Tutu install. Just a few more verifications and updates and Bonehill v275 will be ready for release. Link to comment
cmorgan Posted April 4, 2010 Share Posted April 4, 2010 I have just got to get a computer programming class this summer... way cool, Miloch! Link to comment
Miloch Posted April 5, 2010 Share Posted April 5, 2010 I have just got to get a computer programming class this summer...I don't think I've ever taken one... not since learning some crude form of Basic in middle school anyway . Maybe formal logic helped though - a lot of programming just comes down to IF this THEN that, IF NOT this THEN that, etc. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.