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
#1
Ok so hear is the first bit of code I am still working on it but I think I have all the effecting factors in there. I have put things in the way I think they should go, but I might be totally wrong. Have not got all the parts to work together quite yet. So please post if you have some impute.

K I am not getting any more errors but the code is still not working.

Code:
-- Author      : Adminirtsator
-- Create Date : 10/29/2009 1:31:07 PM

function ATK_ChatCommand(command)
   local a=strfind(command, "");
   local msg = strsub(command,a);
   local rand = math.random(1,100);
  
   if GHI_CountItem("Duskwolf_66914333") == 0
   then
      str = 0
   elseif GHI_CountItem("Duskwolf_66914333") == 1
   then
      str = 5
   elseif GHI_CountItem("Duskwolf_66914333") == 2
   then
      str = 10
   elseif GHI_CountItem("Duskwolf_66914333") == 3
   then
      str = 15
   elseif GHI_CountItem("Duskwolf_66914333") == 4
   then
      str = 20
   elseif GHI_CountItem("Duskwolf_66914333") >= 5
   then
      str = 25
   end
  
   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("LocalDefence - "..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
  
   if dis == true
   then
      if msg then    
         SendChatMessage("","EMOTE");
         if (index~=nil) then
            SendChatMessage("<- is disarmed and can not attack","CHANNEL", nil, index);
         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 stn == true
   then
      if msg then    
         SendChatMessage("","EMOTE");
         if (index~=nil) then
            SendChatMessage("<- is stuned and can not attack","CHANNEL", nil, index);
         end
      end
   end
  
   if stn == false or dis == false
   then
      if msg then    
         SendChatMessage("","EMOTE");
         if (index~=nil) then
            SendChatMessage("Attack Roll [(d100)"..rand.." + (Str)"..rts.." + (WS)"..ws.." (Buffs)+"..boa.."-"..rbc.." = "..atk.."]","CHANNEL", nil, index);
         end
      end
   end
end

SlashCmdList["ATK"] = ATK_ChatCommand;
SLASH_ATK1 = "/ATK";
SLASH_ATK2 = "/atk";
Reply
#2
What's the problem? You can attack while being stunned and disarmed?
Or is it entirely syntax related?
“Without deviation from the norm, progress is not possible.”
― Frank Zappa
Reply
#3
I think it is syntax related. But after writing all that out I got a bit tired so I need a brake.
Reply
#4
I don't know lua, but try == instead of =. I know in ruby the two are VERY different. One will return a boolean value, the other will set the variable.
Reply
#5
You know what I think you are very right I will give that a try
Reply
#6
Well it worked!
I updated the code and have fixed all the errors but it is still not working. Some varrialbe is most likely off. I will probly have to brake up the code into each of its parts to figure out what is wrong.

there is a lot of code ... hint hint
Reply
#7
Describe the problem in more detail and I'll take a look through the code.
Reply
#8
To tell the truth I don't know where that problem is I have to start debugging it.
Reply
#9
I have checked out all the code and it all works up to this point. This is really were I started guessing. But what I want is if they are stunned or disarmed that they get an error instead of a attack roll. This code is messy please if you have any tips let me know

Code:
local zone = GetZoneText();
  
   local index = GetChannelName("LocalDefence - "..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
  
   if dis == true
   then
      if msg then    
         SendChatMessage("","EMOTE");
         if (index~=nil) then
            SendChatMessage("<- is disarmed and can not attack","CHANNEL", nil, index);
         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 stn == true
   then
      if msg then    
         SendChatMessage("","EMOTE");
         if (index~=nil) then
            SendChatMessage("<- is stuned and can not attack","CHANNEL", nil, index);
         end
      end
   end
  
   if stn == false or dis == false
   then
      if msg then    
         SendChatMessage("","EMOTE");
         if (index~=nil) then
            SendChatMessage("Attack Roll [(d100)"..rand.." + (Str)"..rts.." + (WS)"..ws.." (Buffs)+"..boa.."-"..rbc.." = "..atk.."]","CHANNEL", nil, index);
         end
      end
   end
Reply
#10
Perhaps you could put together a guide to testing these scripts so we know what to do to test it
[Image: Ml7sNnX.gif]
Reply
#11
I think I could do that, but what I use mostly is WoWlua addon.

http://wow.curse.com/downloads/wow-addon...owlua.aspx
Reply
#12
Well what I meant was a guide that says how to implement these codes into a GHI and how to use them.
[Image: Ml7sNnX.gif]
Reply
#13
I will, but if you look here you can see the tools that I use to create this kind of code

http://www.conquestofthehorde.com/forum/...32&t=22673
Reply
#14
DuskWolf Wrote:I have checked out all the code and it all works up to this point. This is really were I started guessing. But what I want is if they are stunned or disarmed that they get an error instead of a attack roll. This code is messy please if you have any tips let me know

Code:
local zone = GetZoneText();
if stn == false or dis == false
   then
      if msg then    
         SendChatMessage("","EMOTE");
         if (index~=nil) then
            SendChatMessage("Attack Roll [(d100)"..rand.." + (Str)"..rts.." + (WS)"..ws.." (Buffs)+"..boa.."-"..rbc.." = "..atk.."]","CHANNEL", nil, index);
         end
      end
   end

Should'nt that or be an and? Otherwise, I think you'd get a roll if you were'nt stunned but were disarmed and vice versa
“Without deviation from the norm, progress is not possible.”
― Frank Zappa
Reply
#15
And you are right again good catch
Reply




Users browsing this thread: 1 Guest(s)