I had a command daily deed for reminding me of using my Mime army shotglass, but when I started doing hardcore runs, I got tired of seeing the box even when I didn't have the shotglass, so I thought of switching to an item deed, so that it checks for the presence of said item.
Problem is, I'm getting this error:
After looking through the code of DailyDeedsPanel.java (I don't even specifically know java; I'm trying my best
), I can see two problems with this, so I'll try to explain them while adding context.
Before starting, you may say that the mime army shotglass isn't actually usable. While that would be true, the code doesn't even actually check for that, so the error can't be linked to this fact; I simply use the box of the daily deed as a reminder, and on paper, I don't see an issue with doing this.
Now with what I tried and how it is (supposedly) handled:
====1ST TRY====
$CUSTOM|Item|mime army shotglass|_mimeArmyShotglassUsed|||free 1-drunkenness booze|, (the | at the end is mandatory here, and I'll show why later; this could actually deserve a little bug report of its own)
So, public void populate() scans dailyDeedsOptions and sees "$CUSTOM|Item|", so it follows with "parseItemDeed(array of strings = < all that followed "$CUSTOM|" until "," >)"
It then leads to the function:
Which here means:
First, little side note/bug report: else if ( deedsString.length == 6 ) DOES NOT have the part I put in bold (where the script checks for an empty itemName (if ( deedsString[ 3 ].equals ( "" ) ) ), and uses displayText instead if it is the case; this is why I had to add an empty pipe, to submit an empty 7th argument)
Now the interesting part:
Reminding that what I had was:
These are the two errors: first, I don't see any reason as to why the line would be printed TWICE; this is the only Item deed that is faulty/even when I only have this in dailyDeedsOptions, the line is still printed twice, which is not normal.
Second, there is the fact that we can clearly see "Daily Deeds error: unable to resolve item " + displayText , yet THE ERRORS I GOT END ABRUPTLY, even though they should end with "mime army shotglass".
====2ND TRY====
Maybe there's a problem with parsing mime army shotglass as an item? Lets try putting the item ID instead:
Testing:
Good, so: $CUSTOM|Item|mime army shotglass|_mimeArmyShotglassUsed|[9676]||free 1-drunkenness booze, (7th arg. not needed here since itemName is filled) should work better, right?
Yet, I still get the error(s): Daily Deeds error: unable to resolve item (x2) .
Problem is, I'm getting this error:
Code:
Daily Deeds error: unable to resolve item
Daily Deeds error: unable to resolve item

Before starting, you may say that the mime army shotglass isn't actually usable. While that would be true, the code doesn't even actually check for that, so the error can't be linked to this fact; I simply use the box of the daily deed as a reminder, and on paper, I don't see an issue with doing this.
Now with what I tried and how it is (supposedly) handled:
====1ST TRY====
$CUSTOM|Item|mime army shotglass|_mimeArmyShotglassUsed|||free 1-drunkenness booze|, (the | at the end is mandatory here, and I'll show why later; this could actually deserve a little bug report of its own)
So, public void populate() scans dailyDeedsOptions and sees "$CUSTOM|Item|", so it follows with "parseItemDeed(array of strings = < all that followed "$CUSTOM|" until "," >)"
It then leads to the function:
Code:
private void parseItemDeed( String[] deedsString )
{ [...]
if ( deedsString.length == 3 )
{ [...] }
else if ( deedsString.length == 4 )
{ [...] }
else if ( deedsString.length == 5 )
{ [...] }
else if ( deedsString.length == 6 )
{ [...] }
else if ( deedsString.length == 7 )
{ [...] }
}
Code:
private void parseItemDeed( deedsString[ 0 ] = "Item", deedsString[ 1 ] = "mime army shotglass", deedsString[ 2 ] = "_mimeArmyShotglassUsed", deedsString[ 3 ] = "", deedsString[ 4 ] = "", deedsString[ 5 ] = "free 1-drunkenness booze", deedsString[ 6 ] = "" )
{
else if ( deedsString.length == 7 ) /////(the one that has had its condition satisfied)/////
{
/*
* BooleanItem|displayText|preference|itemName|maxUses|toolTip|compMessage
* itemId is found from itemName if present, otherwise display text
*/
String displayText = deedsString[ 1 ];
String toolTip = deedsString[ 5 ];
String compMessage = deedsString[ 6 ];
// Use the substring matching of getItemId because itemName may not
// be the canonical name of the item
int itemId;
[B]String item = "";
if ( deedsString[ 3 ].equals ( "" ) )
{
itemId = ItemDatabase.getItemId( displayText );
item = ItemDatabase.getItemName( itemId );
if ( itemId == -1 )
{
RequestLogger
.printLine( "Daily Deeds error: unable to resolve item " + displayText );
return;
}
}[/B]
else
{
String split = deedsString[ 3 ].split( ";" )[ 0 ];
itemId = ItemDatabase.getItemId( split );
item = ItemDatabase.getItemName( itemId );
if ( deedsString[ 3 ].split( ";" ).length > 1 )
{
for ( int i = 1; i < deedsString[ 3 ].split( ";" ).length; ++i )
{
item += ";" + deedsString[ 3 ].split( ";" )[ i ];
}
}
if ( itemId == -1 )
{
RequestLogger
.printLine( "Daily Deeds error: unable to resolve item " + deedsString[ 3 ] );
return;
}
}
}
}
First, little side note/bug report: else if ( deedsString.length == 6 ) DOES NOT have the part I put in bold (where the script checks for an empty itemName (if ( deedsString[ 3 ].equals ( "" ) ) ), and uses displayText instead if it is the case; this is why I had to add an empty pipe, to submit an empty 7th argument)
Now the interesting part:
Code:
itemId = ItemDatabase.getItemId( displayText );
item = ItemDatabase.getItemName( itemId );
if ( itemId == -1 )
{
RequestLogger
.printLine( "Daily Deeds error: unable to resolve item " + displayText );
return;
}
Code:
Daily Deeds error: unable to resolve item
Daily Deeds error: unable to resolve item
Second, there is the fact that we can clearly see "Daily Deeds error: unable to resolve item " + displayText , yet THE ERRORS I GOT END ABRUPTLY, even though they should end with "mime army shotglass".
====2ND TRY====
Maybe there's a problem with parsing mime army shotglass as an item? Lets try putting the item ID instead:
Testing:
Code:
> ash print($item[9676]);
mime army shotglass
Returned: void
Yet, I still get the error(s): Daily Deeds error: unable to resolve item (x2) .
Last edited: