Page 1 of 1
Casting Checker for instance
Posted: Fri Aug 23, 2013 6:38 am
by Draakje
I don't know if it has been alrdy made, or something exists, but trying to make a casting checker from bosses. So it anounces party while boss is casting a nasty skill, so all can react quick :d
Got this so far, and it not working
Code: Select all
local disabled = false -- Starting value
SLASH_BossBuff1 = "/BossBuffer"
SLASH_BossBuff2 = "/BB" -- Add as many variations as you like just increment the number
SlashCmdList["BossBuff"] = function(editBox, msg)
if msg then
msg = string.lower(msg)
if msg == "on" then -- on
disabled = false
elseif msg == "off" then -- off
disabled = true
else
disabled = not disabled -- Toggles addon if 'on' or 'off' is not used.
end
if disabled then
SendSystemChat("BossBuff is disabled")
SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "party")
else
SendSystemChat("BossBuff is enabled")
SendChatMessage("|H|h|cff16DC07BossBuff Checker has been activated|h", "party")
end
end
end
local BossBuff = {} -- the AddOn namespace, all your functions should be placed inside here instead of as globals.
_G.BossBuff = BossBuff -- expose it to the global scope
function BossBuff.VN()
if (Casting("target", "Tearing Claw Attack") == true) then
SendChatMessage("|H|h|cffFCF802Lyong is casting Tearing Claw Attack!!|h", "party")
end
if (Casting("target", "Rune Pulse") == true) then
SendChatMessage("|H|h|cffFCF802Player is casting rune pulse!!|h", "say")
end
end;
-- Searches the target for a specified debuff.
-- Use "player", "target", "party3", "raid1" etc. for tgt parameter.
function Casting(tgt,CastingName)
local counter=1
local currentcasting="none"
while currentcasting ~= nil do
currentcasting=UnitCasting(tgt,counter)
if currentcasting ~= nil then
if string.find(string.lower(currentcasting),string.lower(CastingName)) then
return true
else
counter=counter+1
end
end
end
return false
end
local time_remaining = 0.5 -- in seconds
function BossBuff:OnUpdate(elapsed)
if disabled == true then
return
end
-- elapsed is the amount of time in seconds since the last frame tick
time_remaining = time_remaining - elapsed
if time_remaining > 0 then
-- cut out early, we're not ready yet
return
end
time_remaining = 0.5 -- reset to 2
end
Re: Casting Checker for instance
Posted: Fri Aug 23, 2013 6:43 am
by Draakje
changed
Code: Select all
if (Casting("target", "Rune Pulse") == true) then
SendChatMessage("|H|h|cffFCF802Player is casting rune pulse!!|h", "say")
end
quick to
Code: Select all
if (Casting("player", "Rune Pulse") == true) then
SendChatMessage("|H|h|cffFCF802Player is casting rune pulse!!|h", "say")
end
hope i can see if works now, as testing
Re: Casting Checker for instance
Posted: Fri Aug 23, 2013 6:49 am
by Draakje
well maybe it doesnt work, if im casting. Need find a mob or low boss to give a try out
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 7:47 am
by Draakje
Code: Select all
local disabled = false -- Starting value
SLASH_BossBuff1 = "/BossBuffer"
SLASH_BossBuff2 = "/BB" -- Add as many variations as you like just increment the number
SlashCmdList["BossBuff"] = function(editBox, msg)
if msg then
msg = string.lower(msg)
if msg == "on" then -- on
disabled = false
elseif msg == "off" then -- off
disabled = true
else
disabled = not disabled -- Toggles addon if 'on' or 'off' is not used.
end
if disabled then
SendSystemChat("BossBuff is disabled")
SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "party")
else
SendSystemChat("BossBuff is enabled")
SendChatMessage("|H|h|cff16DC07BossBuff Checker has been activated|h", "party")
end
end
end
local BossBuff = {} -- the AddOn namespace, all your functions should be placed inside here instead of as globals.
_G.BossBuff = BossBuff -- expose it to the global scope
function BossBuff.VN()
if (OnCast("target", "Tearing Claw Attack") == true) then
SendChatMessage("|H|h|cffFCF802Lyong is casting Tearing Claw Attack!!|h", "party")
end
if (OnCast("target", "Heal") == true) then
SendChatMessage("|H|h|cffFCF802Player is casting heal!!|h", "say")
end
end;
-- Searches the target for a specified debuff.
-- Use "player", "target", "party3", "raid1" etc. for tgt parameter.
function OnCast(tgt,CastingName)
local counter=1
local Casting="none"
while Casting ~= nil do
Casting=UnitCasting(tgt,counter)
if Casting ~= nil then
if string.find(string.lower(Casting),string.lower(CastingName)) then
return true
else
counter=counter+1
end
end
end
return false
end
local time_remaining = 0.5 -- in seconds
function BossBuff:OnUpdate(elapsed)
if disabled == true then
return
end
-- elapsed is the amount of time in seconds since the last frame tick
time_remaining = time_remaining - elapsed
if time_remaining > 0 then
-- cut out early, we're not ready yet
return
end
time_remaining = 0.5 -- reset to 2
end
also not working, someone knows the correct function?
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 8:31 am
by rock5
Your onupdate function does nothing. Isn't it supposed to call the "BossBuff.VN()" function"?
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 9:04 am
by Draakje
u mean?
Code: Select all
local time_remaining = 0.5 -- in seconds
function BossBuff.VN():OnUpdate(elapsed)
if disabled == true then
return
end
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 9:24 am
by rock5
No.
This is what your code does at the moment. After you enable it with a slash command
every 0.5 seconds the onupdate function resets the time_remaining variable. It does nothing else. The BossBuff.VN() function, which seems to do the work, never gets called. So I think the onupdate function is supposed to call it every 0.5 seconds. So where is says
Code: Select all
time_remaining = 0.5 -- reset to 2
add the line
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 9:32 am
by Draakje
Wrong place.
Code: Select all
local time_remaining = 0.5 -- in seconds
function BossBuff:OnUpdate(elapsed)
if disabled == true then
return
end
-- elapsed is the amount of time in seconds since the last frame tick
time_remaining = time_remaining - elapsed
if time_remaining > 0 then
-- cut out early, we're not ready yet
return
end
time_remaining = 0.5 -- reset to 2
BossBuff.VN()
end
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 10:59 am
by Draakje
Trying with:
Code: Select all
local disabled = false -- Starting value
SLASH_BossBuff1 = "/BossBuffer"
SLASH_BossBuff2 = "/BB" -- Add as many variations as you like just increment the number
SlashCmdList["BossBuff"] = function(editBox, msg)
if msg then
msg = string.lower(msg)
if msg == "on" then -- on
disabled = false
elseif msg == "off" then -- off
disabled = true
else
disabled = not disabled -- Toggles addon if 'on' or 'off' is not used.
end
if disabled then
SendSystemChat("BossBuff is disabled")
SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "party")
else
SendSystemChat("BossBuff is enabled")
SendChatMessage("|H|h|cff16DC07BossBuff Checker has been activated|h", "party")
end
end
end
local BossBuff = {} -- the AddOn namespace, all your functions should be placed inside here instead of as globals.
_G.BossBuff = BossBuff -- expose it to the global scope
function BossBuff.VN()
if (OnCast("target", "Tearing Claw Attack") == true) then
SendChatMessage("|H|h|cffFCF802Lyong is casting Tearing Claw Attack!!|h", "party")
end
if (OnCast("target", "Black Flame") == true) then
SendChatMessage("Black Flame!!!", "party")
end
end;
-- Searches the target for a specified debuff.
-- Use "player", "target", "party3", "raid1" etc. for tgt parameter.
function OnCast(tgt,CastingName)
local counter=1
local Casting="none"
while Casting ~= nil do
Casting=UnitCasting(tgt,counter)
if Casting ~= nil then
if string.find(string.lower(Casting),string.lower(CastingName)) then
return true
else
counter=counter+1
end
end
end
return false
end
local time_remaining = 0.5 -- in seconds
function BossBuff:OnUpdate(elapsed)
if disabled == true then
return
end
-- elapsed is the amount of time in seconds since the last frame tick
time_remaining = time_remaining - elapsed
if time_remaining > 0 then
-- cut out early, we're not ready yet
return
end
time_remaining = 0.5 -- reset to 2
BossBuff.VN()
end
the on and off slash commands works, but when the boss is casting like Black Flame its not announcing my party chat :/
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 11:15 am
by Draakje
on rom wiki i find some functions:
CastingBarFrame_OnEvent
CastingBarFrame_OnLoad
CastingBarFrame_OnUpdate
Event:CASTING_START
maybe have use on of these?
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 11:29 am
by rock5
Maybe "party" is supposed to be capital, example
Code: Select all
SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "PARTY")
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 11:33 am
by Draakje
rock5 wrote:Maybe "party" is supposed to be capital, example
Code: Select all
SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "PARTY")
the on - off function works, and also gets anounced in party chat, that part is written with small letters "party"
trying out function SpellCast now hope this works
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 11:37 am
by Draakje
dam whats the right function to check the boss casting
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 1:46 pm
by rock5
Where are you getting these function names from? Are you making them up? Try
http://runesofmagic.gamepedia.com/API:UnitCastingTime
Re: Casting Checker for instance
Posted: Sun Aug 25, 2013 2:51 pm
by Draakje
they come from rom wiki too
so try this?
Code: Select all
local disabled = false -- Starting value
SLASH_BossBuff1 = "/BossBuffer"
SLASH_BossBuff2 = "/BB" -- Add as many variations as you like just increment the number
SlashCmdList["BossBuff"] = function(editBox, msg)
if msg then
msg = string.lower(msg)
if msg == "on" then -- on
disabled = false
elseif msg == "off" then -- off
disabled = true
else
disabled = not disabled -- Toggles addon if 'on' or 'off' is not used.
end
if disabled then
SendSystemChat("BossBuff is disabled")
SendChatMessage("|H|h|cffFF0000BossBuff Checker has been deactivated|h", "party")
else
SendSystemChat("BossBuff is enabled")
SendChatMessage("|H|h|cff16DC07BossBuff Checker has been activated|h", "party")
end
end
end
local BossBuff = {} -- the AddOn namespace, all your functions should be placed inside here instead of as globals.
_G.BossBuff = BossBuff -- expose it to the global scope
function BossBuff.VN()
if (UnitCastingTime("target", "Tearing Claw Attack") == true) then
SendChatMessage("|H|h|cffFCF802Lyong is casting Tearing Claw Attack!!|h", "party")
end
if (UnitCastingTime("target", "Black Flame") == true) then
SendChatMessage("Black Flame!!!", "party")
end
end;
-- Searches the target for a specified debuff.
-- Use "player", "target", "party3", "raid1" etc. for tgt parameter.
function UnitCastingTime(tgt,CastingName)
local counter=1
local currCastingTime="none"
while currCastingTime ~= nil do
currCastingTime=UnitCasting(tgt,counter)
if currCastingTime ~= nil then
if string.find(string.lower(currCastingTime),string.lower(CastingName)) then
return true
else
counter=counter+1
end
end
end
return false
end
local time_remaining = 0.5 -- in seconds
function BossBuff:OnUpdate(elapsed)
if disabled == true then
return
end
-- elapsed is the amount of time in seconds since the last frame tick
time_remaining = time_remaining - elapsed
if time_remaining > 0 then
-- cut out early, we're not ready yet
return
end
time_remaining = 0.5 -- reset to 2
BossBuff.VN()
end
Re: Casting Checker for instance
Posted: Mon Aug 26, 2013 1:14 am
by rock5
You obviously have a lot to learn about coding.
No, I meant
use that function I linked to, not
create a function by with that name. I meant use "UnitCastingTime" instead of "UnitCasting" which doesn't look like a valid game function. It's not listed under the rom wikis "List of Functions".
http://runesofmagic.gamepedia.com/List_of_Functions.
So looking at the function example, you could use something like
Code: Select all
function OnCast(tgt,CastingName)
local name = UnitCastingTime(tgt)
if name == CastingName then
return true
else
return false
end
end
Re: Casting Checker for instance
Posted: Thu Jun 19, 2014 10:51 pm
by markd
I am trying to make this function work, but i keep getting "attempt to call global 'UnitCastingTime' (a nil value). Could someone help.
<onLoad>
function OnCast(tgt,CastingName)
local name = UnitCastingTime(tgt)
if name == CastingName then
return true
else
return false
end
end
</onLoad>
<!-- # 1 --><waypoint x="2256" z="33093" y="0" type="TRAVEL">
local mob = player:findNearestNameOrId(103980)
if mob then
player:target(mob);
if OnCast("target","Erupting Spore") == true then
sendpartychat("mob casting");
end
end
</waypoint>
</waypoints>
Re: Casting Checker for instance
Posted: Fri Jun 20, 2014 12:08 am
by rock5
Thats an in game function right? Try
Code: Select all
local name = RoMScript("UnitCastingTime(\""..tgt.."\")")
Re: Casting Checker for instance
Posted: Fri Jun 20, 2014 7:28 am
by markd
Works great. Thank you for your help.