Quantcast Help with making my addon (WoW classic) - WoWInterface
Thread Tools Display Modes
03-30-20, 05:35 AM   #1
awildgoose11
A Defias Bandit
Join Date: Mar 2020
Posts: 2
Help with making my addon (WoW classic)

Hello, I am VERY new to addon programming but I wanted to make a simple one that dismounts your character if you right click on an ore vein while mounted. Here is what I made, (it doesn't seem to be working) any help would be appreciated. (WoW Classic btw)

Code:
local f = CreateFrame("Frame",nil,UIParent)
f:SetWidth(4000) 
f:SetHeight(4000)
f:SetPoint("CENTER",0,0)
while(1=1)
do
   local u = UnitName("mouseover");
f:SetScript("OnClick", function (self, button, down)
 if (button = "RightButton" and down = true and u = "Tin Vein" or u = "Iron Deposit" or u = "Mithril Vein" or u = "Copper Vein" or u = "Gold Vein" or u = "Truesilver Vein" or u = "Thorium Vein" or u = "Dark Iron Vein" or u = "Elementium Vein" or u = "Snall Obsidian Chunk" or u = "Large Obsidian Chunk") then
 Dismount();	
end
end
end
Again the goal is to dismount when an ore is right clicked. Thanks.
  Reply With Quote
03-30-20, 06:14 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,444
UnitName won't work on deposits. They are for units like player, target, pet, party1, raid1 etc. Deposits are not any of these.

It is unlikely that there is an automated way of doing this as the moment you try to mine while mounted it will report that you are mounted.

Of course there is a chance that there is a way but it will likely be based on creating a button that Dismounts() and then carries out the Mining action ( if that can be scripted/macro'd ). Seeing as the dismount process isn't instant it may fail the mining action anyway.

So, simplest action, is to just dismount and then do some mining. Then mount up again when finished.
__________________
  Reply With Quote
03-30-20, 06:18 AM   #3
awildgoose11
A Defias Bandit
Join Date: Mar 2020
Posts: 2
Ahh OK I see, thanks for the info. Hopefully it will be possible in the future!

(Mods close this thread please)
  Reply With Quote
03-30-20, 11:11 AM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,721
You can check for when you get the mounted error and then dismount. But this addon is already made for you:
https://www.wowinterface.com/downloa...oDismount.html
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
03-30-20, 11:19 AM   #5
HydraWoW
A Kobold Labourer
AddOn Author - Click to view addons
Join Date: Aug 2019
Posts: 1
You can use the event UI_ERROR_MESSAGE for this case! I have a script on classic that auto dismounted when attacking or opening a flight path up, but I can't recall if it handled the case of mining or not as well. I don't have a sub active for WoW currently, but looking at this (or what Seerah posted) might help you get a start

Pastebin link
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Help with making my addon (WoW classic)

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