Difference between revisions of "Script error"

From Dragon Age Toolset Wiki
Jump to: navigation, search
m (Added "See also" section, reformatted table)
 
Line 1: Line 1:
 
{{Infobox script}}
 
{{Infobox script}}
  
Currently this document covers errors when executing a script at run-time. Compilation errors aren't covered yet.
+
Currently this document covers errors when executing a script at run-time.
  
 
== Errors ==
 
== Errors ==
Line 24: Line 24:
 
*'''Reason: ''' This is a generic message that shows up for all non specific errors. It's kind of misleading as the file might be read fine from disk but otherwise fail to execute.
 
*'''Reason: ''' This is a generic message that shows up for all non specific errors. It's kind of misleading as the file might be read fine from disk but otherwise fail to execute.
 
*'''Solution: '''
 
*'''Solution: '''
 
  
 
==== Failure to Load ====
 
==== Failure to Load ====
Line 41: Line 40:
 
*'''Reason: ''' The stack got corrupted by pushing too many parameters from the engine.
 
*'''Reason: ''' The stack got corrupted by pushing too many parameters from the engine.
 
*'''Solution: ''' The declaration for the command in script.ldf and its implementation in the virtual machine may not match; check if you've got incompatible versions of script.ldf and the executable file. Update script.ldf locally (by copying into /packages/core/override and restarting the toolset) and reexport all scripts.
 
*'''Solution: ''' The declaration for the command in script.ldf and its implementation in the virtual machine may not match; check if you've got incompatible versions of script.ldf and the executable file. Update script.ldf locally (by copying into /packages/core/override and restarting the toolset) and reexport all scripts.
 
  
 
==== Stack Underflow ====
 
==== Stack Underflow ====
Line 48: Line 46:
 
*'''Reason: ''' The stack got corrupted by not popping of all values of a command from the stack.
 
*'''Reason: ''' The stack got corrupted by not popping of all values of a command from the stack.
 
*'''Solution: ''' The same as for a stack overflow.
 
*'''Solution: ''' The same as for a stack overflow.
 
  
 
==== Stack Error ====
 
==== Stack Error ====
Line 55: Line 52:
 
*'''Reason: ''' See common error codes listed below.  
 
*'''Reason: ''' See common error codes listed below.  
  
{|
+
{|class="wikitable"
 
|-
 
|-
 
! Code || Reason || Solution
 
! Code || Reason || Solution
 
|-
 
|-
|TOO_MANY_INSTRUCTIONS (632) ||The VM has terminated the offending script after executing the maximum number of instructions (131072). This is ALWAYS an error made by the scripter, most likely triggered by an infinite loop. ||Any script that manages to run even closely to the maximum number of allowed instructions is either broken or badly designed and needs to be rewritten with a more efficient design.||
+
| TOO_MANY_INSTRUCTIONS (632)
 +
| The VM has terminated the offending script after executing the maximum number of instructions (131072). This is ALWAYS an error made by the scripter, most likely triggered by an infinite loop.  
 +
| Any script that manages to run even closely to the maximum number of allowed instructions is either broken or badly designed and needs to be rewritten with a more efficient design.
 
|-
 
|-
|TOO_MANY_RECURSION_LEVELS (633) ||The VM has terminated the offending script after hitting the maximum recursion level (8). This is always an error made by the scripter, often caused by layered HandleEvent calls ||Ensure the current event is handled earlier in the code and not propagated through a long chain of HandleEvents.||
+
| TOO_MANY_RECURSION_LEVELS (633)
 +
| The VM has terminated the offending script after hitting the maximum recursion level (8). This is always an error made by the scripter, often caused by layered HandleEvent calls  
 +
| Ensure the current event is handled earlier in the code and not propagated through a long chain of HandleEvents.
 
|-
 
|-
|CANNOT_READ_FILE (634) ||Script could not be read, probably because it didn't exist. Export scripts from toolset||
+
| CANNOT_READ_FILE (634)
 +
| Script could not be read, probably because it didn't exist.
 +
| Export scripts from toolset
 
|-
 
|-
|STACK_OVERFLOW (638) ||The VM has terminated the offending script after the stack was corrupted. ||See Stack Overflow above.||
+
| STACK_OVERFLOW (638)
 +
| The VM has terminated the offending script after the stack was corrupted.
 +
| See Stack Overflow above.
 
|-
 
|-
|STACK_UNDERFLOW (639) ||The VM has terminated the offending script after the stack was corrupted. ||See Stack Underflow above.||
+
| STACK_UNDERFLOW (639)
 +
| The VM has terminated the offending script after the stack was corrupted.
 +
| See Stack Underflow above.
 
|-
 
|-
|INVALID_COMMMAND (642) ||The VM encountered a call to a command not known to the executable. Script.ldf was probably updated with a command that is not known to the current executable.|| Get an up to date executable.  ||
+
| INVALID_COMMMAND (642)
 +
| The VM encountered a call to a command not known to the executable. [[Script.ldf]] was probably updated with a command that is not known to the current executable.
 +
| Get an up to date executable.   
 
|-
 
|-
|DIVISION_BY_ZERO (644) ||A script has triggered a division by zero, either directly or inside a command not accepting a 0 parameter (e.g. Random) ||Ensure that the script is properly shielded against parameters becoming 0 (e.g. when read from a 2da). Find the location of the problem by checking the approriate log channels (FW_SCRIPT and FW_SCRIPT_COMMANDS)||
+
| DIVISION_BY_ZERO (644)
 +
| A script has triggered a division by zero, either directly or inside a command not accepting a 0 parameter (e.g. Random)
 +
| Ensure that the script is properly shielded against parameters becoming 0 (e.g. when read from a 2da). Find the location of the problem by checking the appropriate log channels (FW_SCRIPT and FW_SCRIPT_COMMANDS)
 
|}
 
|}
  
 
==== Defines ====  
 
