The following warnings occurred:
Warning [2] Undefined variable $search_thread - Line: 60 - File: showthread.php(1617) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1617) : eval()'d code 60 errorHandler->error_callback
/showthread.php 1617 eval
Warning [2] Undefined variable $forumjump - Line: 89 - File: showthread.php(1617) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1617) : eval()'d code 89 errorHandler->error_callback
/showthread.php 1617 eval




IRC Code - /atk code
#16
Woot! I got it to work all it was, was one variable was backward rts instead of str.

Well it looks like this slash command is done! I have a lot more to do but if any one would like to use this as a template and help me make more of the slash commands I would be very grateful

Spoiler:
Code:
function ATK_ChatCommand(command)
   local a=strfind(command, "");
   local emo = strsub(command,a);
   local rand = math.random(1,100);
  
   if GHI_CountItem("Duskwolf_66914333") == 0
   then
      strt = 0
   elseif GHI_CountItem("Duskwolf_66914333") == 1
   then
      strt = 5
   elseif GHI_CountItem("Duskwolf_66914333") == 2
   then
      strt = 10
   elseif GHI_CountItem("Duskwolf_66914333") == 3
   then
      strt = 15
   elseif GHI_CountItem("Duskwolf_66914333") == 4
   then
      strt = 20
   elseif GHI_CountItem("Duskwolf_66914333") >= 5
   then
      strt = 25
   end
  
  
   if UnitRace("player") == "Orc"
   then
      strr = 5
   elseif UnitRace("player") == "Tauren"
   then
      strr = 10
   elseif UnitRace("player") == "Troll"
   then
      strr = 0
   elseif UnitRace("player") == "Undead"
   then
      strr = 0
   elseif UnitRace("player") == "Blood elf"
   then
      strr = 0
   elseif UnitRace("player") == "Human"
   then
      strr = 0
   elseif UnitRace("player") == "Dwarf"
   then
      strr = 5
   elseif UnitRace("player") == "Gnome"
   then
      strr = 0
   elseif UnitRace("player") == "Night Elf"
   then
      strr = 0
   elseif UnitRace("player") == "Draenei"
   then
      strr = 5
   end
  
   local str = strr+strt
  
  
   if GetInventoryItemTexture("player", 5) == nil
   then
      cht = 0
   elseif
   GetInventoryItemTexture("player", 5) ~= nil
   then
      if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ChestSlot")))})[7]=="Cloth"
      then
         cht =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ChestSlot")))})[7]=="Leather"
      then
         cht =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ChestSlot")))})[7]=="Mail"
      then
         cht =1
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ChestSlot")))})[7]=="Plate"
      then
         cht = 2
        
      end
   end
  
  
   if GetInventoryItemTexture("player", 3) == nil
   then
      shd = 0
   elseif
   GetInventoryItemTexture("player", 3) ~= nil
   then
      if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ShoulderSlot")))})[7]=="Cloth"
      then
         shd =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ShoulderSlot")))})[7]=="Leather"
      then
         shd =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ShoulderSlot")))})[7]=="Mail"
      then
         shd =1
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ShoulderSlot")))})[7]=="Plate"
      then
         shd = 2
      end
   end
  
  
   if GetInventoryItemTexture("player", 1) == nil
   then
      hed = 0
   elseif
   GetInventoryItemTexture("player", 1) ~= nil
   then
      if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HeadSlot")))})[7]=="Cloth"
      then
         hed =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HeadSlot")))})[7]=="Leather"
      then
         hed =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HeadSlot")))})[7]=="Mail"
      then
         hed = 1
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HeadSlot")))})[7]=="Plate"
      then
         hed = 2
      end
   end
  
  
   if GetInventoryItemTexture("player", 7) == nil
   then
      leg = 0
      
   elseif
   GetInventoryItemTexture("player", 7) ~= nil
   then
      if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("LegsSlot" )))})[7]=="Cloth"
      then
         leg =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("LegsSlot" )))})[7]=="Leather"
      then
         leg =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("LegsSlot" )))})[7]=="Mail"
      then
         leg = 1
        
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("LegsSlot" )))})[7]=="Plate"
      then
         leg = 2
      end
   end
  
   if GetInventoryItemTexture("player", 10) == nil
   then
      hnd = 0
   elseif
   GetInventoryItemTexture("player", 10) ~= nil
   then
      if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HandsSlot" )))})[7]=="Cloth"
      then
         hnd =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HandsSlot" )))})[7]=="Leather"
      then
         hnd =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HandsSlot" )))})[7]=="Mail"
      then
         hnd = 1
        
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HandsSlot" )))})[7]=="Plate"
      then
         hnd = 2
      end
   end
  
   if GetInventoryItemTexture("player", 8) == nil
   then
      fet = 0
   elseif
   GetInventoryItemTexture("player", 8) ~= nil
   then
      if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("FeetSlot" )))})[7]=="Cloth"
      then
         fet =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("FeetSlot" )))})[7]=="Leather"
      then
         fet =0
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("FeetSlot" )))})[7]=="Mail"
      then
         fet = 1
        
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("FeetSlot" )))})[7]=="Plate"
      then
         fet = 2
      end
   end
  
  
   local ah = cht+shd+hed+leg+hnd+fet;
  
   if GetInventoryItemTexture("player", 13) == nil
   then
      mws = 7
   elseif
   GetInventoryItemTexture("player", 13) ~= nil
   then
      if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="One-Handed Maces"
      then
         mws = 3
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="One-Handed Axes"
      then
         mws = 4    
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="One-Handed Swords"
      then
         mws = 5
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Staves"
      then
         mws = 5
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Polearms"
      then
         mws = 5
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Fist Weapons"
      then
         mws = 7
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Daggers"
      then
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Two-Handed Axes"
      then
         mws = 4
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Two-Handed Maces"
      then
         mws = 3
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Two-Handed Swords"
      then
         mws = 5
      end
   end
  
   if GetInventoryItemTexture("player", 14) == nil
   then
      ows = 7
   elseif
   GetInventoryItemTexture("player", 14) ~= nil
   then
      if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="One-Handed Maces"
      then
         ows = 3
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="One-Handed Axes"
      then
         ows = 4    
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="One-Handed Swords"
      then
         ows = 5
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Staves"
      then
         ows = 5
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Polearms"
      then
         ows = 5
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Fist Weapons"
      then
         ows = 7
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Daggers"
      then
         ows = 6
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Two-Handed Axes"
      then
         ows = 4
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Two-Handed Maces"
      then
         ows = 3
      elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Two-Handed Swords"
      then
         ows = 5
      end
   end
   local ws = mws+ows
  
   boab = false;
   for i = 1,#(GHI_BuffList) do
      if type(GHI_BuffList[i])=="table" then
         if GHI_BuffList[i].name == "Blessing of Attack" then
            boab  = true;
         end
      end
   end
  
   if boab == true
   then
      boa = 10
   end
  
   if boab == false
   then
      boa = 0
   end
  
   rbcb = false;
   for i = 1,#(GHI_BuffList) do
      if type(GHI_BuffList[i])=="table" then
         if GHI_BuffList[i].name == "Rune Blade Curse" then
            rbcb  = true;
         end
      end
   end
  
   if rbcb == true
   then
      rbc = 10
   end
  
   if rbcb == false
   then
      rbc = 0
   end
  
   local atk = rand+str+ws-ah+boa-rbc ;
  
   local zone = GetZoneText();
  
   local index = GetChannelName("LocalDefense - "..zone.."")
  
  
   dis = false;
   for i = 1,#(GHI_BuffList) do
      if type(GHI_BuffList[i])=="table" then
         if GHI_BuffList[i].name == "Disarmed" then
            dis  = true;
         end
      end
   end
  
  
   stn = false;
   for i = 1,#(GHI_BuffList) do
      if type(GHI_BuffList[i])=="table" then
         if GHI_BuffList[i].name == "Stuned" then
            stn  = true;
         end
      end
   end
  
  
   if emo then    
      SendChatMessage(""..emo.."","EMOTE");
      if (index~=nil) then
         if stn == false and dis == false
         then
            SendChatMessage("Attack Roll [(d100)"..rand.." + (Str)"..str.." + (WS)"..ws.." (Buffs)+"..boa.."-"..rbc.." = "..atk.."]","CHANNEL", nil, index);
         elseif stn == true
         then
            SendChatMessage("<- is stuned and can not attack","CHANNEL", nil, index);
         elseif dis == true
         then
            SendChatMessage("<- is disarmed and can not attack","CHANNEL", nil, index);
         end
        
      end
   end
  
  
   local n = "";
   local i = 1;
   while n ~= nil do
      if type(GHI_BuffList[i]) == "table" then
         n = GHI_BuffList[i].name;
      else
         n = nil;
      end
      if n == "Stuned" then
         RemoveGHIBuff(i, "HELPFUL");
      end
      i=i+1;
   end
  
   local m = "";
   local j = 1;
   while m ~= nil do
      if type(GHI_BuffList[j]) == "table" then
         m = GHI_BuffList[j].name;
      else
         m = nil;
      end
      if m == "Disarmed" then
         RemoveGHIBuff(j, "HELPFUL");
      end
      j=j+1;
   end
  
   local o = "";
   local k = 1;
   while o ~= nil do
      if type(GHI_BuffList[k]) == "table" then
         o = GHI_BuffList[k].name;
      else
         o = nil;
      end
      if  o == "Blessing of Attack" then
         RemoveGHIBuff(k, "HELPFUL");
      end
      k=k+1;
   end
  
  
   local p = "";
   local l = 1;
   while p ~= nil do
      if type(GHI_BuffList[l]) == "table" then
         p = GHI_BuffList[l].name;
      else
         p = nil;
      end
      if p == "Rune Blade Curse" then
         RemoveGHIBuff(l, "HELPFUL");
      end
      l=l+1;
   end
  
  
  
end




SlashCmdList["ATK"] = ATK_ChatCommand;
SLASH_ATK1 = "/ATK";
SLASH_ATK2 = "/atk";
Reply




Users browsing this thread: 1 Guest(s)