subtledoctor Posted February 27, 2021 Share Posted February 27, 2021 I have an invisicreature .BCS script that looks like: IF True(A) THEN RESPONSE #100 [ACTION 1] Continue() END IF True(B) THEN RESPONSE #100 [ACTION 2] Continue() END IF True() THEN RESPONSE #100 DesrtoySelf() END Now, say I come along later and I want to add more conditions to the script. My new condition is in a .BAF file like: IF True(C) THEN RESPONSE #100 [ACTION 3] Continue() END Seems like the way to fold this into the existing script is: COMPILE ~mymod/scripts/nuscript.baf~ EXTEND_TOP ~override/script.bcs~ ~override/nuscript.bcs~ My only issue is, this needlessly pollutes the override folder with nuscript.bcs, which has no purpose other than to be prepended to script.bcs. I would prefer to DECOMPILE_AND_PATCH and simply inject the text... but there is no APPEND_TOP command for adding text to the beginning of a file. Is there a better way to do this? Quote Link to comment
Jarno Mikkola Posted February 27, 2021 Share Posted February 27, 2021 (edited) You can insert the .baf text as a inlined action... like so in the weidu-readme: BEGIN ~MyMod Component 1~ <<<<<<<< .../mymod-inlined/myfile.baf IF True() THEN RESPONSE #100 Kill("Anomen") END >>>>>>>> COMPILE ~.../mymod-inlined/myfile.baf~ Easy. Edited February 27, 2021 by Jarno Mikkola Quote Link to comment
kjeron Posted February 27, 2021 Share Posted February 27, 2021 COPY - ~mymod/scripts/nuscript.baf~ override SET length = SOURCE_SIZE READ_ASCII 0 nuscript (length) COPY_EXISTING ~script.bcs~ override DECOMPILE_AND_PATCH BEGIN INSERT_BYTES 0 length WRITE_ASCIIE 0 ~%nuscript%~ (length) EVALUATE_BUFFER // if you have any variables in nuscript.baf END BUT_ONLY Quote Link to comment
argent77 Posted February 27, 2021 Share Posted February 27, 2021 A single call of EXTEND_TOP ~script.bcs~ ~mymod/scripts/nuscript.baf~ EVAL should be enough. EXTEND_[TOP|BOTTOM] automatically fetches the game script from BIFF or override (and even creates a new SCRIPT.BCS if it doesn't exist yet), compiles the .BAF and extends the game script. EVAL can be omitted if you don't need to evaluate variables in the .BAF. Quote Link to comment
Recommended Posts
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.