ScriptError

From HEWIKI
Jump to: navigation, search

ScriptError(<message>)

Arguments

<message> 
Of type string, this is the message that will be generated when this function forces an error.

Description

This is a built-in function, available to both client and server, that can force a script to stop running and generate an error message at a particular point in the script.

Note: How the user sees the script error will depend on what server or client the HeroScript is executing.

For another way of forcing an error message, please see the ASSERT command.

Examples

(please note that the script error messaging is in flux as of this writing, and may look different from what is seen here)

i as integer
i = 2
if ( i != 0 ) 
  ScriptError("You have set i to the wrong value.")
.
 
> SCRIPT ERROR in script DoStuff, line #48.  Message: "You have set i to the wrong value."


Another way of causing a script error is by asserting a false statement with the ASSERT command:

name as string
name = "Bob"
assert ( name == "Fred", "Problem:  The name isn't Fred anymore." )    
 
> SCRIPT ERROR in script NameCheck, line #32.  Message: "Problem: The name isn't Fred anymore."
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox