Difference between revisions of "Debug"

From Scriptwiki
Jump to: navigation, search
m (added an example of using custom alias)
m (spelling.)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
/debug [-cinpt] [N] [on|off|@window|filename] [identifier]
+
Outputs raw server messages, both incoming and outgoing, to a debug.log file, or a custom @window.<br />
Outputs raw server messages, both incoming and outgoing, to a debug.log file, or a custom @window.
+
'''$debug''' returns the name of debug file/window.
 +
 
 +
/debug [-cinpt] [N] [on|off|@window|filename] [identifier]
 +
 
 +
'''Note:''' /debug works independently for each server connection.
  
 
== Switches ==
 
== Switches ==
Line 11: Line 15:
 
| -i    || the specified identifier before a debug line is logged. The return value of the identifier is used as the debug line.
 
| -i    || the specified identifier before a debug line is logged. The return value of the identifier is used as the debug line.
 
|-
 
|-
| -n    || opens the custom @window minmized.
+
| -n    || opens the custom @window minimized.
 
|-
 
|-
 
| -p    || turns word wrapping on.
 
| -p    || turns word wrapping on.
Line 18: Line 22:
 
|}
 
|}
  
 
+
== Example on using a custom alias: ==
'''Example on using a custom alias:'''
 
 
  ; we'll make an alias that we will use with /debug -i
 
  ; we'll make an alias that we will use with /debug -i
 
  alias debugoutput {  
 
  alias debugoutput {  
 
   
 
   
   ; the debug line is actually $1, so we'll now tokenize it, so we can use $1 $1- etc.
+
   ; the debug line is actually $1, so we'll now tokenize it, so we can use [[$1-|$1]] [[$1-]] etc.
   tokenize 32 $1  
+
   [[tokenize]] 32 [[$1-|$1]]
 
   
 
   
  ; add a line into the debug window, $debug will return the name of the debug window that you created
+
   ; this will just replace those arrows <- and -> (which is $1 after the tokenize) with colored ones
   ; this will just replace those arrows <- and -> (which is $1 after the tokenize) with colored ones, -p in aline to wrap the text
+
   [[return]] [[$replace]]($1, [[$&]]
   aline -p $debug $timestamp $replace($1, $&
+
     <-, [[DollarPlus|$+]]([[$chr]](3),10,<-,[[$chr]](3)), [[$&]]
     <-, $+($chr(3),10,<-,$chr(3)), $&
+
     ->, [[DollarPlus|$+]]([[$chr]](3),04,->,[[$chr]](3)) [[$&]]
     ->, $+($chr(3),04,->,$chr(3)) $&
+
   ) [[$1-|$2-]]
   ) $2-  
 
 
  }
 
  }
 
   
 
   
 
  ; now just open the debug window with /debug -i @debug debugoutput
 
  ; now just open the debug window with /debug -i @debug debugoutput
{{stub}}
+
 
 +
[[Category:Commands]]

Latest revision as of 16:50, 13 December 2012

Outputs raw server messages, both incoming and outgoing, to a debug.log file, or a custom @window.
$debug returns the name of debug file/window.

/debug [-cinpt] [N] [on|off|@window|filename] [identifier]

Note: /debug works independently for each server connection.

Switches

Switch Meaning
-c turns off debugging and closes the associated custom @window
-i the specified identifier before a debug line is logged. The return value of the identifier is used as the debug line.
-n opens the custom @window minimized.
-p turns word wrapping on.
-t turns timestamping on.

Example on using a custom alias:

; we'll make an alias that we will use with /debug -i
alias debugoutput { 

  ; the debug line is actually $1, so we'll now tokenize it, so we can use $1 $1- etc.
  tokenize 32 $1 

  ; this will just replace those arrows <- and -> (which is $1 after the tokenize) with colored ones
  return $replace($1, $&
    <-, $+($chr(3),10,<-,$chr(3)), $&
    ->, $+($chr(3),04,->,$chr(3)) $&
  ) $2- 
}

; now just open the debug window with /debug -i @debug debugoutput