Thread Tools Display Modes
07/07/17, 06:20 PM   #1
ivanwfr
Join Date: Apr 2014
Posts: 9
Quick Slot Bar Item Preset

Hi, I am looking for a way to get indexes from the current back pack content in order to preload different sets of potions (PvP or PvE or whatever...) into the Quick Slot Bar.

This would be a new feature suggested by Granpafishy and Marazota on GreyMind Quick Slotbar Comments.

As a matter of fact, each of the 8 GQSB Layout and Options Presets could also bring their specific (2..8) Items Preset.

What I can do quite well:
abilityName = GetSlotName ( slotIndex )
abilityIndex = GetSlotBoundId( slotIndex )
...meaning I can identify what's dropped on the Quick Bar by the user for the current preset.

What I could not do:
...that would/should equip some potion or other stuff supported by the Quick Slot Bar.
CallSecureProtected("SelectSlotAbility", abilityIndex, slotIndex)
...as, it looks like this is OK for weapons action bar and armor only.

What I would like to do:
...and that's the missing part to restore what's has been saved as an alternate preset.
Code:
-- REPLACE CURRENT (2..8) QUICK BAR SLOTS WITH A NEW SET
    for bNum = 1, QSB.ButtonCountMax do
        UnequipItem(              slotIndex) --> would unequip BAG_WORN instead of QDB
          EquipItem(BAG_BACKPACK, slotIndex) --> Error: "Item cannot be equipped"
    end
Maybe I'm simply missing some existing means to do the job.

If anyone has some clue about this, I'm ready to give it a try...
  Reply With Quote
07/08/17, 03:00 AM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
I am moving this to a different forum since what you ask for is already possible.

In order to assign an item to a quickslot, you can't use
Code:
SelectSlotAbility *protected* (*luaindex* _abilityIndex_, *luaindex* _slotIndex_)
Items are not abilities, so instead you need to use
Code:
SelectSlotItem *protected* (*integer* _bagId_, *integer* _bagSlotId_, *luaindex* _slotIndex_)
The quickslot indices also do not go from 1 to QSB.ButtonMaxCount. They are in the same space as the action bar slots and start at 9. But you do not need to know the actual numbers. Instead you can use the ACTION_BAR_FIRST_UTILITY_BAR_SLOT and ACTION_BAR_UTILITY_BAR_SIZE constants.

So what you want to do is the following:
Lua Code:
  1. for i = ACTION_BAR_FIRST_UTILITY_BAR_SLOT + 1, ACTION_BAR_FIRST_UTILITY_BAR_SLOT + ACTION_BAR_UTILITY_BAR_SIZE do
  2.     CallSecureProtected("ClearSlot", i)
  3.     CallSecureProtected("SelectSlotItem", bagId, slotId, i)
  4. end
  Reply With Quote
07/09/17, 08:28 AM   #3
ivanwfr
Join Date: Apr 2014
Posts: 9
Originally Posted by sirinsidiator View Post

Items are not abilities, so instead you need to use
Code:
SelectSlotItem *protected* (*integer* _bagId_, *integer* _bagSlotId_, *luaindex* _slotIndex_)
Thanks! That was what I was looking for! Not sure why I could not put my finger on it by myself...

The quickslot indices ...
...this is a non-issue as it had nothing to do with the real code, the idea was only about clearing and selecting some items-preset.

The only remaining issue is about this call with the slotId of an Item not currently available from the BAG_BACKPACK.
Code:
CallSecureProtected("SelectSlotItem", BAG_BACKPACK, slotId, slotIndex)
I was expecting it would be possible to get the Black and white texture we have when the item stack count is zero.

Instead, this call ends up with a warning message about how I can't slot an Item I don't currently have in my bag. (as if I were drag-and-dropping an Item coming from nowhere)
- Currently, the addon UI displays the texture saved the last time this Item was slotted.
- But the Quick Slot Bar ring entries remain empty.
- As soon as a missing Item appears to be available again to the ACTION_SLOT_UPDATED handler, the equip call can fill the hole.

Here is my pre-release Change log with a working solution thanks to your qualified advice:
Greymind Quick Slot Bar comments
  Reply With Quote
07/09/17, 09:08 AM   #4
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 659
Wouldn't you just clear the slot, add an additional check that the items you're trying to slot is in the inventory and if not, leave the slot blank?
  Reply With Quote
07/09/17, 10:20 AM   #5
ivanwfr
Join Date: Apr 2014
Posts: 9
Originally Posted by Rhyono View Post
Wouldn't you just clear the slot, add an additional check that the items you're trying to slot is in the inventory and if not, leave the slot blank?
At the moment, the idea is to show the whole set, regardless whether all items are present in the bag or not. But this is only one way to make it work for this first version.

Getting enough of each items would be a matter of purchase or farming. You can also get some from your Banker Assistant if you stored some there. This has to do with PvP vs. PvE potions or some other kind of quest related template.

But, as you suggest, leaving what's in there or clearing missing items slots means there may be more than a one way to deal with the situation.

For the current version, I'm relying on the user to know what he is doing... We'll see if someone has some sensible alternate logic to play with.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Quick Slot Bar Item Preset

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off