Results 1 to 4 of 4

Thread: Maybe not a bug?? Daily Deeds error: unable to resolve item

  1. #1

    Default Maybe not a bug?? Daily Deeds error: unable to resolve item

    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:
    Code:
    Daily Deeds error: unable to resolve item
    Daily Deeds error: unable to resolve item
    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:
    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 )
    	{	[...]	}
    }
    Which here means:
    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;
    		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;
    			}
    		}
    		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;
    }
    Reminding that what I had was:
    Code:
    Daily Deeds error: unable to resolve item
    Daily Deeds error: unable to resolve item
    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:
    Code:
    > ash print($item[9676]);
    
    mime army shotglass
    Returned: void
    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) .
    Last edited by fredg1; 11-17-2019 at 11:35 PM.

  2. #2
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,315

    Default

    I created a deed using Preferences/Automation/Daily Deeds
    deedsString.length == 6 :

    Code:
    			/*
    			 * BooleanItem|displayText|preference|itemName|maxUses|toolTip
    			 * itemId is found from itemName
    			 */
    deedsString.legngth == 7:

    Code:
    			/*
    			 * BooleanItem|displayText|preference|itemName|maxUses|toolTip|compMessage
    			 * itemId is found from itemName if present, otherwise display text
    			 */
    The section that is actually used for your deed is deedsString.length == 6

    Looks like the 7-argument version is a more developed version of the 6-argument version.

    Revision 19623 lets the itemName be optional for the 4, 5, 6, and 7 argument versions, and also allow the maxUses to be optional for the 5, 6, and 7 argument versions.

  3. #3

    Default

    That fixed it alright, but why was it not recognizing the item when I used $CUSTOM|Item|mime army shotglass|_mimeArmyShotglassUsed|[9676]||free 1-drunkenness booze, ?

  4. #4
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    12,315

    Default

    I don't see why it would have failed with "Daily Deeds error: unable to resolve item [9676]".
    It should have failed with "Daily Deeds error: Item deeds require an int for the fifth parameter." since you left the maxUses parameter empty.

    However, my fix also made that field optional (defaulting to 1).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •