gooser Posted January 21, 2014 Posted January 21, 2014 Please direct me to a more appropriate forum if you can think of one. I'm an experienced developer trying to understand Papyrus and SL scripting. A few questions: 1. Is there a way to test scripts without having to launch Skyrim? 2. (Related to #1) Has anyone built a framework (presumably using Skse pluging API) to test scripts in a "unit testing" context? 3. Why is there no equivalent to printf() (c# Writeline, etc) in Papyrus and/or SKSE? 4. How do I manage list of strings that have replaceable tokens (e.g. similar to iOS/OSX .plist, or .Net .resx files)? Thanks!!
Ark of Truth Posted January 21, 2014 Posted January 21, 2014 1. As far as I know, No. Even if you could you would need to be in Skyrim in order to have SexLab and SKSE loaded to test with.
gooser Posted January 21, 2014 Author Posted January 21, 2014 I know I'm probably scratching the bottom of the barrel.... BUT it seems technically feasible to create a mock Papyrus runtime using the SKSE plugin. You would have to mock up the objects that get attached to, etc.
Someone92 Posted January 21, 2014 Posted January 21, 2014 3. http://www.creationkit.com/Notification_-_Debug - Displays a string on the screen http://www.creationkit.com/OpenUserLog_-_Debug - Writes a string to the papyrus log http://www.creationkit.com/Trace_-_Debug - Opens a custum-made log to write into There's also a way to write into the console but no idea how.
WaxenFigure Posted January 22, 2014 Posted January 22, 2014 Please direct me to a more appropriate forum if you can think of one. I'm an experienced developer trying to understand Papyrus and SL scripting. A few questions: 1. Is there a way to test scripts without having to launch Skyrim? 2. (Related to #1) Has anyone built a framework (presumably using Skse pluging API) to test scripts in a "unit testing" context? 3. Why is there no equivalent to printf() (c# Writeline, etc) in Papyrus and/or SKSE? 4. How do I manage list of strings that have replaceable tokens (e.g. similar to iOS/OSX .plist, or .Net .resx files)? Thanks!! 1. No. 2. No. 3. Bethesda didn't put much effort into Papyrus beyond making it work, it has no optimizations whatsoever. 4. The ability provided by the MCM Menus to have mod specific translation files also allows you some ability to have points in the strings where variables are inserted. That doesn't work with the Debug.Notification and Debug.Trace functions though. You can find some examples of how to use that in the Sanguines Debauchery code. Its should also work with strings stored in files and read in through the Papyrus Utility mod though since the string replacement is done at the output point and not when the string is read from the file. Also the Papyrus Utility is where you''l find a function to write to the console.
gooser Posted January 22, 2014 Author Posted January 22, 2014 #3 Surprised that the SKSE folks didn't add it. They added StringUtil didn't they (http://www.creationkit.com/StringUtil_Script) ? Why not a simple string formatting method? #4 Your talking about the $something literals correct?
WaxenFigure Posted January 22, 2014 Posted January 22, 2014 #3 Surprised that the SKSE folks didn't add it. They added StringUtil didn't they (http://www.creationkit.com/StringUtil_Script) ? Why not a simple string formatting method? #4 Your talking about the $something literals correct? Example from SD: string Function unitsToRealWorld( Float afUnits, Bool abMetric = False ) If ( abMetric ) Float fMeters = (afUnits * 0.9144)/ 64.0 Float fFmeters = Math.Floor( fMeters ) as Int Float fCmeters = Math.Ceiling( fMeters ) as Int If ( fFmeters == fCmeters ) Return "$SD_CONCAT_EXACTLY{" + fCmeters + "}METERS" Else Return "$SD_CONCAT_BETWEEN{" + fFmeters + "}AND{" + fCmeters + "}METERS" EndIf Else Float fYards = afUnits / 64.0 Float fFyards = Math.Floor( fYards ) as Int Float fCyards = Math.Ceiling( fYards ) as Int If ( fFyards == fCyards ) Return "$SD_CONCAT_EXACTLY{" + fCyards + "}YARDS" Else Return "$SD_CONCAT_BETWEEN{" + fFyards + "}AND{" + fCyards + "}YARDS" EndIf EndIf EndFunction Those return statements correspond to these lines from the English translation file: $SD_CONCAT_EXACTLY{}YARDS Exactly {} yards. $SD_CONCAT_BETWEEN{}AND{}YARDS Between {} and {} yards. $SD_CONCAT_EXACTLY{}METERS Exactly {} meters. $SD_CONCAT_BETWEEN{}AND{}METERS Between {} and {} meters.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.