Gotten back to workin on an old addon of mine. FinalFantasylization. Plays music based on where you are and what youre doing. (Still only works in WotLK atm, will worry about that later). Been trying to compact the zone detection section.
Here's the github for all the current code: (this bit works fine in WotLK)
https://github.com/Darken5/FinalFant...Route-to-3.3.0
Heres the code im workin on compacting: (this works)
http://pastebin.com/XCZb6ehw
Snippet:
Lua Code:
--'==========================================================================================
--' Starting Areas: Sunstrider Isle, Eversong Woods ( Blood Elf Starting Area )
--'==========================================================================================
if not ( IsResting() ) and ( factionEnglish == F["Horde"] ) and ( ZoneName == Z["Eversong Woods"] ) and ( ( SubZoneName == SZ["The Sunspire"] ) or ( SubZoneName == SZ["Sunstrider Isle"] ) or ( SubZoneName == SZ["Falthrien Academy"] ) or ( SubZoneName == SZ["Shrine of Dath'Remar"] ) ) and FinalFantasylization_IsPlaying == false then
if FinalFantasylization_InStarterAreaSunstriderIsle == false then
FinalFantasylization_debugMsg(FFZlib.Color.Aqua .. PlayerIn.. SubZoneName..", "..ZoneName)
FinalFantasylization_StarterAreaSunstriderIsle()
end
FinalFantasylization_IsPlaying = true
FinalFantasylization_InStarterAreaSunstriderIsle = true
elseif ( factionEnglish == F["Alliance"] ) and ( ZoneName == Z["Eversong Woods"] ) and ( ( SubZoneName == SZ["The Sunspire"] ) or ( SubZoneName == SZ["Sunstrider Isle"] ) or ( SubZoneName == SZ["Falthrien Academy"] ) or ( SubZoneName == SZ["Shrine of Dath'Remar"] ) ) and FinalFantasylization_IsPlaying == false then
if FinalFantasylization_InStarterAreaSunstriderIsle == false then
FinalFantasylization_debugMsg(FFZlib.Color.Crimson .. PlayerInHostileTown .. SubZoneName..", "..ZoneName.. PlayerInHostile)
FinalFantasylization_HostileTowns() -- Music call for all towns you are hostile in.
end
FinalFantasylization_IsPlaying = true
FinalFantasylization_InStarterAreaSunstriderIsle = true
else
FinalFantasylization_InStarterAreaSunstriderIsle = false
end
Heres the compacted code: (this doesn't work)
http://pastebin.com/XpbSgvZL
Snippet:
Lua Code:
--'==========================================================================================
--' Starting Areas: Sunstrider Isle, Eversong Woods ( Blood Elf Starting Area )
--'==========================================================================================
if not ( IsResting() ) and ( ZoneName == Z["Eversong Woods"] ) and ( ( MinimapZoneName == SZ["The Sunspire"] ) or ( SubZoneName == SZ["Sunstrider Isle"] ) or ( SubZoneName == SZ["Falthrien Academy"] ) or ( SubZoneName == SZ["Shrine of Dath'Remar"] ) ) and FinalFantasylization_IsPlaying == false then
if FinalFantasylization_InStarterAreaSunstriderIsle == false then
if ( factionEnglish == F["Horde"] ) then
FinalFantasylization_debugMsg(FFZlib.Color.Aqua .. PlayerIn.. SubZoneName..", "..ZoneName)
FinalFantasylization_StarterAreaSunstriderIsle()
else
FinalFantasylization_debugMsg(FFZlib.Color.Crimson .. PlayerInHostileTown .. SubZoneName..", "..ZoneName.. PlayerInHostile)
FinalFantasylization_HostileTowns() -- Music call for all towns you are hostile in.
end
FinalFantasylization_IsPlaying = true
FinalFantasylization_InStarterAreaSunstriderIsle = true
end
FinalFantasylization_InStarterAreaSunstriderIsle = false
end
problem i'm having is the compacted code keeps changing the song played. Example, using the above snippet, it'll play "Sunstrider Isle" then about 2 seconds later plays "Eversong Woods" (which is further down the list), and then back again. If not in a subzone detected by FFz, it'll just repeat the music set for the zone.
i've also tried: (my 1st attempt)
Lua Code:
--'==========================================================================================
--' Starting Areas: Sunstrider Isle, Eversong Woods ( Blood Elf Starting Area )
--'==========================================================================================
if not ( IsResting() ) and ( ZoneName == Z["Eversong Woods"] ) and ( ( SubZoneName == SZ["The Sunspire"] ) or ( SubZoneName == SZ["Sunstrider Isle"] ) or ( SubZoneName == SZ["Falthrien Academy"] ) or ( SubZoneName == SZ["Shrine of Dath'Remar"] ) ) and FinalFantasylization_IsPlaying == false then
if FinalFantasylization_InStarterAreaSunstriderIsle == false then
if ( factionEnglish == F["Horde"] ) then
FinalFantasylization_debugMsg(FFZlib.Color.Aqua .. PlayerIn.. SubZoneName..", "..ZoneName)
FinalFantasylization_StarterAreaSunstriderIsle()
else
FinalFantasylization_debugMsg(FFZlib.Color.Crimson .. PlayerInHostileTown .. SubZoneName..", "..ZoneName.. PlayerInHostile)
FinalFantasylization_HostileTowns() -- Music call for all towns you are hostile in.
end
FinalFantasylization_IsPlaying = true
FinalFantasylization_InStarterAreaSunstriderIsle = true
else
FinalFantasylization_InStarterAreaSunstriderIsle = false
end
end
Any help in understanding why the compacted code doesn't work would be VERY much appreciated.