==== Defines ====  
  
<pre>
+
<dascript>
 
#define STRREF_VIRTUALMACHINE_ERROR_TOO_MANY_INSTRUCTIONS          632
 
#define STRREF_VIRTUALMACHINE_ERROR_TOO_MANY_INSTRUCTIONS          632
 
#define STRREF_VIRTUALMACHINE_ERROR_TOO_MANY_LEVELS_OF_RECURSION    633
 
#define STRREF_VIRTUALMACHINE_ERROR_TOO_MANY_LEVELS_OF_RECURSION    633
Line 95: Line 106:
 
#define STRREF_VIRTUALMACHINE_ERROR_UNKNOWN_TYPE_ON_RUN_TIME_STACK  648
 
#define STRREF_VIRTUALMACHINE_ERROR_UNKNOWN_TYPE_ON_RUN_TIME_STACK  648
 
#define STRREF_VIRTUALMACHINE_ERROR_ARRAY_ACCESS_OUT_OF_BOUNDS      649
 
#define STRREF_VIRTUALMACHINE_ERROR_ARRAY_ACCESS_OUT_OF_BOUNDS      649
</pre>
+
</dascript>
  
{{Languages|Script error}}
+
== See also ==
 +
* [[Compiler error message]] for errors encountered during script compilation.
  
 +
{{Languages|Script error}}
 
[[Category:Scripts]]
 
[[Category:Scripts]]
 
[[Category:Error messages]]
 
[[Category:Error messages]]

Latest revision as of 17:31, 25 April 2020

Scripting

Currently this document covers errors when executing a script at run-time.

Errors

There are two general types of errors that can happen:

  • Execution Errors (File missing, etc.)
  • Stack Errors (Overflows, Underflows, Division by 0, etc.)

Execution Errors

General execution errors often involve the script not being present in the game or other general problems preventing the vm from processing the script correctly.

Failure to Run

  • Message: "<recursion level> Script failed to run: (filename)"
  • Reason: Often the script does not actually exist.
  • Solution:

Failure to Read

  • Message: "Error: Failed to read script file"
  • Reason: This is a generic message that shows up for all non specific errors. It's kind of misleading as the file might be read fine from disk but otherwise fail to execute.
  • Solution:

Failure to Load

  • Message: "Error: Script couldn't load"
  • Reason: This is a generic message that shows up for all problems where the game could not be read.
  • Solution: Make sure the script file was properly exported to the game by manually checking if it resides in the toolset export directory for the module.

Stack Errors / Unknown Error

When the stack gets corrupted, the game will produce one of the errors listed below. A good first step for any stack related problems is to check the ExecuteCommand channel for warnings/error messages near recently implemented scripting commands.

