Difference between revisions of "ASH Errors"

From Kolmafia
Jump to navigation Jump to search
imported>Slyz
(someone might want to check the formatting)
imported>Icon315
(Script Parsing error.....i wish this page was here when i kept getting errors)
(One intermediate revision by one other user not shown)
Line 8: Line 8:
  
 
{{CodeSample|
 
{{CodeSample|
description=Example|
+
description=Example:|
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>
Line 20: Line 20:
  
 
{{CodeSample|
 
{{CodeSample|
description=Example|
+
description=Example:|
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>
Line 27: Line 27:
 
</syntaxhighlight>}}
 
</syntaxhighlight>}}
 
will cause this error: <span style="color:red">Expected ;, found print (test.ash, line 2)</span>
 
will cause this error: <span style="color:red">Expected ;, found print (test.ash, line 2)</span>
 
  
 
===Missing return value===
 
===Missing return value===
Line 34: Line 33:
  
 
{{CodeSample|
 
{{CodeSample|
description=Example|
+
description=Example:|
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>
Line 44: Line 43:
 
will cause this error: <span style="color:red">Missing return value (test.ash, line 4)</span>
 
will cause this error: <span style="color:red">Missing return value (test.ash, line 4)</span>
  
 +
===Script parsing error===
 +
 +
 +
This generally indicates a syntax problem, as in having an excess amount of braces.
 +
 +
{{CodeSample|
 +
description=Example:|
 +
code=
 +
<syntaxhighlight>
 +
put_shop(0 ,0 ,$item[wolf mask]);
 +
put_shop(0 ,0 ,$item[rave whistle]);
 +
put_shop(0 ,0 ,$item[giant needle]);
 +
cli_execute ("undercut");
 +
}
 +
}
 +
</syntaxhighlight>}}
 +
will cause this error: <span style="color:red">Script parsing error (test.ash, line 5)</span>
 
{{RFI|Obviously, a lot more info is needed here.}}
 
{{RFI|Obviously, a lot more info is needed here.}}

Revision as of 22:11, 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)

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.