has no matches

me259259

Member
I'm writing an item handling script, and I've run into a problem I have been running into for awhile now.

When I try to mallsell multiple items from the cli, sometimes it works, and sometimes it doesn't. When I try mallselling, it's usually in this format:

Code:
mallsell * item a, * item b, * etc

Sometimes this works well. Sometimes I get this error saying, "[*] has no matches", and I can only sell the items like this:

Code:
mallsell * item a; mallsell * item b; mallsell * etc

I know I have at least 1 of every item, but this pops up every now and then.

In the current item handling script I'm working on (for the knob goblin kitchens), it makes this error consistently:

Code:
void main ()
{
	if (item_amount ( $item[spices] ) > 0)
		{
		cli_execute ("acquire " +item_amount($item[spices]) + " starchy sword");
		cli_execute ("make " +item_amount($item[spices]) + " pestoblade");
		}
cli_execute ("mallsell * Knob mushroom, * Knob sausage, * dry noodles, * pestoblade");
cli_execute ("autosell * Knob Goblin spatula, * tomato, * wad of dough");
}

The script works fine up until it tries to mallsell. It can tell how many Spices I have, make the right number of Pestoblades. It then mallsells all of my Knob Mushrooms, Knob Sausage, and Dry Noodles. But for some reason, it won't mallsell Pestoblades unless I put it on a separate line, or use a semicolon instead of a comma.

Any idea why it works for some items and not others?
 

Theraze

Active member
If the option exists, is there a reason for doing cli_executes for everything as opposed to the ASH commands?
 

me259259

Member
I use cli_execute because I'm still very new at this. I'm working my way through the advance scripting guides on the wiki, but I'm not comfortable enough with it yet to use ash commands. Give me a week's worth of free time and I'll make the switch :p.

I thought it was worth mentioning because this happens sometimes just using the cli, and it's been bugging me lately.
 

Theraze

Active member
Yeah, I'm looking into this now... got debug error myself as well.

But to give you equivalents (or the ASH version thereof), retrieve_item will replace acquire, craft replaces make, put_shop replaces mallsell, and autosell is the same name for both of those.

Edit: Interestingly, put_shop and mallsell both return the following error when I try to do the pestoblade while offline:
Unexpected error, debug log printed.
class java.lang.NumberFormatException: ¶1718
java.lang.NumberFormatException: ¶1718
at net.sourceforge.kolmafia.utilities.StringUtilities.parseIntInternal1(StringUtilities.java:721)
at net.sourceforge.kolmafia.utilities.StringUtilities.parseInt(StringUtilities.java:666)
at net.sourceforge.kolmafia.textui.command.MallSellCommand.run(MallSellCommand.java:109)
at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:527)
at net.sourceforge.kolmafia.textui.RuntimeLibrary.batchCommand(RuntimeLibrary.java:1226)
at net.sourceforge.kolmafia.textui.RuntimeLibrary.batchCommand(RuntimeLibrary.java:1218)
at net.sourceforge.kolmafia.textui.RuntimeLibrary.put_shop(RuntimeLibrary.java:2205)

Basically, it appears that it's passing along the pilcrow (sometimes used as a tab symbol) for some reason, and not stripping it when the parsing of the int happens. Question is, should non-standard characters be stripped on int parsing? Do we need an exception for that specific symbol? Also, though it's not visible here, putting the debug file into a hex editor displays ASCII 194 and 182 next to each other. It's possible though that they're parsed together into a pilcrow in more capable systems.

So... is this something to fix, or just ignore?

me259259, if you'd like to check your debug logs to see if you have similar records as well? I'd be curious as to why the code says your item lookup is failing.
 
Last edited:

Alhifar

Member
¶NNNN is a format for passing a item number in the CLI. It appears it is simply parsing the item number as number of item to be sold.
 

Theraze

Active member
That happens when i do ash put_shop(1, 1, $item[pestoblade]) or ash put_shop(1, 1, to_item("pestoblade")). If you can tell me which part of that is wrong, since ashref says that put_shop works on (int, int, item), I'd be happy to modify it... Though yes, it does also overload some more. But given 3 values, I'm not certain why it's failing to realize that item 1718 is item 1718, not int pilcrow-1718.
 