Stack Overflow

  • Message: "Stack Overflow in script: (filename)"
  • Reason: The stack got corrupted by pushing too many parameters from the engine.
  • Solution: The declaration for the command in script.ldf and its implementation in the virtual machine may not match; check if you've got incompatible versions of script.ldf and the executable file. Update script.ldf locally (by copying into /packages/core/override and restarting the toolset) and reexport all scripts.

Stack Underflow

  • Message: "Stack Underflow in script: (filename)"
  • Reason: The stack got corrupted by not popping of all values of a command from the stack.
  • Solution: The same as for a stack overflow.

Stack Error

  • Message: "Stack Error (code) in script: (filename) "
  • Reason: See common error codes listed below.
Code Reason Solution
TOO_MANY_INSTRUCTIONS (632) The VM has terminated the offending script after executing the maximum number of instructions (131072). This is ALWAYS an error made by the scripter, most likely triggered by an infinite loop. Any script that manages to run even closely to the maximum number of allowed instructions is either broken or badly designed and needs to be rewritten with a more efficient design.
TOO_MANY_RECURSION_LEVELS (633) The VM has terminated the offending script after hitting the maximum recursion level (8). This is always an error made by the scripter, often caused by layered HandleEvent calls Ensure the current event is handled earlier in the code and not propagated through a long chain of HandleEvents.
CANNOT_READ_FILE (634) Script could not be read, probably because it didn't exist. Export scripts from toolset
STACK_OVERFLOW (638) The VM has terminated the offending script after the stack was corrupted. See Stack Overflow above.
STACK_UNDERFLOW (639) The VM has terminated the offending script after the stack was corrupted. See Stack Underflow above.
INVALID_COMMMAND (642) The VM encountered a call to a command not known to the executable. Script.ldf was probably updated with a command that is not known to the current executable. Get an up to date executable.
DIVISION_BY_ZERO (644) A script has triggered a division by zero, either directly or inside a command not accepting a 0 parameter (e.g. Random) Ensure that the script is properly shielded against parameters becoming 0 (e.g. when read from a 2da). Find the location of the problem by checking the appropriate log channels (FW_SCRIPT and FW_SCRIPT_COMMANDS)

Defines

#define STRREF_VIRTUALMACHINE_ERROR_TOO_MANY_INSTRUCTIONS           632
#define STRREF_VIRTUALMACHINE_ERROR_TOO_MANY_LEVELS_OF_RECURSION    633
#define STRREF_VIRTUALMACHINE_ERROR_FILE_NOT_OPENED                 634
#define STRREF_VIRTUALMACHINE_ERROR_FILE_NOT_COMPILED_SUCCESSFULLY  635
#define STRREF_VIRTUALMACHINE_ERROR_INVALID_AUX_CODE                636
#define STRREF_VIRTUALMACHINE_ERROR_NULL_VIRTUAL_MACHINE_NODE       637
#define STRREF_VIRTUALMACHINE_ERROR_STACK_OVERFLOW                  638
#define STRREF_VIRTUALMACHINE_ERROR_STACK_UNDERFLOW                 639
#define STRREF_VIRTUALMACHINE_ERROR_INVALID_OP_CODE                 640
#define STRREF_VIRTUALMACHINE_ERROR_INVALID_EXTRA_DATA_ON_OP_CODE   641
#define STRREF_VIRTUALMACHINE_ERROR_INVALID_COMMAND                 642
#define STRREF_VIRTUALMACHINE_ERROR_FAKE_SHORTCUT_LOGICAL_OPERATION 643
#define STRREF_VIRTUALMACHINE_ERROR_DIVIDE_BY_ZERO                  644
#define STRREF_VIRTUALMACHINE_ERROR_FAKE_ABORT_SCRIPT               645
#define STRREF_VIRTUALMACHINE_ERROR_IP_OUT_OF_CODE_SEGMENT          646
#define STRREF_VIRTUALMACHINE_ERROR_COMMAND_IMPLEMENTER_NOT_SET     647
#define STRREF_VIRTUALMACHINE_ERROR_UNKNOWN_TYPE_ON_RUN_TIME_STACK  648
#define STRREF_VIRTUALMACHINE_ERROR_ARRAY_ACCESS_OUT_OF_BOUNDS      649

See also


Language: English  • русский