Skip to content

Instantly share code, notes, and snippets.

@oddlittleturtle
Last active February 2, 2023 22:01
Show Gist options
  • Save oddlittleturtle/a41605a0aa2218b0d2a657177bc5cecc to your computer and use it in GitHub Desktop.
Save oddlittleturtle/a41605a0aa2218b0d2a657177bc5cecc to your computer and use it in GitHub Desktop.
Start Me Up Redux for Xbox Debugger Code
Scriptname StartMeUp:SMU_Debugger Hidden DebugOnly
{Creates custom user logs for the purpose of debugging
https://www.creationkit.com/fallout4/index.php?title=Scripting_DebugLogging}
Struct UserLog
string Caller
string FileName
EndStruct
; User Log
;---------------------------------------------
bool Function WriteLine(UserLog Log, var Text) Global
If (Log == none)
Log = new UserLog
Log.Caller = ""
Log.FileName = "User"
ElseIf (StringIsNoneOrEmpty(Log.FileName))
Log.FileName = "User"
EndIf
Text = Log.Caller + " " + Text
If(Debug.TraceUser(Log.FileName, Text))
return true
Else
Debug.OpenUserLog(Log.FileName)
return Debug.TraceUser(Log.FileName, Text)
EndIf
EndFunction
Function WriteChangedValue(UserLog Log, string propertyName, var fromValue, var toValue) Global
WriteLine(Log, "Changing "+propertyName+" from " + fromValue + " to " + toValue)
EndFunction
Function WriteNotification(UserLog Log, var Text) Global
If (WriteLine(Log, Text))
Debug.Notification(Text)
EndIf
EndFunction
Function WriteMessage(UserLog Log, var Text) Global
If (WriteLine(Log, Text))
Debug.MessageBox(Text)
EndIf
EndFunction
Function WriteError(UserLog Log, var Text) Global
If (WriteLine(Log, Text))
Debug.MessageBox("Error\n"+Text)
EndIf
EndFunction
; Text
;---------------------------------------------
bool Function StringIsNoneOrEmpty(string value) Global
return !(value) || value == ""
EndFunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment