Jump to content

HELP PLZ WITH SCRIPT


  • Please log in to reply
3 replies to this topic

#1 Tantix

Tantix
  • Members
  • Posts: 11

Posted 09 March 2013 - 12:43 AM

alright this is really directed at THAYA  but if anyone else can help that would be great..
why is this script giving me an error such as

this addon has been blocked form an action only available to the blizzard ui.
You can disable this addon and reload ui.



local f = CreateFrame("Frame")
local function Update(self, event, ...)
local RECUP = GetSpellInfo(73651)
local SLICE = GetSpellInfo(5171)
if event == "PLAYER_ENTERING_WORLD" then
                Frame="Frame";CreateFrame=CreateFrame;Border="Border"
                REC=CreateFrame(Frame)REC.c=CreateFrame("Cooldown","RC",REC.t)REC.c:SetAllPoints(REC)
                REC:SetPoint("BOTTOMRIGHT",PlayerFrame,-3,6)REC:SetSize(26,26)REC.t=REC:CreateTexture(nil,Border)
                REC.t:SetAllPoints()REC.t:SetTexture("Interface\\Icons\\ability_rogue_recuperate")
                SND=CreateFrame(Frame)SND.c=CreateFrame("Cooldown","SN",SND.t)SND.c:SetAllPoints(SND)
                SND:SetPoint("BOTTOMRIGHT",PlayerFrame,-29,6)SND:SetSize(26,26)SND.t=SND:CreateTexture(nil,Border)
                SND.t:SetAllPoints()SND.t:SetTexture("Interface\\Icons\\ability_rogue_slicedice")
end
if event == "UNIT_AURA" then
local maxx = 0
local _, name, d, D, x
for i = 1, 40 do
name, _, icon, _, _, d, x = UnitBuff("player", i)
if not name then break end
                if name == RECUP then
  maxx = x
  D
= d
  
if D > 0 then
RC:SetCooldown(maxx - D - 0.5, D)
  end  
elseif name
== SLICE then
  maxx
= x
  D
= d
                  
if D > 0 then
SN:SetCooldown(maxx-D - 0.5,D)
  
end              
end
end
end
end
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("UNIT_AURA")
f:SetScript("OnEvent", Update)
Any help would be greatly appreciated thanks :D

#2 Vadrak

Vadrak
  • Premium
  • Curse Premium
  • Posts: 21

Posted 09 March 2013 - 02:10 PM

Hm, I've checked the functions you are using and none of them seems to be a protected function, which normally is the reason for this kind of error. The only things that I could imagine to be a problem are the following lines:

Frame="Frame";CreateFrame=CreateFrame;Border="Border"

I have to admit that I don't quite understand what you want to achieve with that line. Could it be that you forgot a "local" in front of the CreateFrame =  and that you wanted to create a local copy of the CreateFrame function?

SetPoint("BOTTOMRIGHT",PlayerFrame,-29,6)
Another problem could be that you are anchoring your frames to the PlayerFrame, which is a secure and protected frame. Have you tested simply anchoring the two frames to UIParent instead? Because spreading taint to blizzard frames is rather easy these days.
Try out the following: Type "/run print(issecurevariable("PlayerFrame"))" in your chat. If it returns "1 nil" then this shouldn't be a problem, but If it says "nil <YourAddOnName>" (I guess you are using a addon to run your script)  then your script is causing the PlayerFrame to be corrupted and therefore it is not allowed to execute certain functions anymore, which again explains why WoW thinks your addon is using protected functions.

REC.c=CreateFrame("Cooldown","RC",REC.t)
Here you are setting "REC.t" as a parent for REC.c, although REC.t is created after it. This shouldn't cause the problem with the protected function, but it would cause your cooldown to have no parent, if I'm not mistaken because "REC.t" is "nil" at this moment of the script. Also REC.t is a texture and therefore can't have frames as children. Use REC instead. :)

Quote

why would u ever cast holy fire instead of mindspike?

Quote

i like shooting thunderbolts from the sky at my enemies just like my pikachu
Twitter: @VadrakAL

#3 Askin

Askin
  • Junkies
  • Humanclass_name
  • EU-Blackrock
  • Glutsturm / Emberstorm
  • Posts: 214
  • Talents: Marksmanship
  • RBG: 2233

Posted 09 March 2013 - 04:09 PM

View PostTantix, on 09 March 2013 - 12:43 AM, said:

this addon has been blocked form an action only available to the blizzard ui.
You can disable this addon and reload ui.

Would you mind telling me when the error occurs? Since i can't reproduce it and your code seems to do what it should.

edit: nvm, found it. here's the fixed code:

local f = CreateFrame("Frame")
local function Update(self, event, ...)
local RECUP = GetSpellInfo(73651)
local SLICE = GetSpellInfo(5171)
if event == "PLAYER_ENTERING_WORLD" then
local Frame="Frame";
local CreateFrame=CreateFrame;
local Border="Border"
			 REC=CreateFrame(Frame)REC.c=CreateFrame("Cooldown","RC",REC.t)REC.c:SetAllPoints(REC)
			 REC:SetPoint("BOTTOMRIGHT",PlayerFrame,-3,-5)REC:SetSize(26,26)REC.t=REC:CreateTexture(nil,Border)
			 REC.t:SetAllPoints()REC.t:SetTexture("Interface\\Icons\\ability_rogue_recuperate")
			 SND=CreateFrame(Frame)SND.c=CreateFrame("Cooldown","SN",SND.t)SND.c:SetAllPoints(SND)
			 SND:SetPoint("BOTTOMRIGHT",PlayerFrame,-29,-5)SND:SetSize(26,26)SND.t=SND:CreateTexture(nil,Border)
			 SND.t:SetAllPoints()SND.t:SetTexture("Interface\\Icons\\ability_rogue_slicedice")
end
if event == "UNIT_AURA" then
local maxx = 0
local _, name, d, D, x
for i = 1, 40 do
name, _, icon, _, _, d, x = UnitBuff("player", i)
if not name then break end
			 if name == RECUP then
maxx = x
D = d
if D > 0 then
RC:SetCooldown(maxx - D - 0.5, D)
end
elseif name == SLICE then
maxx = x
D = d
				 if D > 0 then
SN:SetCooldown(maxx-D - 0.5,D)
end			
end
end
end
end
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("UNIT_AURA")
f:SetScript("OnEvent", Update)

Edited by Askin, 09 March 2013 - 05:30 PM.


#4 Tantix

Tantix
  • Members
  • Posts: 11

Posted 12 March 2013 - 07:00 AM

thank you so much for the help guys :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

<