Quantcast

Trying a new welcome message using IsAddOnLoaded

Scott King [07-01-15 - 14:12]
Trying a new welcome message using IsAddOnLoaded
Filename
PortraitHealth.lua
diff --git a/PortraitHealth.lua b/PortraitHealth.lua
index 025f699..455a0c8 100755
--- a/PortraitHealth.lua
+++ b/PortraitHealth.lua
@@ -5,8 +5,6 @@ PlayerClass = classID;
 PlayerClassName = classDisplayName;
 PlayerClassNameIndex = class;
 PH_v = '3.0'; -- version number
-total = 0; -- timer set
-

 PH_p = {}			-- Class:			ID:
 PH_p[1] = "20" 		-- Warrior 			1
@@ -21,6 +19,16 @@ PH_p[9] = "25" 		-- Warlock			9
 PH_p[10] = "10" 	-- Monk				10
 PH_p[11] = "25" 	-- Druid			11

+-- Welcome message
+function PH_OnLoad()
+  SlashCmdList["PH"] = PH_SlashCommandHandler; -- Add our slash command handler to the list of slash commands
+  SLASH_PH1 = "/ph"; -- Associate /ph with the slash command list entry for PORTRAITHEALTH
+	if(IsAddOnLoaded("PortraitHealth")) then
+		DEFAULT_CHAT_FRAME:AddMessage("|cffffff00Portrait Health "..PH_v.."|r loaded. Type |cff00aaff/ph|r for a list of commands.");
+	else
+	end
+end
+
 -- Slash Commands
 function PH_SlashCommandHandler( msg, class )
 	local class = PlayerClass;
@@ -52,12 +60,6 @@ function PH_SlashCommandHandler( msg, class )
 	end
 end

-function PH_OnLoad()
-  SlashCmdList["PH"] = PH_SlashCommandHandler; -- Add our slash command handler to the list of slash commands
-  SLASH_PH1 = "/ph"; -- Associate /ph with the slash command list entry for PORTRAITHEALTH
-	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()