Jump to content

Recommended Posts

File Name: Papyrus Utilities

File Submitter: jbezorg

File Submitted: 15 Sep 2013

File Category: Modders Resources

 



This is just a simple script to manipulate Papyrus error logging.

This is the script.

Scriptname Papyrus Hidden; silence the Papyrus log =====================================================bool[] function getDebugLogState() global	bool[] bDebugState = new bool[3]	bDebugState[0] = Utility.GetINIBool("bLoadDebugInformation:Papyrus")	bDebugState[1] = Utility.GetINIBool("bEnableTrace:Papyrus")	bDebugState[2] = Utility.GetINIBool("bEnableLogging:Papyrus")	return bDebugStateendFunctionbool[] function getDebugLogSilent() global	bool[] bDebugState = new bool[3]	bDebugState[0] = false	bDebugState[1] = false	bDebugState[2] = false	return bDebugStateendFunctionfunction setDebugLogState( bool[] bDebugState ) global	Utility.SetINIBool("bLoadDebugInformation:Papyrus", bDebugState[0])	Utility.SetINIBool("bEnableTrace:Papyrus", bDebugState[1])	Utility.SetINIBool("bEnableLogging:Papyrus", bDebugState[2])endFunction


In the following example function the animation var "FNISflags" has not been defined.

; call FNIS.GetFlag( ([mymod] as FNIS ).ISBETA )Bool function GetFlag( int aiFlag ) global	bool ret = Math.LogicalAnd(Game.GetPlayer().GetAnimationVariableInt("FNISflags"), aiFlag) as Bool	return retendFunction


This will generate an error in the Papryus Log. e.g.:

[09/14/2013 - 10:34:37PM] Error:  (00000014): cannot fetch variable named FNISflags of type int, returning 0.stack:	[ (00000014)].Actor.GetAnimationVariableInt() - "<native>" Line ?	<unknown self>.fnis.GetFlag() - "FNIS.psc" Line 59	[zzEstrusChaurusMCM (9200EF8A)].zzestruschaurusmcmscript.registerMyAnimation() - "zzEstrusChaurusMCMScript.psc" Line 30	[zzEstrusChaurusMCM (9200EF8A)].zzestruschaurusmcmscript.OnVersionUpdate() - "zzEstrusChaurusMCMScript.psc" Line 145	[zzEstrusChaurusMCM (9200EF8A)].zzestruschaurusmcmscript.CheckVersion() - "SKI_QuestBase.psc" Line 17	[zzEstrusChaurusMCM (9200EF8A)].zzestruschaurusmcmscript.OnGameReload() - "SKI_ConfigBase.psc" Line 119	[alias Player on quest zzEstrusChaurusMCM (9200EF8A)].SKI_PlayerLoadGameAlias.OnPlayerLoadGame() - "SKI_PlayerLoadGameAlias.psc" Line 6


If you as a modder do not care about this noise in the Logs because a failure is sometimes expected you can silence Papryus error logging with these utilities. e.g.

; call FNIS.GetFlag( ([mymod] as FNIS ).ISBETA )Bool function GetFlag( int aiFlag, bool abFailSilent = true ) global	bool[] bDebugOff   = Papyrus.getDebugLogSilent()	bool[] bDebugState = Papyrus.getDebugLogState()	if abFailSilent		Papyrus.setDebugLogState( bDebugOff )	endIf	bool ret = Math.LogicalAnd(Game.GetPlayer().GetAnimationVariableInt("FNISflags"), aiFlag) as Bool	if abFailSilent		Papyrus.setDebugLogState( bDebugState )	endIf		return retendFunction

 



download.png
Click here to download this file

Link to comment
  • 7 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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