Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Working with the actionbar

Joined
Jan 8, 2015
Messages
1,426
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:
ActionBar.getActions("Make Leather").get(0).activate();

Can you give me a pointer?
 
Joined
Dec 18, 2014
Messages
398
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:
SlotAction action = ActionBar.getFirstAction(MAKE_LEATHER_ID);
//after a nullcheck
Keyboard.typeKey(action.getSlot().getKeyBind());
since activate() isn't working. At least, not for Geashaw and me.
 
Joined
Jan 8, 2015
Messages
1,426
Code:
SlotAction action = ActionBar.getFirstAction(MAKE_LEATHER_ID);
//after a nullcheck
Keyboard.typeKey(action.getSlot().getKeyBind());

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'.
 
Joined
Dec 18, 2014
Messages
398
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'.
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.
 
Joined
Jan 8, 2015
Messages
1,426
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.

I maximized the window and now it seems to click.

Code:
SlotAction action = ActionBar.getFirstAction(MAKE_LEATHER_ID);
SpriteItem hide = Inventory.getItems(GREEN_HIDE).first();

if (action != null && action.isActivatable()) {
    if (Keyboard.typeKey(action.getSlot().getKeyBind())) {
      if (hide != null && hide.interact("Cast")) {
      
      }
   }
}
 
Conelander
Joined
Oct 30, 2014
Messages
3,610
Code:
        final SlotAction drink = ActionBar.getFirstAction("Jug of wine");
Code:
                    drink.activate();
 
Joined
Dec 10, 2014
Messages
3,332
I maximized the window and now it seems to click.

Code:
SlotAction action = ActionBar.getFirstAction(MAKE_LEATHER_ID);
SpriteItem hide = Inventory.getItems(GREEN_HIDE).first();

if (action != null && action.isActivatable()) {
    if (Keyboard.typeKey(action.getSlot().getKeyBind())) {
      if (hide != null && hide.interact("Cast")) {
     
      }
   }
}

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() :)
 
Joined
Jan 8, 2015
Messages
1,426
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() :)

Yeah, this should then work right?

Code:
/**
 * Used to select the Make Leather spell from the ability bar.
 */
public void selectSpell() {
    SlotAction action = ActionBar.getFirstAction(MAKE_LEATHER_ID);

    if (action != null && action.isActivatable()) {
        if (Keyboard.typeKey(action.getSlot().getKeyBind())){
            // Sleep until selected.
            System.out.println("Selecting Make Leather.");
            Execution.delayUntil(() -> action.isSelected(), 2000);
        }
    }
}
 
Joined
Dec 10, 2014
Messages
3,332
Yeah, this should then work right?

Code:
/**
* Used to select the Make Leather spell from the ability bar.
*/
public void selectSpell() {
    SlotAction action = ActionBar.getFirstAction(MAKE_LEATHER_ID);

    if (action != null && action.isActivatable()) {
        if (Keyboard.typeKey(action.getSlot().getKeyBind())){
            // Sleep until selected.
            System.out.println("Selecting Make Leather.");
            Execution.delayUntil(() -> action.isSelected(), 2000);
        }
    }
}

Yeah it should work, but
Code:
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
 
The Pip Collector
Joined
Sep 14, 2014
Messages
445
You can just do this:
Code:
Final SlotAction makeLeather = ActionBar.getFirstAction("Make Leather");
if(makeLeather != null && !makeLeather.isSelected() && makeLeather.isReady){
    if(makeLeather.activate()){
        Execution.delayUntil(makeLeather::isSelected(),4000);
    }
}
 
Mod Automation
Joined
Jul 26, 2013
Messages
3,053
Hey @Geashaw you should join the dev chat. Add me on Skype - runemate. (with the period) - and I'll throw you in the chat. :)
 
Top