Debug Messaging
Revision as of 17:24, 14 May 2010 by imported>Shademe (New user function.)
A User Function for use with Oblivion Script Extender
Syntax:
DebugMsg expression:string outputType:int
Provides a centralized method to post debug output as either a console message, an onscreen message or a messagebox. Additionally, it dumps output to a ConScribe log.
Examples:[edit | edit source]
let sValue := 1 call DebugMsg ("sValue = " + $sValue) 1 let stringvarX := "Debug Message 10" + $(sValue + 1) call DebugMsg stringvarX 2
Code[edit | edit source]
scn DebugMsg ; dumps debug messages to a number of output streams string_var svMessage ; debug message short sOutputType ; output type begin function { svMessage sOutputType } if ( isPluginInstalled "ConScribe" ) if ( getPluginVersion "ConScribe" > 6 ) registerLog "ModName - Debug Log" 1 scribe "%z" svMessage endIf endIf if ( sOutputType == 1 ) ; console message print svMessage elseIf ( sOutputType == 2 ) ; message message $svMessage elseIf ( sOutputType == 3 ) ; messagebox messageBox $svMessage endIf end
Notes[edit | edit source]
- The function can be further optimized by moving the ConScribe detection code to a quest script:
scn zzSomeQuestQS float fQuestDelayTime short sConScribeInstalled begin gameMode let fQuestDelayTime := 0.001 if ( getGameLoaded ) let sConScribeInstalled := 0 if ( isPluginInstalled "ConScribe" ) if ( getPluginVersion "ConScribe" > 6 ) registerLog "Vector - Debug Log" 1 let sConScribeInstalled := 1 endIf endIf endIf end
- ...and have the quest variable checked inside the function.
- Debug messaging can be toggled at run time by checking an appropriate quest variable before printing output.
See Also[edit | edit source]