05-31-11, 10:31 AM | #1 |
Spell ready = play sound ..
Hy
i try to make a little addon that makes a sound when the spell is castable i dont became an error but it dosn't runs ^^ here's my script.. Code:
local SF = GetSpellInfo(61259) local EE = GetSpellInfo(73680) local SF_SOUND = "Interface\\AddOns\\Rixxy-Spellsound\\Sound\\sonar.ogg" local EE_SOUND = "Interface\\AddOns\\Rixxy-Spellsound\\Sound\\flenz.ogg" local CD_SF = start, duration, enabled = GetSpellCooldown(SF) local CD_EE = start, duration, enabled = GetSpellCooldown(EE) if CD_SF and enabled == 0 then PlaySoundFile(SF_SOUND, "Master") elseif CD_EE and enabled == 0 then PlaySoundFile(EE_SOUND, "Master") else end |
|
05-31-11, 12:03 PM | #2 |
First, this:
Code:
local CD_SF = start, duration, enabled = GetSpellCooldown(SF) local CD_EE = start, duration, enabled = GetSpellCooldown(EE) Second, when does your code run? Is that all of your code? If it is, then it's only running once (on load) and will never check your spells. |
|
05-31-11, 10:30 PM | #3 |
the servers are at the moment down for updates and services.. so i can't check this script.
update DE = Ich habe eine Beschreibung mit eingefügt um besser mitzuteilen was ich wann vorhabe EN = I have inserted a description to better communicate what I intended when (Google Translator) Code:
-- Ziel ist es einen Ton abzuspielen wenn gewisse Zauber bereit sind -- The goal is to play a sound when certain spells are ready -- Holt die Info für Elemente Entfesseln -- Get the info for elements Unleash local EE = GetSpellInfo(73680) -- Holt die Info für Springflut -- Get the info for spring tide local SF = GetSpellInfo(61295) -- Checkt ob der Spieler gerade einen Zauber wirkt oder nicht -- Check whether the player has just a spell or not local x = UnitCastingInfo("player") -- Checkt den Cooldown des Zaubers (EE = Elemente Entfesseln) -- Check out the cooldown of the spell (EE = elements Unleash) local y = GetSpellCooldown(EE) -- Checkt den Cooldown des Zaubers (SF = Springflut) -- Check out the cooldown of the spell (SF = Spring tide) local z = GetSpellCooldown(SF) -- Der Text der ausgegeben werden soll wenn der Zauber bereit ist -- The text to be output when the spell is ready local TEXT1 = "Elemente Entfesseln ready" -- Der Text der ausgegeben werden soll wenn der Zauber bereit ist -- The text to be output when the spell is ready local TEXT2 = "Springflut ready" -- Der Soundfile der abgespielt werden soll wenn der Zauber bereit ist -- The sound file to be played when the spell is ready local SOUND1 = "Interface\\AddOns\\Rixxy-spellsound\\Sound\\flenz.ogg" -- Der Soundfile der abgespielt werden soll wenn der Zauber bereit ist -- The sound file to be played when the spell is ready local SOUND2 = "Interface\\AddOns\\Rixxy-spellsound\\Sound\\sonar.ogg" local addon = CreateFrame( "Frame" ) -- Das Event um welches sich handelt , Spell_Update_Usable = Gibt an ob ein Zauber benutzbar ist oder nicht -- The event around which is, there Spell_Update_Usable = on whether a spell is usable or not addon:RegisterEvent( "SPELL_UPDATE_USABLE" ) -- Was beim Event passieren soll -- What should happen at the event addon:SetScript( "OnEvent", function() -- wenn x (der Spieler) == nil (keinen Zauber wirkt / GCD hat) und Y<1 (der Zauber Y einen Cooldown kleiner 1 hat) dann... -- if x (the player) == nil (no magic acts / GCD has) and Y 1 (Y is the spell cooldown has less than 1) then ... if (x == nil) and (y < 1) then -- Spielt den Soundfile ab mit Master Lautstärke -- Play the sound file from with Master volume PlaySoundFile(SOUND1, "Master") -- Gibt eine Info an der Raid Warnungsposition aus -- Is an information item from the raid warning RaidNotice_AddMessage(RaidWarningFrame, TEXT1, {r=1, g=1, b=1}) -- wenn x (der Spieler) == nil (keinen Zauber wirkt / GCD hat) und Z<1 (der Zauber Y einen Cooldown kleiner 1 hat) dann... -- if x (the player) == nil (no magic acts / GCD has) and Z <1 (Y is the spell cooldown has less than 1) then ... elseif (x == nil) and (z < 1) then -- Spielt den Soundfile ab mit Master Lautstärke -- Play the sound file from with Master volume PlaySoundFile(SOUND2, "Master") -- Gibt eine Info an der Raid Warnungsposition aus -- Is an information item from the raid warning RaidNotice_AddMessage(RaidWarningFrame, TEXT2, {r=1, g=1, b=1}) -- Ende der Wenn dann sonst Abfrage -- End of if then else query end -- End of Events -- Ende des Events end ) Only Code ... Code:
local EE = GetSpellInfo(73680) local SF = GetSpellInfo(61295) local x = UnitCastingInfo("player") local y = GetSpellCooldown(EE) local z = GetSpellCooldown(SF) local TEXT1 = "Elemente Entfesseln ready" local TEXT2 = "Springflut ready" local SOUND1 = "Interface\\AddOns\\Rixxy-spellsound\\Sound\\flenz.ogg" local SOUND2 = "Interface\\AddOns\\Rixxy-spellsound\\Sound\\sonar.ogg" local addon = CreateFrame( "Frame" ) addon:RegisterEvent( "SPELL_UPDATE_USABLE" ) addon:SetScript( "OnEvent", function() if (x == nil) and (y < 1) then PlaySoundFile(SOUND1, "Master") RaidNotice_AddMessage(RaidWarningFrame, TEXT1, {r=1, g=1, b=1}) elseif (x == nil) and (z < 1) then PlaySoundFile(SOUND2, "Master") RaidNotice_AddMessage(RaidWarningFrame, TEXT2, {r=1, g=1, b=1}) end end ) maybe there is a wrong register event , i will test it later... Last edited by Rixxon : 05-31-11 at 11:46 PM. |
|
06-01-11, 04:28 AM | #4 | |
Code:
local function OnEvent(self, event) if (event == "PLAYER_LOGIN") then self.icon:SetTexture(select(3, GetSpellInfo(51505))) end if (UnitAffectingCombat("player") and not UnitInVehicle("player")) then local name = GetSpellInfo(51514) local start, duration, enabled = GetSpellCooldown(51505); if (duration>1.5) then self:Hide() return else self:Show() PlaySoundFile(SOUND2, "Master") end else self:Hide() end end local frame = CreateFrame("Frame", nil, UIParent) frame:SetPoint("BOTTOM", UIParent, "CENTER", -100, -50) frame:SetHeight(30) frame:SetWidth(30) local offset = UIParent:GetScale() local bg = CreateFrame ("Frame", nil, frame) bg:SetBackdrop( { bgFile = FreeUI.backdrop, }) bg:SetBackdropColor(0, 0, 0) bg:SetPoint("TOPLEFT", frame, -offset, offset) bg:SetPoint("BOTTOMRIGHT", frame, offset, -offset) bg:SetFrameStrata("LOW") bg:SetFrameLevel(0) frame.icon = frame:CreateTexture(nil, "BACKGROUND") frame.icon:SetTexCoord(.08, .92, .08, .92) frame.icon:SetAllPoints(frame) frame:Hide() frame:RegisterEvent("UNIT_AURA") frame:RegisterEvent("SPELL_UPDATE_COOLDOWN") frame:RegisterEvent("PLAYER_LOGIN") frame:RegisterEvent("PLAYER_REGEN_ENABLED") frame:RegisterEvent("PLAYER_REGEN_DISABLED") frame:SetScript("OnEvent", OnEvent) |
||
06-01-11, 08:33 AM | #5 |
its a little bit crazy ^^
the sound play every singel proc and at the end of the cd..... the idea behind is that i want to diactivate powa auras (to mutch memory) just one "ping" and i know "hey , i can click the button" i see its not easy.. and i dont understand the script from line 22 to the end |
|
WoWInterface » Developer Discussions » Lua/XML Help » Spell ready = play sound .. |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|