Difference between revisions of "ASH Errors"

From Kolmafia
Jump to navigation Jump to search
imported>Icon315
(Variable is already defined)
imported>Icon315
(→‎Variable is already defined: woops forgot to chanfe description, i think i will enjoy this page)
Line 63: Line 63:
  
  
This generally indicates a syntax problem, as in having an excess amount of braces.
+
This generally indicates that you have 2 variables named identically.
  
 
{{CodeSample|
 
{{CodeSample|

Revision as of 22:22, 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 that you have 2 variables named identically.

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.