Rinn
Developer
I'm trying to write a script where I can hijack battle actions without forcing the users to change their ccs, so I remembered the version of adventure that can take in a function name to process the combat. Take this simple script for example, this is the full contents of my test.ash:
Returns the following error in the cli:
Okay so I looked up the original thread and that's the error jason said he got when he declared the consult function as void instead of string. So then I tried this:
When I remove main and put the adventure call right in the script, I get a stack trace:
Am I doing something incorrect, or has this broken at some point and no one noticed because of it's infrequent use?
Relevant thread:
http://kolmafia.us/showthread.php?1609
Code:
string combat_cleesh(int round, monster opp, string text)
{
if (opp == $monster[frog] || opp == $monster[newt] || opp == $monster[salamander])
{
return "attack";
}
return "skill CLEESH";
}
void main()
{
adventure(1, $location[hole in the sky], "combat_cleesh");
}
Code:
Unable to invoke combat_cleesh
You don't have enough ovid leather thing
You're on your own, partner.
Code:
string combat_cleesh(int round, monster opp, string text)
{
if (opp == $monster[frog] || opp == $monster[newt] || opp == $monster[salamander])
{
return "attack";
}
return "skill CLEESH";
}
adventure(1, $location[hole in the sky], "combat_cleesh");
Code:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
KoLmafia r8268, Windows 7, Java 1.6.0_18
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Please note: do not post these logs in the KoLmafia thread. If
you would like us to look at the log, please instead email logs
to veracity@hambo.com using the subject "KoLmafia Debug Log"
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Timestamp: Sat Mar 13 20:56:29 PST 2010
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Unexpected error, debug log printed.
class java.lang.NullPointerException: null
java.lang.NullPointerException
at net.sourceforge.kolmafia.request.FightRequest.nextRound(FightRequest.java:522)
at net.sourceforge.kolmafia.request.FightRequest.nextRound(FightRequest.java:490)
at net.sourceforge.kolmafia.request.FightRequest.runOnce(FightRequest.java:1076)
at net.sourceforge.kolmafia.request.FightRequest.run(FightRequest.java:1109)
at net.sourceforge.kolmafia.request.GenericRequest.handleServerRedirect(GenericRequest.java:1505)
at net.sourceforge.kolmafia.request.GenericRequest.retrieveServerReply(GenericRequest.java:1353)
at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1084)
at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:975)
at net.sourceforge.kolmafia.request.AdventureRequest.run(AdventureRequest.java:208)
at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:73)
at net.sourceforge.kolmafia.KoLAdventure.run(KoLAdventure.java:918)
at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:103)
at net.sourceforge.kolmafia.KoLmafia.executeAdventureOnce(KoLmafia.java:1423)
at net.sourceforge.kolmafia.KoLmafia.executeRequestOnce(KoLmafia.java:1441)
at net.sourceforge.kolmafia.KoLmafia.executeRequest(KoLmafia.java:1313)
at net.sourceforge.kolmafia.KoLmafia.makeRequest(KoLmafia.java:1198)
at net.sourceforge.kolmafia.textui.command.AdventureCommand.run(AdventureCommand.java:103)
at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:527)
at net.sourceforge.kolmafia.textui.RuntimeLibrary.adventure(RuntimeLibrary.java:1821)
at net.sourceforge.kolmafia.textui.RuntimeLibrary.adventure(RuntimeLibrary.java:1831)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sourceforge.kolmafia.textui.parsetree.LibraryFunction.execute(LibraryFunction.java:119)
at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:166)
at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:451)
at net.sourceforge.kolmafia.textui.Interpreter.executeScope(Interpreter.java:240)
at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:194)
at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:187)
at net.sourceforge.kolmafia.textui.command.CallScriptCommand.call(CallScriptCommand.java:194)
at net.sourceforge.kolmafia.textui.command.CallScriptCommand.run(CallScriptCommand.java:63)
at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:527)
at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:401)
at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.handleQueue(CommandDisplayFrame.java:191)
at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.run(CommandDisplayFrame.java:172)
Am I doing something incorrect, or has this broken at some point and no one noticed because of it's infrequent use?
Relevant thread:
http://kolmafia.us/showthread.php?1609