Fragment management

Post » Thu Jun 21, 2012 7:45 am

As a scripter, my preference is to write scripts directly, rather than use fragments, because I find it quicker, clearer and easier to control.

By trial-and-error, I've come up with this:
  • In the CK, first add any information that will autogenerate code (e.g. quest aliases).
  • Make dummy fragments for every case (e.g. all quest stages) by entering comments in the fragment windows.
  • Rename the script to a more sensible convention.
  • Close the form to generate the outline script.
  • Add content to the script with an external editor.
  • Add custom properties, functions, events etc to the end of the script.
  • Use the CK to assign the script properties.
  • Use the external editor to make changes to the end of the script only.
  • Update the fragments in the CK windows only.
  • Back up the script before doing something that could regenerate it (e.g. adding a quest alias)
EDIT 21-Apr-2012 : regenerating the script in the CK usually conserves custom code at the end. Points 9 & 10 reworded.
EDIT 22-Apr-2012: editing fragments externally seems to be unreliable.

I've seen one or two posts proposing something similar, with variations.

My outstanding issue is that fragments can be generated in an arbitrary order. For example, in a quest script, stages may be in the order 40, 10, 30, 20. Obviously, that's hard to read and prone to error.

Is there any way to directly edit the fragment numbers used by the CK?
User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Wed Jun 20, 2012 7:58 pm

I would imagine its held in the quest's subrecord blob for script attachments (The VMAD subrecord that tells what properties link to what, and what scripts to use) not the easiest thing to manually edit.

Often times I'd prefer most of my fragments use the same script with variables using properties instead so I don't have to package like 500 script fragments for a bunch of scripted dialogue. I could definitely do it but it would be a pain in the butt if I ever had to edit any of them.
User avatar
Mistress trades Melissa
 
Posts: 3464
Joined: Mon Jun 19, 2006 9:28 pm

Post » Thu Jun 21, 2012 8:47 am

I would imagine its held in the quest's subrecord blob for script attachments...
Thanks. Which tool would you use to edit that?
User avatar
zoe
 
Posts: 3298
Joined: Sun Nov 12, 2006 1:09 pm

Post » Wed Jun 20, 2012 9:35 pm

Thanks. Which tool would you use to edit that?

TESVEdit, and then open the http://www.uesp.net/wiki/Tes5Mod:Mod_File_Format/VMAD_Field with the HEX button.

It may be easier to enter the stage numbers in part #2 of the OP.
I wasn't aware that stuff written at the very end of the script could be overwritten. I thought all code entered after the last auto-generated comment was safe.

I
User avatar
Jerry Cox
 
Posts: 3409
Joined: Wed Oct 10, 2007 1:21 pm

Post » Thu Jun 21, 2012 1:22 am

...I wasn't aware that stuff written at the very end of the script could be overwritten. I thought all code entered after the last auto-generated comment was safe.
You may well be right.

The generated code says "Do not edit anything between this and the end comment".

That strikes me as misleading. Code added before that block seems to be overwritten.

As you imply, It seems that code at the end is conserved. Papyrus even allows retrospective declarations there, unlike many languages.

However, you can understand that, having lost code, I'm now cautious, so I take a backup first.

EDIT : Evidently, the CK doesn't always reload the script after an external edit. So, it's dangerous to edit the fragments externally. Sadly, that implies that fragments have to be edited in the CK, while common code has to be managed externally at the end of the script :confused:
User avatar
Kayla Oatney
 
Posts: 3472
Joined: Sat Jan 20, 2007 9:02 pm


Return to V - Skyrim