Pananacakes Posted July 3, 2016 Share Posted July 3, 2016 What are script fragments for? What can they do for me that a normal script can't? Why would I want to use them? I don't quite get them. Link to comment Share on other sites More sharing options...
cdcooley Posted July 3, 2016 Share Posted July 3, 2016 They are just the small bits of code attached to dialogue entries, quest stages, perk entry points, etc. Physically all of the fragments for a single quest live in a single script but each fragment function is presented for editing independently by the CK. The topic info fragments are all set up as a single function per file because the dialogue entries each have their own unique formids. Link to comment Share on other sites More sharing options...
RetroDaddy Posted December 31, 2020 Share Posted December 31, 2020 Is it possible to use a "Script Fragment" outside of a quest?I have about 340 small scripts I'd like to combine into one, and then use fragments of that one in books with no actual quest involved. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 31, 2020 Share Posted December 31, 2020 Is it possible to use a "Script Fragment" outside of a quest?I have about 340 small scripts I'd like to combine into one, and then use fragments of that one in books with no actual quest involved.You can have a central script that houses functions and properties and link to it from other scripts and be able to call those functions and properties as needed. But you shouldn't combine the script fragments used in dialogue, quest stages, perks, etc into a single massive script. Those are designed to work exactly as they are. However, that doesn't mean you cannot take the code idea from the fragments and put them in functions on one script to be remotely called by other scripts. Link to comment Share on other sites More sharing options...
RichWebster Posted December 31, 2020 Share Posted December 31, 2020 Yes as explained above avoid copying full script fragments (the full source) since the CK creates helper properties in them, depending on the context. If you want to have a "master" script that contains functions and properties you use more than once, to avoid repeating code, it's best to attach your custom script to a custom quest. Let's say you name this script MyMasterScript01, and attach it to the quest. Then if you want to use that script on other objects you can create a script property to it like so: MyMasterScript01 Property MasterScript Auto The fill in the property and select the quest it's attached to. If it has a function like Some function(), then you call it in your other script like: MasterScript.SomeFunction() Link to comment Share on other sites More sharing options...
audiogarden21 Posted January 2, 2021 Share Posted January 2, 2021 For clarification; MyMasterScript01 Property MasterScript Auto <--- goes in as a property of any script that requires the functions in your master script Refers to the script attached to the quest. Refers to the quest the script is attached to. You'll have to fill the property with the master quest the script is attached to so that the script using the functions knows which one to look at, otherwise you'll get compile errors saying the function doesn't exist. Link to comment Share on other sites More sharing options...
Recommended Posts