Go to Page... |
Thread Tools | Display Modes |
08-18-17, 07:07 PM | #1 |
Macro button inside bag, and still can be opened in combat
Hello
So i have my edited version of Stuffing bags. I have added 3 buttons inside it for depositing regents, 2x sort options and a button to use any artifact power items in the bags. Since macro button needs "SecureActionButtonTemplate", the bags can't be opened during combat. Any good sugestion on how to fix this? It's fine if the buttons can't be used during combat, just as longe the bags will open. Lua Code:
|
|
08-18-17, 07:33 PM | #2 |
The real question is why you're using SecureActionButtonTemplate in the first place since the commands you're using in those macros are not secure.
Just write the code directly in an OnClick script instead. |
|
08-18-17, 07:47 PM | #3 |
Maybe im just tired here but, not sure how to make it for the code with 2 macros for using the artifact items.
|
|
08-18-17, 07:51 PM | #4 |
It's simple really, just call UseContainerItem(bag, slot) directly in your script. Some functions are protected, yes, but some are only protected in the sense that they need to come from a hardware event. Calling the function inside an OnClick script means that you clicked on the button with your mouse to use it, so it should be okay.
|
|
08-18-17, 08:00 PM | #5 | |
Mainly used OnClick to use toggle frames like ToggleAchievementFrame() |
||
08-18-17, 08:03 PM | #6 |
By the way, bags can have up to 36 slots, not 32. Even so, you're better off using a dynamic approach when looping through the bags.
Lua Code:
|
|
08-18-17, 08:33 PM | #7 | |
Lua Code:
|
||
08-18-17, 09:01 PM | #8 |
Lua Code:
If that doesn't work, just inherit your button from ContainerFrameItemButtonTemplate and set the IDs in a PreClick script and use the inherited OnClick. That requires the parent of your button to have the bag ID and the button itself to have the slot ID. Bag buttons are not protected, but if you're getting a taint error it just means that the call to UseContainerItem needs to come from an untainted function. Lua Code:
Last edited by MunkDev : 08-18-17 at 09:31 PM. |
|
08-19-17, 04:10 AM | #9 | |
Seems like i need to use preclick, the first one triggered protected code. Never used preclick before. Behaves a bit strange, left click picks up the item and right click uses the item and there is no tooltip showing. Can it be changed to both show tooltip and also have anyclick use the items instead of picking it up? Lua Code:
|
||
08-20-17, 04:33 AM | #10 |
If you haven't already, download the source code and you can look at these things by examining the templates.
The OnClick function (ContainerFrameItemButton_OnClick) uses LeftButton for pickups and any other button for usage. To my knowledge, you can't fake which button is pressed without an override binding, so you might be stuck with right clicking. As for displaying tooltips, look at ContainerFrameItemButton_OnEnter and ContainerFrameItemButton_OnLeave. |
|
08-20-17, 06:57 AM | #11 | |
Yes, i think so to. I just add RegisterForClicks("RightButtonUp") to stop left click. As for the tooltip, i simply can't get it to show more then a second. I guess this have something todo with the "PreClick" |
||
08-20-17, 08:32 AM | #12 |
You should probably do the ID calculations OnEnter or OnUpdate instead if you want to show the tooltip. The tooltip is not going to show up if you're assigning the IDs when you're clicking the button.
Also, it's a good idea to set the IDs to an empty or invalid slot whenever you don't have any AP items, so you don't accidentally click on some other item that occupies a slot that was previously assigned in your script. |
|
08-20-17, 02:47 PM | #13 |
Not trying to show the tooltip for the item, but the text that i have defined. And it shows for a second everytime i move mouse over it.
But, it's working at thats the most important thing |
|
08-20-17, 03:42 PM | #14 |
The item button template has a default OnUpdate script to keep updating the item tooltip every X seconds. You need to remove that script.
|
|
WoWInterface » Developer Discussions » Lua/XML Help » Macro button inside bag, and still can be opened in combat |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|