WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   DoTradeSkill == MassiveHeadache. (https://www.wowinterface.com/forums/showthread.php?t=1228)

Kaelten 07-11-05 08:12 AM

DoTradeSkill == MassiveHeadache.
 
Hey guys I've got an issue with aparticular function in wow's api


I'm trying to institue a queue for KCET and it kinda works.... kinda.

Has anyone experianced any quirks with DoTradeSkill()?

it seems to work the first and maybe the second time but then it just doesn't work again.


If anyone has any ideas please let me know.


Thanks much.

Beladona 07-11-05 09:21 AM

Haven't played with it too much, but wowwiki says you can use it as
DoTradeSkill(index, repeat); which I assume means you can specify the number of times to repeat the process. Is this not working?

Kaelten 07-11-05 08:58 PM

It does. but for some reasons when I try to use it again it won't work the second time until I trigger the reopening of the tradewindow.... sometimes it will work twice

i'm going to test it more now that I'm at home but if anyone else has any kinda feedback please let me know.

wellbeing 10-25-11 04:18 PM

Rezzing this thread. Solutions? Anyone?


Quote:

Originally Posted by Kaelten (Post 5810)
It does. but for some reasons when I try to use it again it won't work the second time until I trigger the reopening of the tradewindow.... sometimes it will work twice

i'm going to test it more now that I'm at home but if anyone else has any kinda feedback please let me know.


killerpet1986 10-25-11 05:37 PM

Quote:

Originally Posted by wellbeing (Post 246536)
Rezzing this thread. Solutions? Anyone?

Hi wellbeing,

what exactly is the problem you are having? If you describe it I may be able to help you.

Bear in mind that this requires a hardware event similar to spells so you cannot do this:

Code:

*Press a button*

DoTradeSkill()

*Delay*

DoTradeSkill() (Automatically)

What you need to do is this:

Code:

*Press a button*

DoTradeSkill()

*Press a button*

DoTradeSkill()


wellbeing 10-25-11 06:17 PM

I suppose that IS the answer in itself.

I'm trying to craft tons of a single item, refilling automatically from the mailbox and sending off the creations. It's on the second call to dotradeskill() that I'm getting the interface action error.

Is there no way around this?

eidt* keep in mind that this is for personal use only. i need not have it be user friendly.

Quote:

Originally Posted by killerpet1986 (Post 246539)
Hi wellbeing,

what exactly is the problem you are having? If you describe it I may be able to help you.

Bear in mind that this requires a hardware event similar to spells so you cannot do this:

Code:

*Press a button*

DoTradeSkill()

*Delay*

DoTradeSkill() (Automatically)

What you need to do is this:

Code:

*Press a button*

DoTradeSkill()

*Press a button*

DoTradeSkill()



SDPhantom 10-25-11 06:31 PM

I wrote a wrapper API to craft an item by the spell ID found in the recipe link. What it does is open the tradeskill briefly, block the actual tradeskill frame from showing, clear all filters, scan for the specific recipe by spell ID, then crafts any number of times. If the tradeskill doesn't exist or it's only to craft once, it automatically closes the tradeskill. If it's to craft multiple times, it'll wait until UPDATE_TRADESKILL_RECAST fires with GetTradeskillRepeatCount() returning 1. This happens even when crafting is interrupted.

Even though count is required to actually craft anything, it'll accept nil to just return whether the player had the recipe or not.

lua Code:
  1. local DoTradeSkillByID; do
  2.     function DoTradeSkillByID(trade,id,count)
  3. --      Prevent the TradeSkill UI from loading
  4.         UIParent:UnregisterEvent("TRADE_SKILL_SHOW");
  5.         UIParent:UnregisterEvent("TRADE_SKILL_CLOSE");
  6.  
  7. --      Trigger TradeSkill open
  8.         CastSpellByID(trade);
  9.  
  10. --      Clear all filters
  11.         SetTradeSkillInvSlotFilter(-1,1,1);
  12.         SetTradeSkillSubClassFilter(-1,1,1);
  13.         SetTradeSkillItemNameFilter("");
  14.         SetTradeSkillItemLevelFilter(0,0);
  15.         TradeSkillOnlyShowMakeable(false);
  16.         TradeSkillOnlyShowSkillUps(false);
  17.  
  18. --      Scan for recipe
  19.         local found,run=false,false;
  20.         for i=1,GetNumTradeSkills() do
  21.             local link=GetTradeSkillRecipeLink(i);
  22.             if link and tonumber(link:match("|Henchant:(%d+)|h"))==id then
  23.                 if count and not IsFlying() then
  24.                     SelectTradeSkill(i);--  This should help read the correct amount of repeats through UPDATE_TRADESKILL_RECAST
  25.                     DoTradeSkill(i,count);
  26.                     run=true;
  27.                 end
  28.                 found=true;
  29.                 break;
  30.             end
  31.         end
  32.  
  33. --      Trigger TradeSkill close
  34.         if not run or not count or count<=1 then CloseTradeSkill(); end
  35.  
  36. --      Restore events
  37.         UIParent:RegisterEvent("TRADE_SKILL_SHOW");
  38.         UIParent:RegisterEvent("TRADE_SKILL_CLOSE");
  39.  
  40.         return found;
  41.     end
  42.  
  43.     local eventframe=CreateFrame()
  44.     eventframe:RegisterEvent("UPDATE_TRADESKILL_RECAST");
  45.     eventframe:SetScript(self,event
  46.         if event=="UPDATE_TRADESKILL_RECAST" and GetTradeskillRepeatCount()<=1 and not (TradeSkillFrame and TradeSkillFrame:IsShown()) then
  47.             CloseTradeSkill();
  48.         end
  49.     );
  50. end

kamamir 03-30-20 06:25 AM

hello I have tried this code but this part shows an error

eventframe:SetScript(self,event
if event=="UPDATE_TRADESKILL_RECAST" and GetTradeskillRepeatCount()<=1 and not (TradeSkillFrame and TradeSkillFrame:IsShown()) then
CloseTradeSkill();
end
);

error : ')' expected near 'if'

I just started Lua programming, I tried to read about events and SetScript but didn't found the problem.

I tried ONUPDATE event but some how, some functions like CastSpell and DoTradeSkill does not work
btw i'm writing an Addon for 3.3.5a

I also could not use CastSpellByID, and I replaced it with CastSpell
I tried C_TimerAugment.lua but it did not work either

Seerah 03-30-20 11:08 AM

Discussion of Private Servers, in any manner other than theoretical, is completely against our rules. We are an Official Fan Site. We follow Blizzard's rules, on top of our own rules.

Threads requesting assistance with Private Servers get locked. Repeated postings get you banned.


All times are GMT -6. The time now is 06:17 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI