Quantcast

Added new welcome message

Scott King [06-30-15 - 15:22]
Added new welcome message
Filename
PortraitHealth.lua
PortraitHealth.xml
diff --git a/PortraitHealth.lua b/PortraitHealth.lua
index ed4774e..50f966e 100755
--- a/PortraitHealth.lua
+++ b/PortraitHealth.lua
@@ -5,6 +5,8 @@ PlayerClass = classID;
 PlayerClassName = classDisplayName;
 PlayerClassNameIndex = class;
 PH_v = '3.0'; -- version number
+local total = 0 -- timer set
+

 PH_p = {}			-- Class:			ID:
 PH_p[1] = "20" 		-- Warrior 			1
@@ -40,7 +42,7 @@ function PH_SlashCommandHandler( msg, class )
 			DEFAULT_CHAT_FRAME:AddMessage("Addon version |cFFFFFF00" ..PH_v.. "|r");
 			DEFAULT_CHAT_FRAME:AddMessage("Execute at |cFFFF0000"..PH_p[class].."%|r \(|c"..x.colorStr..""..PlayerClassName.."|r\)");

-		-- display list of available commands
+		-- display list of available commands
 		elseif msg == '' then
 			DEFAULT_CHAT_FRAME:AddMessage( "|cffffff00Portrait Health "..PH_v.."|r commands:");
 			DEFAULT_CHAT_FRAME:AddMessage( "Type |cff00aaff/ph|r before the command. Ex: |cff00aaff/ph off|r disables the health display.");
@@ -55,15 +57,23 @@ function PH_OnLoad()
   SLASH_PH1 = "/ph"; -- Associate /ph with the slash command list entry for PORTRAITHEALTH
 end

-
--- Tell the player what their execute phase is set to
-function DisplayClass(class)
-	local class = PlayerClass;
-	local className = PlayerClassName;
-	local x = RAID_CLASS_COLORS[PlayerClassNameIndex];
-	DEFAULT_CHAT_FRAME:AddMessage("|cffffff00Portrait Health "..PH_v.."|r loaded. Type |cff00aaff/ph|r for a list of commands.");
+-- welcome message
+local function onUpdate(self,elapsed)
+    total = total + elapsed
+    if total >= 2 then
+        DEFAULT_CHAT_FRAME:AddMessage("|cffffff00Portrait Health "..PH_v.."|r loaded. Type |cff00aaff/ph|r for a list of commands.");
+        total = 0
+    end
 end

+-- old welcome message
+--function DisplayClass(class)
+--	local class = PlayerClass;
+--	local className = PlayerClassName;
+--	local x = RAID_CLASS_COLORS[PlayerClassNameIndex];
+--	DEFAULT_CHAT_FRAME:AddMessage("|cffffff00Portrait Health "..PH_v.."|r loaded. Type |cff00aaff/ph|r for a list of commands.");
+--end
+
 -- Set the text color and update health output
 function HealthPercentage()

diff --git a/PortraitHealth.xml b/PortraitHealth.xml
index 7408a51..a89a923 100755
--- a/PortraitHealth.xml
+++ b/PortraitHealth.xml
@@ -1,6 +1,6 @@
-<Ui xmlns="http://www.blizzard.com/wow/ui/"
-                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                   xsi:schemaLocation="http://www.blizzard.com/wow/ui/
+<Ui xmlns="http://www.blizzard.com/wow/ui/"
+                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                   xsi:schemaLocation="http://www.blizzard.com/wow/ui/
                    ..\..\FrameXML\UI.xsd">

 	<Script File="PortraitHealth.lua"/>
@@ -33,12 +33,12 @@
 					self:RegisterEvent("UNIT_HEALTH");
 					self:RegisterEvent("PLAYER_TARGET_CHANGED");
 					self:RegisterEvent("PLAYER_ENTERING_WORLD");
-					DisplayClass();
+					onUpdate();
 					PH_OnLoad();
 				</OnLoad>
 				<OnEvent>
 					HealthPercentage();
 				</OnEvent>
-			</Scripts>
+			</Scripts>
 		</Frame>
-</Ui>
\ No newline at end of file
+</Ui>