Working with the actionbar

Discussion in 'Developer Support' started by Geashaw, Jan 16, 2015.

  1. Currently looking at MaxiAlcher but I can't seem to find out how to interact with a specific actionbar slot.

    I have the following (which does nothing) :
    Code (Text):
    1. ActionBar.getActions("Make Leather").get(0).activate();
    Can you give me a pointer?
  2. Spells and items currently have null values for their name, activatable boolean, and ready boolean on the action bar. This is according to the Action Bar tab of the development toolkit. In fact, I don't know how you're not getting a nullpointer. To remedy this, I would do
    Code (Text):
    2. SlotAction action = ActionBar.getFirstAction(MAKE_LEATHER_ID);
    3. //after a nullcheck
    4. Keyboard.typeKey(action.getSlot().getKeyBind());
    since activate() isn't working. At least, not for Geashaw and me.
  3. Strangely this is not working either, I have the Make Leather spell anywhere on my abilitybar (since getKeyBind() indeed returns the 'key').

    It does somehow not 'typeKey'.
  4. Is it the alt + tab issue? Turn on keyboard input, click somewhere in the game window, then press alt. See if it works after that.
    Whenever you want to alt + tab away from the client, make sure keyboard input is turned off. Or else the alt key gets stuck in the client.
  5. I maximized the window and now it seems to click.

    Code (Text):
    2. SlotAction action = ActionBar.getFirstAction(MAKE_LEATHER_ID);
    3. SpriteItem hide = Inventory.getItems(GREEN_HIDE).first();
    5. if (action != null && action.isActivatable()) {
    6.     if (Keyboard.typeKey(action.getSlot().getKeyBind())) {
    7.       if (hide != null && hide.interact("Cast")) {
    9.       }
    10.    }
    11. }
  6. Code (Text):
    1.         final SlotAction drink = ActionBar.getFirstAction("Jug of wine");
    Code (Text):
    1.                     drink.activate();
  7. For magic spells in RS3, you can use the Powers.Magic enum, and there's a similar Magic enum for OSRS. They both have an activate() method that will attempt to use the actionbar, or if that fails it will use the magic tab.

    Also you can replace "Keyboard.typeKey(action.getSlot().getKeyBind())" with action.activate() :)
  8. Yeah, this should then work right?

    Code (Text):
    1. /**
    2.  * Used to select the Make Leather spell from the ability bar.
    3.  */
    4. public void selectSpell() {
    5.     SlotAction action = ActionBar.getFirstAction(MAKE_LEATHER_ID);
    7.     if (action != null && action.isActivatable()) {
    8.         if (Keyboard.typeKey(action.getSlot().getKeyBind())){
    9.             // Sleep until selected.
    10.             System.out.println("Selecting Make Leather.");
    11.             Execution.delayUntil(() -> action.isSelected(), 2000);
    12.         }
    13.     }
    14. }
  9. Yeah it should work, but
    Code (Text):
    2. Powers.Magic.Lunar.MAKE_LEATHER.activate();
    is another way to activate MAKE_LEATHER and it will use the actionbar or the actual magic spell in the magic tab if it's not in your actionbar
    Geashaw likes this.
  10. You can just do this:
    Code (Text):
    2. Final SlotAction makeLeather = ActionBar.getFirstAction("Make Leather");
    3. if(makeLeather != null && !makeLeather.isSelected() && makeLeather.isReady){
    4.     if(makeLeather.activate()){
    5.         Execution.delayUntil(makeLeather::isSelected(),4000);
    6.     }
    7. }
  11. Hey @Geashaw you should join the dev chat. Add me on Skype - runemate. (with the period) - and I'll throw you in the chat. :)

Share This Page