Difference between revisions of "ASH Errors"

From Kolmafia
Jump to navigation Jump to search
imported>Icon315
imported>Icon315
(Variable is already defined)
Line 59: Line 59:
 
</syntaxhighlight>}}
 
</syntaxhighlight>}}
 
will cause this error: <span style="color:red">Script parsing error (test.ash, line 5)</span>
 
will cause this error: <span style="color:red">Script parsing error (test.ash, line 5)</span>
 +
 +
===Variable is already defined===
 +
 +
 +
This generally indicates a syntax problem, as in having an excess amount of braces.
 +
 +
{{CodeSample|
 +
description=Example:|
 +
code=
 +
<syntaxhighlight>
 +
int Drops = numeric_modifier("Item Drop");
 +
 +
int Drops = numeric_modifier("Meat Drops");
 +
</syntaxhighlight>}}
 +
will cause this error: <span style="color:red">Variable Drops is already defined (test.ash, line 3)</span>
 
{{RFI|Obviously, a lot more info is needed here.}}
 
{{RFI|Obviously, a lot more info is needed here.}}

Revision as of 22:20, 16 April 2010

Errors happen.

Also, I don't happen to have this page done, yet.

Abort

Whenever a script runs the abort() function, this error is generated.

Example:

abort("Aborting script...");

will stop the execution and print: Aborting script...

Expected

This generally indicates a syntax problem (missing ending semi-colon, unmatched braces, unmatched parenthesis etc...).

Example:

int a = 1
print(a);

will cause this error: Expected ;, found print (test.ash, line 2)

Missing return value

The last line of a user-defined function has to be "return <value>;" (although the return command can be used before too).

Example:

int my_function( int a, int b ) {	
    if ( a > b ) return a ;
    else return b ;
}

will cause this error: Missing return value (test.ash, line 4)

Script parsing error

This generally indicates a syntax problem, as in having an excess amount of braces.

Example:

 put_shop(0 ,0 ,$item[wolf mask]);
 put_shop(0 ,0 ,$item[rave whistle]);
 put_shop(0 ,0 ,$item[giant needle]);
 cli_execute ("undercut");
	}

will cause this error: Script parsing error (test.ash, line 5)

Variable is already defined

This generally indicates a syntax problem, as in having an excess amount of braces.

Example:

int Drops = numeric_modifier("Item Drop");

int Drops = numeric_modifier("Meat Drops");

will cause this error: Variable Drops is already defined (test.ash, line 3)

Attention KoLmafia Experts!

We need your help; some details of this function's operation are unknown or unclear.

The following specific question has been raised:

  • Obviously, a lot more info is needed here.