the "»" symbol within DM tags represents an indentation.
Dream Maker Error Code Listing
Listed below are the error codes from Dream Maker, if you see someone asking a question in the forum or elsewhere for an error, post the fix you gave here under the error code itself. Over time it is my hope that people can be referenced here to just look up error codes they get in Dream Maker, by Error code, and find a solution to their problem.
error: expected a constant expression
Problem: Trying to assign a variable with a random result at compile-time
Example: mob/var/hitpoints = roll("2d4")
Fix: It's not a constant value that can be calculated at compile-time. Hence the error. To fix the problem, you need to set the variable at run-time; the easiest way to do this is inside the New() proc (which belongs to all objects in the DM programming language)
mob |
This is also a common mistake with strings. You can't use brackets to include another value at compile-time, like so
mob/icon_state = "[class]" |
error: [variable name] :duplicate definition
Problem: Declared the same variable twice.
Example:
mob/var/a |
Fix:
mob/var/a2 |
error:: Inconsistent indentation.
Problem: Failing to correctly indent a line where it is an obvious error.
Example 1:
mob |
Example 2: [note: In this case, _ represents a space ( )
mob |
Fix: Go over the block of code that the error leads to. Try scanning upward from there. On every line, delete all of the tabs and spaces and re-indent it to its proper level -- make sure you understand what proper indentation is, though! The above example should look like
mob |
Dream Maker allows you to use either tabs or spaces for indentation. The only requirement is that you be consistent for any given block of code. If you prefer to use 3 spaces instead of tabs, DM will let you, but you can't mix and match them within any already indented block of code. Use Ctrl+T in the editor to make tabs and spaces visible, which will make it easier to spot stray spaces in your code.
error: [variable name] :invalid variable name: reserved word
Problem: Your trying to name a variable the same as one of BYOND's reserved words.
Example:
mob/var/if |
Fix: Just change the name of the variable, if you really like the name you can just put an underscore in front of it
mob/var/_if
|
error:: missing comma ',' or right parenthesis ')'
Problem: One line of code is missing one of the two above symbols. Also note that the line the error message is reported on is usually the line following the error, not the line the error appears on!
Example:
mob |
Fix: Locate the line above the line that the error is reported on, and count each parenthesis. For every left parenthesis "(", mentally increase a number by one. For every right parenthesis ")", mentally decrease that number by one. By the time you reach the end of the line, your number should be zero. If not, you'll have to figure out where you need to put the parenthesis
» New() |
error: No such node: mob/var/[number]
Problem: You have a variable that's name starts with a number.
Example:
mob/var/1_Piece_Of_Pie
|
Fix: Make sure the number isn't the first character of the variable name
mob/var/_1_Piece_Of_Pie
|
error: proc definition not allowed inside another proc
Problem: A proc or verb has been defined inside another proc or verb. The line the error message is reported on is usually a line below the real error for this one as well.
Example:
mob/verb |
Fix: This one should be obvious once you get the error, just un-indent the proc or verb to the correct spot
mob/verb |
This is often caused by an indentation error as well. If the indentation looks correct like the second part of this example, then there's probably a mix of tabs and spaces in the indentation. Press Ctrl+T in the editor to see them.
error: Undefined variable
Problem: Most often, this happens when you didn't tell DM that the var you were using should be a certain type.
Fix: Change the var's type, or create a new var with the type you want to use.
Example:
mob |
Here M is never defined as a /mob type. The "as mob" clause only limits Dream Seeker to choosing mobs, but Dream Maker doesn't automatically expect M to be a /mob. The solution is to define M as mob/M. Although you can use the : operator to get out of this, it's sloppy. You should use a technique called type casting to avoid the problem.
Example:
mob/player/var/kills = 0 |
If you try to change usr.kills directly here, you'll get the error because usr is always a /mob type as far as Dream Maker is concerned. usr's actual type may really be /mob/player, but since DM doesn't know that in advance, it assumes usr is a generic mob. ++usr:kills would have worked, but ++M.kills is a much cleaner solution.
error: compile failed (possible infinite cross-reference loop)
Problem: Usually this happens because you're using a var the same place you first define it.
Fix: Define the var first, then change it.
Example:
var/thing = "This is a [thing]." |
That line is prefectly legal without the var/ part, if thing is defined somewhere else.
var/thing = "duck" |
Dream Maker Warning Code Listing
Listed below are the warnings from Dream Maker, if you see someone asking a question in the forum or elsewhere for an error, post the fix you gave here under the error code itself. Over time it is my hope that people can be referenced here to just look up warnings they get in Dream Maker and find a solution to their problem.
Warning: empty switch statement
Problem: The choices of the switch statement has not been correctly indented.
Example:
mob/proc/gender() |
Fix: Indent the choices in
mob/proc/gender() |
[variable] :warning: variable defined but not used
Problem: The variable shown is not being used (does not matter if it was defined).
Example:
mob/proc/gender() |
Note that name is defined but nothing is done with it.
Fix: Use OR delete the variable.
mob/proc/gender() |
Note: This opening post is just a copy and paste from the dead BYOND Bwicki; information has been recovered via the Wayback machine. Feel free to add your own entries for errors/warnings, and how to fix them, in the form of a new post. BYOND moderators, feel welcome to fix any errors in (or add anything to) this post.