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

Implemented Interface closer

Discussion in 'Client & Site Suggestions' started by Salvation, May 5, 2014.

  1. Salvation

    Salvation First Bot Author

    Joined:
    Aug 7, 2013
    Messages:
    262
    Likes Received:
    68
    An interface closer should be added to the client.

    I suggest having this "event solver" customizable per script bot, where a script bot can add or remove specific interfaces depending on the needs of the script bot.

    OSRS report screen closer, as dynamic as possible:
    Code (Text):
    1.  
    2. package com.skelware.runemate.bot.script.flax;
    3.  
    4. import com.runemate.game.api.hybrid.local.hud.interfaces.Interface;
    5. import com.runemate.game.api.hybrid.local.hud.interfaces.InterfaceComponent;
    6. import com.runemate.game.api.hybrid.local.hud.interfaces.Interfaces;
    7. import com.runemate.game.api.hybrid.util.Filter;
    8. import com.runemate.game.api.script.Execution;
    9. import com.sjbijzitter.bot.script.engine.impl.Condition;
    10. import com.sjbijzitter.bot.script.engine.impl.Executable;
    11.  
    12. public final class ReportScreenCloser implements Condition, Executable {
    13.  
    14.     private InterfaceComponent closebutton;
    15.     private static final Filter<InterfaceComponent> FILTER_TEXT = Interfaces.getTextContainsFilter("Report abuse");
    16.     private static final Filter<InterfaceComponent> FILTER_TEXTURE = Interfaces.getTextureFilter(535);
    17.  
    18.     @Override
    19.     public boolean validate() {
    20.         closebutton = null;
    21.         top: for (final Interface iface : Interfaces.getVisible()) { //iterate over all visible interfaces
    22.             for (final InterfaceComponent titlebar : iface.getComponents(FILTER_TEXT)) { //make sure the current interface is the report screen
    23.                 for (final InterfaceComponent closebutton : iface.getComponents(FILTER_TEXTURE)) { //find the close button on the report screen
    24.                     this.closebutton = closebutton;
    25.                     break top; //stop iterating over all visible interfaces
    26.                 }
    27.             }
    28.         }
    29.         return closebutton != null;
    30.     }
    31.  
    32.     @Override
    33.     public int execute() {
    34.         if (closebutton.interact("Cancel")) { //click the close button on the report screen
    35.             for (int i = 0; i < 10 && validate(); i++) {
    36.                 Execution.delay(100); //Wait a bit for the report screen to close
    37.             }
    38.         }
    39.         return 0;
    40.     }
    41. }
    42.  
    43.  
     
    #1 Salvation, May 5, 2014
    Last edited: May 5, 2014
  2. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    Added the OSRS interface handler for the next release
     

Share This Page

Loading...