Jump to content

Testing Papyrus scripts without Skyrim?


Recommended Posts

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!!

Link to comment

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.

Link to comment

#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.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use