1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Resolved Inventory item isVisible returning false

Discussion in 'Developer Support' started by proxi, Apr 5, 2016.

  1. proxi

    proxi s̶c̶r̶i̶p̶t̶ bot*

    Joined:
    Aug 23, 2015
    Messages:
    2,223
    Likes Received:
    501
    @Cloud for when you wake up <3

    It appears that under certain conditions an Inventory SpriteItem's isVisible is false. This is causing failure for interaction.

    I've attached my code along with a screenshot of how my client was set up. Also note, that putting my client in legacy interface mode fixed isVisible to return correct values.

    Code (Text):
    1. public DropItemsTask(SudoDivination bot){
    2.         super();
    3.         this.bot = bot;
    4.         pattern = Pattern.compile("(?i)^(logs|wooden knot)");
    5.     }
    6.  
    7.     @Override
    8.     public void Loop(){
    9.         SpriteItemQueryResults inventoryResults = Inventory.newQuery().names(pattern).results();
    10.         SpriteItem inventoryFirst = inventoryResults.first();
    11.  
    12.         if((inventoryResults).size() > 0){
    13.             Methods.debugAndUpdate("Attemping DropItemsTask", bot);
    14.             for(int i = 0; i < inventoryFirst.getDefinition().getInventoryActions().size(); i++)
    15.                 Methods.debug("Has Action: " + inventoryFirst.getDefinition().getInventoryActions().get(i));
    16.             Methods.debug("Item is Visible: " + inventoryFirst.isVisible());
    17.             Methods.debug("Item is Valid: " + inventoryFirst.isValid());
    18.             inventoryFirst.interact("Drop");
    19.         }
    20.         else{
    21.             Methods.debugAndUpdate("DropItemsTask Complete", bot);
    22.             Complete();
    23.         }
    24.     }
    [​IMG]

     
  2. Best Answer:
    Post #4 by Cloud, Apr 6, 2016
  3. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    So under which conditions is it falsely returning?
     
  4. proxi

    proxi s̶c̶r̶i̶p̶t̶ bot*

    Joined:
    Aug 23, 2015
    Messages:
    2,223
    Likes Received:
    501
    It seems to always be false if I am not in legacy interface mode.
    --- Double Post Merged, Apr 6, 2016, Original Post Date: Apr 6, 2016 ---
    @Cloud A little update, I'm not sure how or why this happened, but my bot got this last night when trying to drop an object in the inventory. This was also in the Legacy client mode.

    Keycode 112 is F1. Maybe it was trying to open Inventory with a button press? (If that's the hotkey for inventory? Idk, just a guess)


    Code (Text):
    1. Attemping DropItemsTask
    2. Has Action: Craft
    3. Has Action: Light
    4. Has Action: Drop
    5. Item is Visible: false
    6. Item is Valid: true
    7. java.lang.IllegalArgumentException: Action keys such as '? (keycode 112)' are not currently supported.
    8.         at com.runemate.game.api.hybrid.input.Keyboard.pressKey(gdc:195)
    9.         at com.runemate.game.api.hybrid.input.Keyboard.typeKey(gdc:86)
    10.         at com.runemate.game.api.hybrid.input.Keyboard.typeKey(gdc:193)
    11.         at com.runemate.game.api.hybrid.input.Keyboard.typeKey(gdc:276)
    12.         at com.runemate.game.api.rs3.local.hud.interfaces.legacy.LegacyTab.open(mub:207)
    13.         at com.runemate.game.api.rs3.local.hud.interfaces.legacy.LegacyTab.open(mub:125)
    14.         at com.runemate.game.api.hybrid.local.hud.interfaces.SpriteItem.new(uyb:183)
    15.         at com.runemate.game.api.hybrid.local.hud.interfaces.SpriteItem.interact(uyb:272)
    16.         at com.runemate.game.api.hybrid.entities.details.Interactable.interact(ak:263)
    17.         at com.runemate.game.api.hybrid.entities.details.Interactable.interact(ak:222)
    18.         at com.Sudo.Spectre.bots.SudoDivination.tasks.DropItemsTask.Loop(DropItemsTask.java:36)
    19.         at com.Sudo.Spectre.bots.SudoDivination.SudoDivination.onLoop(SudoDivination.java:141)
    20.         at com.runemate.game.api.script.framework.LoopingScript.run(cqb:184)
    21.         at com.runemate.game.api.script.framework.AbstractScript.start(ymb:276)
    22.         at nul.IIIIiIiIiIiI.run(odc:79)
     
  5. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    You're right about that second part, it was trying to open the inventory with a hotkey but for some reason we don't support "action keys", I'm investigating this part now.

    Edit: Okay that's patched for the next release, now investigating the other bug.
    --- Double Post Merged, Apr 6, 2016 ---
    Both issues have been fixed in the newly released V1.0.42
     

Share This Page

Loading...