02-19-24, 10:32 PM | #1 |
Save location via SavedVariables
Code
Lua Code:
A separate code is just a button Lua Code:
At the moment, the button returns to the center when using the command /reload Did I redo it correctly? Lua Code:
Last edited by Hubb777 : 02-19-24 at 10:36 PM. |
|
02-19-24, 10:40 PM | #2 |
Blizz. will save the frame but if the user removes the addon for any reason, it will reset to the default location if they decide to install the addon again.
Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
02-19-24, 10:51 PM | #3 | |
|
||
02-20-24, 12:04 AM | #4 |
I missed the CreateFrame code for btn in the original post
For Blizz to save the position, the frame has to have a unique name. Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
02-20-24, 12:31 AM | #5 | |
Lua Code:
|
||
02-20-24, 01:05 AM | #6 |
I have no idea what code you're testing so, as a standalone example of a button that can be dragged and saved.
Lua Code:
You will have to move the pieces into your addon. Possibly just the btn:SetUserPlaced(true) and giving the button a name.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 02-20-24 at 01:10 AM. |
|
02-20-24, 03:37 AM | #7 | |
Lua Code:
|
||
02-20-24, 08:53 AM | #8 |
Some of that code is completely broken so I assumed you were posting example code and would make changes to the real code. You should be getting errors from BugGrabber/Bugsack . Install them if you haven't yet.
Code:
btn:SetScript("OnClick:, function(self, button, ...) Whereas Code:
btn:SetScript('OnDragStop', btn.StopMovingOrSizing) Here is the code with a print to fill in the OnClick, a fix that may or may not be what you intend for the OnDragStop script and I commented out the updateData() because addon.db isn't created in the code shown. Add it back if it is in another .lua file but the code as is should at least work for demonstrating the SetUserPlaced() saving the button position. Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 02-20-24 at 10:10 AM. |
|
02-20-24, 11:41 PM | #9 | |
Lua Code:
This code almost works. It saves the position of the button But the button does not display the table if I press the left mouse button. But if I press the left mouse button and shift and try to move the button, the table window turns on. What could be the problem? |
||
02-21-24, 12:31 AM | #10 |
Programs are stupid. You have to tell them exactly what you want. Maybe something like: (Left buton down, shift-key down = drag. right button = hide button. left button no shift-key toggle show/hide the frame (f))
Lua Code:
You possibly want a way to get the button back after it's hidden other than a /reaload but may not, it's not clear?
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 02-21-24 at 12:33 AM. |
|
02-21-24, 12:42 AM | #11 | |
Yes, it worked. The code works completely as intended. Thank you very much. I couldn't have done it without you.
If I solve the problem - how do I insert a link to an item in the text that is in the table, I will be able to make my first addon. https://www.wowinterface.com/forums/...ad.php?t=59796 |
||
02-21-24, 10:26 AM | #12 |
I've created this as an all-in-one example including an example addon.db where I've replaced the item name, icon and added the link for some random items (got rid of the icon texture in the frame as it's in the text, but but it's up to you how you organise the stuff).
Added two %s to each enUS string which gets replaced by the icon (size set to 20x20) and hyperlink when the text is set. Again, Example Code so, how you get/display the information for your addon will depend on the what/when of the addons workings. Added a check in the slash command so if you type /hubb btn it will toggle the button Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 02-21-24 at 02:28 PM. |
|
02-21-24, 11:11 PM | #13 | |
table.lua Lua Code:
db.lua Lua Code:
Last edited by Hubb777 : 02-21-24 at 11:16 PM. |
||
02-21-24, 11:30 PM | #14 | |
You removed the option to show/hide the button from the slash command (or at least didn't copy the SlashCmdList["HUBB"] = function(msg) code from my example. Your latest code contains a function GetItemLinkById I have no idea what it is or where it's from but it's not Blizz and it's not defined in anything you've posted so colour me confused that it works at all.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
||
02-22-24, 12:02 AM | #15 | |
Lua Code:
I was assured that it would work in GetItemLinkById. But it looks like we just didn't understand each other. Lua Code:
Your code works 100%. But it displays the items in the chat, rather than displaying a table. And it is the table that I need. An example where instead of {item:194701} there is a link to the item. |
||
02-22-24, 12:43 AM | #16 | ||
Delete the lines Lua Code:
(You can delete the OnHyperlinkEnter function as well) Change the OnHyperlinkClick function to: Lua Code:
The other possabilty is you want the click to open the item tooltip rather than doing it OnEnter in which case, the the OnHyperlinkClick function would be: Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 02-22-24 at 01:15 AM. |
|||
02-22-24, 03:10 AM | #17 | |
https://www.wowinterface.com/forums/...ad.php?t=59796 Here is a table (picture 1) I want to be able to add a link to an item in the description of the text, anywhere in the text. I did this in photo editor GIMP (it turned out a little crooked) |
||
02-22-24, 09:45 AM | #18 |
You still don't say what you want to see when a link is clicked so, using the code you linked and guessing you just want to see the item tooltip when a link is clicked:
The item field added to each entry in addon.db is the (random because I don't know that acual) item ID that will be the link/tooltip (replacing the %s in each announce.enUS field). db.lua file Lua Code:
Lua Code file: Lua Code:
To show/hide the button: Code:
/hubb btn
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 02-22-24 at 12:34 PM. |
|
02-22-24, 11:23 PM | #19 | |
I set the localization lines correctly, did I do everything right? Lua Code:
|
||
02-23-24, 12:15 AM | #20 |
That looks OK.
The only thing is that you have a deDE for a only one entry in addon.db where Code:
tinsert(data, {item.announce[GetLocale()], item.icon, item.name}) Have Fun!
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 02-23-24 at 12:21 AM. |
|
WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Save location via SavedVariables |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|