me259259

Member
Here's my debug log:

Code:
Unexpected error, debug log printed.
class java.lang.NumberFormatException: Knob
java.lang.NumberFormatException: Knob
	at net.sourceforge.kolmafia.utilities.StringUtilities.parseIntInternal1(StringUtilities.java:721)
	at net.sourceforge.kolmafia.utilities.StringUtilities.parseInt(StringUtilities.java:666)
	at net.sourceforge.kolmafia.textui.command.MallSellCommand.run(MallSellCommand.java:109)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:527)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:401)
	at net.sourceforge.kolmafia.textui.RuntimeLibrary.cli_execute(RuntimeLibrary.java:1393)
	at sun.reflect.GeneratedMethodAccessor80.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.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:127)
	at net.sourceforge.kolmafia.textui.Interpreter.executeScope(Interpreter.java:265)
	at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:198)
	at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:191)
	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:194)
	at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.run(CommandDisplayFrame.java:175)

This debug log was generated using cli_execute, and not the ash alternative.

This is already beyond my mafia skills... I hope this helps!
 

Fluxxdog

Active member
If the option exists, is there a reason for doing cli_executes for everything as opposed to the ASH commands?
There are some reasons to use CLI over AH if you have them. Here's a snippet of code from an cleaning script I wrote for myself:
PHP:
string LootPile;
void selloff(int howmany, item lookforit) {
	if (LootPile != "")
		string lootsplit=", ";
	if (have_item(lookforit) > 0) {
		LootPile = LootPile+lootsplit+" "+howmany+" "+lookforit;}}

void selloff(item lookforit){
	selloff(item_amount(lookforit),lookforit);}
//at the end
if (LootPile != "") {
	print("For sale: "+LootPile+".","blue");
	cli_execute("autosell "+LootPile);}
It let's me build up a list of items to autosell and sell them all at once. However, instead of doing that with batches, I have it print out a nice report for me so I can see exactly what it IS selling. Making 80,000 meat from selling a booatload of stuff? Nice. Seeing what that boatload is? Worth the extra scripting hassle.
 

Theraze

Active member
Here's my debug log:

Code:
Unexpected error, debug log printed.
class java.lang.NumberFormatException: Knob
java.lang.NumberFormatException: Knob
at net.sourceforge.kolmafia.utilities.StringUtilities.parseIntInternal1(StringUtilities.java:721)
at net.sourceforge.kolmafia.utilities.StringUtilities.parseInt(StringUtilities.java:666)
at net.sourceforge.kolmafia.textui.command.MallSellCommand.run(MallSellCommand.java:109)
at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:527)
at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:401)
at net.sourceforge.kolmafia.textui.RuntimeLibrary.cli_execute(RuntimeLibrary.java:1393)
at sun.reflect.GeneratedMethodAccessor80.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.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:127)
at net.sourceforge.kolmafia.textui.Interpreter.executeScope(Interpreter.java:265)
at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:198)
at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:191)
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:194)
at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.run(CommandDisplayFrame.java:175)

This debug log was generated using cli_execute, and not the ash alternative.

This is already beyond my mafia skills... I hope this helps!

If I'm understanding right, it's trying to parse "knob" as an int... it may have to do with the number of items you're selling matching how many values can be passed to autosell or something slightly bizarre like that. Anyways, I'd suggest probably doing something like this:
Code:
batch_open();  
int saleprice = 0;
foreach it in $items[Knob mushroom, Knob sausage, dry noodles, pestoblade] {
      if (item_amount(it) > 1) {
 saleprice += (item_amount(it) - 1) * mall_price(it);
 put_shop(mall_price(it), item_amount(it) - 1, it);
 }
}
batch_close();
print("dumped trash to mall for eventual "+ saleprice +" meat.", "blue");
 

me259259

Member
Grr... today I ran the script in the first post, without making any changes. I had farmed in the kitchens again today, so I had all the items I needed the script to handle... and it worked just fine. Though when I did something similar just using the cli, selling just 4 items, it failed. And when I tried to mallsell 22 items at once, it worked.

Curse this randomness!

This is starting to seem like a mafia bug. I'll go make up a bug report.
 
Top