<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://4dimensions.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Scripting%3ADebugger</id>
		<title>Scripting:Debugger - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://4dimensions.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Scripting%3ADebugger"/>
		<link rel="alternate" type="text/html" href="http://4dimensions.org/wiki/index.php?title=Scripting:Debugger&amp;action=history"/>
		<updated>2026-04-08T13:57:47Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.27.7</generator>

	<entry>
		<id>http://4dimensions.org/wiki/index.php?title=Scripting:Debugger&amp;diff=1006&amp;oldid=prev</id>
		<title>Rynald: Created page with &quot;The script debugger can be used to figure out what's happening in a trigger. This is easier than putting in echos and having to remove them afterwards.  The main command is ''...&quot;</title>
		<link rel="alternate" type="text/html" href="http://4dimensions.org/wiki/index.php?title=Scripting:Debugger&amp;diff=1006&amp;oldid=prev"/>
				<updated>2017-03-05T18:47:16Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;The script debugger can be used to figure out what&amp;#039;s happening in a trigger. This is easier than putting in echos and having to remove them afterwards.  The main command is &amp;#039;&amp;#039;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The script debugger can be used to figure out what's happening in a trigger. This is easier than putting in echos and having to remove them afterwards.&lt;br /&gt;
&lt;br /&gt;
The main command is ''dbg'', followed by a number of subcommands. The syntax for each debugging command is given. It uses the | symbol to denote ''or'': you need to choose between what comes before and after. Arguments between [] are optional in some cases. An argument between &amp;lt;&amp;gt; means what's in between should be replaced by something else. All subcommands may be abbreviated down to the first letter.&lt;br /&gt;
&lt;br /&gt;
All debugging messages start with a yellow [DBG]. More than one imm can debug the same trigger, and each imm will see what the other is doing.&lt;br /&gt;
&lt;br /&gt;
It's not possible to directly debug a load trigger since it doesn't exist at first. One way around this is to temporarily change the type of the trigger and debug it.&lt;br /&gt;
&lt;br /&gt;
Debugging a death trigger is special in that when it hits a breakpoint, the mob dies and the trigger is destroyed. This is how it should be, otherwise a wait would postpone a mob's death. In this case you can also change the trigger type to debug it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Start Debugging==&lt;br /&gt;
&lt;br /&gt;
The syntax is &lt;br /&gt;
&lt;br /&gt;
    dbg mob|obj|room [&amp;lt;name&amp;gt;] &amp;lt;trigger vnum&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To start debugging trigger 123 on a cow which is in the room:&lt;br /&gt;
&lt;br /&gt;
    dbg mob cow 123&lt;br /&gt;
&lt;br /&gt;
Debugging trigger 234 on the room:&lt;br /&gt;
&lt;br /&gt;
    dbg room 234&lt;br /&gt;
&lt;br /&gt;
Debugging trigger 177 on a worn or carried object, or when it's in the room:&lt;br /&gt;
&lt;br /&gt;
    dbg obj waybread 177&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Display Info==&lt;br /&gt;
&lt;br /&gt;
The syntax is &lt;br /&gt;
&lt;br /&gt;
    dbg info [&amp;lt;number&amp;gt;] [breakpoints|variables]&lt;br /&gt;
&lt;br /&gt;
To get the debugging list:&lt;br /&gt;
&lt;br /&gt;
    dbg info&lt;br /&gt;
&lt;br /&gt;
It shows all triggers being debugged, if they're running, the breakpoints, and local and global variables.&lt;br /&gt;
If there's more than one trigger you only get the trigger names. In that case doing&lt;br /&gt;
&lt;br /&gt;
    dbg info &amp;lt;number&amp;gt;&lt;br /&gt;
&lt;br /&gt;
shows the detailed info for that trigger.&lt;br /&gt;
&lt;br /&gt;
If you're only interested in the breakpoints you can do&lt;br /&gt;
&lt;br /&gt;
    dbg info [&amp;lt;number&amp;gt;] breakpoints&lt;br /&gt;
&lt;br /&gt;
and to only see the variables:&lt;br /&gt;
&lt;br /&gt;
    dbg info [&amp;lt;number&amp;gt;] variables&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Trigger List==&lt;br /&gt;
&lt;br /&gt;
The syntax is&lt;br /&gt;
&lt;br /&gt;
    dbg list [&amp;lt;number&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
It shows the trigger with line numbers, so you know where to set a breakpoint.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setting Breakpoints and Variables==&lt;br /&gt;
&lt;br /&gt;
The syntax for setting a breakpoint is&lt;br /&gt;
&lt;br /&gt;
    dbg set [&amp;lt;number&amp;gt;] breakpoint &amp;lt;line number&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a trigger reaches a breakpoint it stops running. This is because a breakpoint is a long wait inserted before the line where it needs to break. This gives you time to see the current state and go from there.&lt;br /&gt;
&lt;br /&gt;
    dbg set 2 breakpoint 34&lt;br /&gt;
&lt;br /&gt;
sets a breakpoint at line 34 in debugged trigger 2. Giving the same command removes the breakpoint.&lt;br /&gt;
&lt;br /&gt;
The syntax for setting a variable is&lt;br /&gt;
&lt;br /&gt;
    dbg set [&amp;lt;number&amp;gt;] variable &amp;lt;var&amp;gt; &amp;lt;args&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can only change existing variables:&lt;br /&gt;
&lt;br /&gt;
    dbg set variable var A new value&lt;br /&gt;
&lt;br /&gt;
sets global or local variable ''var'' to ''A new value''.&lt;br /&gt;
&lt;br /&gt;
In this way variables don't have to be changed in the trigger itself when testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Printing expressions==&lt;br /&gt;
&lt;br /&gt;
The syntax is&lt;br /&gt;
&lt;br /&gt;
    dbg print &amp;lt;expression&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This prints the result of any scripting expression between the %% symbols.&lt;br /&gt;
If you want to know the value of the local variable %x% you can look it up in dbg info, or do&lt;br /&gt;
&lt;br /&gt;
    dbg print %x%&lt;br /&gt;
&lt;br /&gt;
It can also be used to see the result of an expression not related to the trigger:&lt;br /&gt;
&lt;br /&gt;
    dbg print %now%&lt;br /&gt;
    dbg print %time.moon%&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Flow Control==&lt;br /&gt;
&lt;br /&gt;
The syntax for continuing a trigger is&lt;br /&gt;
&lt;br /&gt;
    dbg continue [&amp;lt;number&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
When a trigger is at a breakpoint, this resumes a trigger. Because a breakpoint is a wait, continue can also be used to skip long waits in the trigger.&lt;br /&gt;
&lt;br /&gt;
The syntax for stepping through a trigger is&lt;br /&gt;
&lt;br /&gt;
    dbg next [&amp;lt;number&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
Next executes only the current line and breaks in the next. It's a quick way of going through a trigger line by line without having to set and remove breakpoints.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Stop Debugging==&lt;br /&gt;
&lt;br /&gt;
The syntax is&lt;br /&gt;
&lt;br /&gt;
    dbg delete [&amp;lt;number&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
The trigger is resumed if it was at a breakpoint and you were the only one debugging the trigger. Delete also happens when you logout.&lt;/div&gt;</summary>
		<author><name>Rynald</name></author>	</entry>

	</feed>