Shorten References

His Dad [05-12-15 - 04:21]
Shorten References
Filename
HistOffline.lua
diff --git a/HistOffline.lua b/HistOffline.lua
index 8ab0924..3d765a2 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -175,27 +175,6 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
 	pub_names = lingua[accounts[acc].lang].pub_names
 	grp_names = lingua[accounts[acc].lang].grp_names
 	Ach_Detail = lingua[accounts[acc].lang].Ach_Detail
--- Create SkillQuest Achievements Detail Boxes=======================
--- These are the same for all chars, we just just highlight the contents appropriately
-	load_SQ_Detail(accounts[acc].lang)
---[[
---Load all the detail boxes into a zbox
-	if SQ_Detail_Zbox[accounts[acc].lang] == nil then
-			SQ_Detail_Zbox[accounts[acc].lang] = iup.zbox{}
-			-- add in all the SQ_Detail boxes
-			for key,box in pairs(SQ_Detail_box[accounts[acc].lang]) do
-	--		print (dump(key, box))
-			iup.Append(SQ_Detail_Zbox[accounts[acc].lang], box)
-			end
-	end
---]]
-alabel = iup.label{title="hello"}
-myzbox = iup.zbox{alabel}   --  ; alignment="ACENTER"}
-myzbox.value = alabel
---	SQ_Detail_Zbox[accounts[acc].lang] = iup.zbox{alignment="ACENTER"}
-
-
-

   -- ====  Accountwide Data
   -- Setup Log data
@@ -239,38 +218,38 @@ myzbox.value = alabel

 -- Creates boxes, stage from names to allow optional sorting in future.
 	for _,char in ipairs(accounts[acc].names) do
-		accounts[acc].name[char] = {}
-		local thischar = History_SV["Default"][acc]["$AccountWide"]["data"][char]		-- shorter reference
+		local me = account[acc].name[char]											-- shorter reference: our code
+		local thischar = History_SV["Default"][acc]["$AccountWide"]["data"][char]	-- shorter reference: History DB
 		-- Pull in some char data for processing
 		-- == Gender
 		if thischar.Gender =="M" then
-			accounts[acc].name[char].gender = L.Male
+			me.gender = L.Male
 		elseif thischar.Gender == "F" then
-			accounts[acc].name[char].gender = L.Female
+			me.gender = L.Female
 		end
 		-- ==Level
 		local level = thischar.level

-		accounts[acc].name[char].level = level
+		me.level = level
 		if (level <=50) then
-			accounts[acc].name[char].levelstr = tostring(level)
+			me.levelstr = tostring(level)
 		else
-			accounts[acc].name[char].levelstr = "V" .. tostring(level -50)
+			me.levelstr = "V" .. tostring(level -50)
 		end
 		-- == Cumulative TimePlayed
-		accounts[acc].name[char].timeplayed = math.floor(thischar.levels[level].time/60)
+		me.timeplayed = math.floor(thischar.levels[level].time/60)

 		-- Generate the leveling box.  ============================
 		local leveling_box = {}
-		accounts[acc].name[char].leveling_box = iup.matrix {numcol=6, numcol_visible=6,  widthdef=60}
-		accounts[acc].name[char].leveling_box:setcell(0,1, L.Level)
-		accounts[acc].name[char].leveling_box:setcell(0,2, L.PTime)
-		accounts[acc].name[char].leveling_box:setcell(0,3, L.Start)
-		accounts[acc].name[char].leveling_box:setcell(0,4, L.Deaths)
-		accounts[acc].name[char].leveling_box:setcell(0,5, L.APts)
-		accounts[acc].name[char].leveling_box:setcell(0,6, L.Location)
-		iup.SetAttribute(accounts[acc].name[char].leveling_box, "WIDTH6", "100")
-		iup.SetAttribute(accounts[acc].name[char].leveling_box, "READONLY", "YES")
+		me.leveling_box = iup.matrix {numcol=6, numcol_visible=6,  widthdef=60}
+		me.leveling_box:setcell(0,1, L.Level)
+		me.leveling_box:setcell(0,2, L.PTime)
+		me.leveling_box:setcell(0,3, L.Start)
+		me.leveling_box:setcell(0,4, L.Deaths)
+		me.leveling_box:setcell(0,5, L.APts)
+		me.leveling_box:setcell(0,6, L.Location)
+		iup.SetAttribute(me.leveling_box, "WIDTH6", "100")
+		iup.SetAttribute(me.leveling_box, "READONLY", "YES")


 		-- levels as stored are unsorted, so create a level table which is sorted,
@@ -283,39 +262,39 @@ myzbox.value = alabel

 		for i,j in ipairs(levels) do		-- traverse in sorted order
 			local timelevel = math.floor(thischar.levels[j].time)
-			accounts[acc].name[char].leveling_box.numlin = i
-			accounts[acc].name[char].leveling_box:setcell(i,1, j)
-			accounts[acc].name[char].leveling_box:setcell(i,2, math.floor(timelevel/60))
-			accounts[acc].name[char].leveling_box:setcell(i,3, os.date("%Y-%m-%d",thischar.levels[j].begin))
-			accounts[acc].name[char].leveling_box:setcell(i,4, thischar.levels[j].deaths)
-			accounts[acc].name[char].leveling_box:setcell(i,5, thischar.levels[j].Ach_Points)
+			me.leveling_box.numlin = i
+			me.leveling_box:setcell(i,1, j)
+			me.leveling_box:setcell(i,2, math.floor(timelevel/60))
+			me.leveling_box:setcell(i,3, os.date("%Y-%m-%d",thischar.levels[j].begin))
+			me.leveling_box:setcell(i,4, thischar.levels[j].deaths)
+			me.leveling_box:setcell(i,5, thischar.levels[j].Ach_Points)
 			-- Do we have map name for this level?
 			if thischar.levels[j].map ~= nil then
-				accounts[acc].name[char].leveling_box:setcell(i,6, thischar.levels[j].map)
+				me.leveling_box:setcell(i,6, thischar.levels[j].map)
 			end
 		end
 		-- Create Grp Dungeon Achievements Box=========================
-		accounts[acc].name[char].Grp_box = {}
-		accounts[acc].name[char].Grp_box = iup.matrix {numcol=4, numcol_visible=4,  numlin=5, widthdef=90}
+		me.Grp_box = {}
+		me.Grp_box = iup.matrix {numcol=4, numcol_visible=4,  numlin=5, widthdef=90}
 		--Set Column titles
 		for i=1, 4 do
-			accounts[acc].name[char].Grp_box:setcell(0,i, Area_names[i].long)
+			me.Grp_box:setcell(0,i, Area_names[i].long)
 		end
 		--set lines
-		accounts[acc].name[char].Grp_box:setcell(0,0, L.Level)
-		accounts[acc].name[char].Grp_box:setcell(1,0, "10+")
-		accounts[acc].name[char].Grp_box:setcell(2,0, "17+")
-		accounts[acc].name[char].Grp_box:setcell(3,0, "24+")
-		accounts[acc].name[char].Grp_box:setcell(4,0, "31+")
-		accounts[acc].name[char].Grp_box:setcell(5,0, "38+")
+		me.Grp_box:setcell(0,0, L.Level)
+		me.Grp_box:setcell(1,0, "10+")
+		me.Grp_box:setcell(2,0, "17+")
+		me.Grp_box:setcell(3,0, "24+")
+		me.Grp_box:setcell(4,0, "31+")
+		me.Grp_box:setcell(5,0, "38+")

-		iup.SetAttribute(accounts[acc].name[char].Grp_box, "READONLY", "YES")
+		iup.SetAttribute(me.Grp_box, "READONLY", "YES")

 		-- set all text to red
-		iup.SetAttribute(accounts[acc].name[char].Grp_box,  "FGCOLOR*:1", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].Grp_box,  "FGCOLOR*:2", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].Grp_box,  "FGCOLOR*:3", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].Grp_box,  "FGCOLOR*:4", Colour_Not_Complete)
+		iup.SetAttribute(me.Grp_box,  "FGCOLOR*:1", Colour_Not_Complete)
+		iup.SetAttribute(me.Grp_box,  "FGCOLOR*:2", Colour_Not_Complete)
+		iup.SetAttribute(me.Grp_box,  "FGCOLOR*:3", Colour_Not_Complete)
+		iup.SetAttribute(me.Grp_box,  "FGCOLOR*:4", Colour_Not_Complete)


 		-- set text to black if achievement found.
@@ -323,21 +302,21 @@ myzbox.value = alabel
 			local colour
 			if thischar.ach[id] ~= nil then
 				colour = "FGCOLOR" .. grp_dat[id].L .. ":" .. grp_dat[id].C
-				iup.SetAttribute(accounts[acc].name[char].Grp_box, colour, Colour_Complete)
+				iup.SetAttribute(me.Grp_box, colour, Colour_Complete)
 			end
 		end

 		--Set background of heading if all done
 		if thischar.ach[1073] ~= nil then  --EP Vanquisher
-				iup.SetAttribute(accounts[acc].name[char].Grp_box,  "BGCOLOR0:1", Colour_Heading_Complete)
+				iup.SetAttribute(me.Grp_box,  "BGCOLOR0:1", Colour_Heading_Complete)
 		end

 		if thischar.ach[1074] ~= nil then  --DC Vanquisher
-				iup.SetAttribute(accounts[acc].name[char].Grp_box,  "BGCOLOR0:2", Colour_Heading_Complete)
+				iup.SetAttribute(me.Grp_box,  "BGCOLOR0:2", Colour_Heading_Complete)
 		end

 		if thischar.ach[1075] ~= nil then  --AD Vanquisher
-				iup.SetAttribute(accounts[acc].name[char].Grp_box,  "BGCOLOR0:3", Colour_Heading_Complete)
+				iup.SetAttribute(me.Grp_box,  "BGCOLOR0:3", Colour_Heading_Complete)
 		end

 		local key = ""
@@ -351,48 +330,48 @@ myzbox.value = alabel
 				dname = "key " .. key .." not found"
 				end
 			--	print(key .. "   " .. dname)
-				accounts[acc].name[char].Grp_box:setcell(L, C, dname)
+				me.Grp_box:setcell(L, C, dname)
 		end

-		accounts[acc].name[char].Grp_box.Redraw= "ALL"
+		me.Grp_box.Redraw= "ALL"

 		-- Create Pub Dungeon Achievements Box==========================
-		accounts[acc].name[char].Pub_box = iup.matrix {numcol=4, numcol_visible=4,  numlin=5, widthdef=90}
+		me.Pub_box = iup.matrix {numcol=4, numcol_visible=4,  numlin=5, widthdef=90}
 		for i=1, 4 do  -- Load text
-			accounts[acc].name[char].Pub_box:setcell(0,i, Area_names[i].long)
+			me.Pub_box:setcell(0,i, Area_names[i].long)
 		end

-		accounts[acc].name[char].Pub_box:setcell(0,0, L.Level)
-		accounts[acc].name[char].Pub_box:setcell(1,0, "12-15")
-		accounts[acc].name[char].Pub_box:setcell(2,0, "20-23")
-		accounts[acc].name[char].Pub_box:setcell(3,0, "35-36")
-		accounts[acc].name[char].Pub_box:setcell(4,0, "40-43")
-		accounts[acc].name[char].Pub_box:setcell(5,0, "47-50")
+		me.Pub_box:setcell(0,0, L.Level)
+		me.Pub_box:setcell(1,0, "12-15")
+		me.Pub_box:setcell(2,0, "20-23")
+		me.Pub_box:setcell(3,0, "35-36")
+		me.Pub_box:setcell(4,0, "40-43")
+		me.Pub_box:setcell(5,0, "47-50")

-		iup.SetAttribute(accounts[acc].name[char].Pub_box, "READONLY", "YES")
+		iup.SetAttribute(me.Pub_box, "READONLY", "YES")

-		iup.SetAttribute(accounts[acc].name[char].Pub_box,  "FGCOLOR*:1", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].Pub_box,  "FGCOLOR*:2", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].Pub_box,  "FGCOLOR*:3", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].Pub_box,  "FGCOLOR*:4", Colour_Not_Complete)
+		iup.SetAttribute(me.Pub_box,  "FGCOLOR*:1", Colour_Not_Complete)
+		iup.SetAttribute(me.Pub_box,  "FGCOLOR*:2", Colour_Not_Complete)
+		iup.SetAttribute(me.Pub_box,  "FGCOLOR*:3", Colour_Not_Complete)
+		iup.SetAttribute(me.Pub_box,  "FGCOLOR*:4", Colour_Not_Complete)

 		for id,_ in pairs (pub_dat) do
 			if thischar.ach[id] ~= nil then
 				local colour = "FGCOLOR" .. pub_dat[id].L .. ":" .. pub_dat[id].C
-				iup.SetAttribute(accounts[acc].name[char].Pub_box, colour, Colour_Complete)
+				iup.SetAttribute(me.Pub_box, colour, Colour_Complete)
 			end
 		end

 		if thischar.ach[1068] ~= nil then  --EP Conqueror
-				iup.SetAttribute(accounts[acc].name[char].Pub_box,  "BGCOLOR0:1", Colour_Heading_Complete)
+				iup.SetAttribute(me.Pub_box,  "BGCOLOR0:1", Colour_Heading_Complete)
 		end

 		if thischar.ach[1070] ~= nil then  --DC Conqueror
-				iup.SetAttribute(accounts[acc].name[char].Pub_box,  "BGCOLOR0:2", Colour_Heading_Complete)
+				iup.SetAttribute(me.Pub_box,  "BGCOLOR0:2", Colour_Heading_Complete)
 		end

 		if thischar.ach[1069] ~= nil then  --AD Conqueror
-				iup.SetAttribute(accounts[acc].name[char].Pub_box,  "BGCOLOR0:3", Colour_Heading_Complete)
+				iup.SetAttribute(me.Pub_box,  "BGCOLOR0:3", Colour_Heading_Complete)
 		end

 		for id,_ in pairs (pub_dat) do  -- Load text
@@ -403,26 +382,26 @@ myzbox.value = alabel
 					if dname == nil then
 				dname = "key " .. key .." not found"
 				end
-				accounts[acc].name[char].Pub_box:setcell(L,C,dname)
+				me.Pub_box:setcell(L,C,dname)
 		end

-		accounts[acc].name[char].Pub_box.Redraw= "ALL"
+		me.Pub_box.Redraw= "ALL"

 		-- Create Vet Dungeon Achievements Box==========================
-		accounts[acc].name[char].Vet_box= iup.matrix {numcol=5, numcol_visible=5,  numlin=5, widthdef=110}
+		me.Vet_box= iup.matrix {numcol=5, numcol_visible=5,  numlin=5, widthdef=110}

 		for i=1, 5 do  -- Load headings
-			accounts[acc].name[char].Vet_box:setcell(0,i, Area_names[i].long)
+			me.Vet_box:setcell(0,i, Area_names[i].long)
 		end

-		iup.SetAttribute(accounts[acc].name[char].Vet_box, "READONLY", "YES")
-		iup.SetAttribute(accounts[acc].name[char].Vet_box, "WIDTH4", "0")		-- Hide Coldharbour, Empty
+		iup.SetAttribute(me.Vet_box, "READONLY", "YES")
+		iup.SetAttribute(me.Vet_box, "WIDTH4", "0")		-- Hide Coldharbour, Empty

-		iup.SetAttribute(accounts[acc].name[char].Vet_box,  "FGCOLOR*:1", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].Vet_box,  "FGCOLOR*:2", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].Vet_box,  "FGCOLOR*:3", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].Vet_box,  "FGCOLOR*:4", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].Vet_box,  "FGCOLOR*:5", Colour_Not_Complete)
+		iup.SetAttribute(me.Vet_box,  "FGCOLOR*:1", Colour_Not_Complete)
+		iup.SetAttribute(me.Vet_box,  "FGCOLOR*:2", Colour_Not_Complete)
+		iup.SetAttribute(me.Vet_box,  "FGCOLOR*:3", Colour_Not_Complete)
+		iup.SetAttribute(me.Vet_box,  "FGCOLOR*:4", Colour_Not_Complete)
+		iup.SetAttribute(me.Vet_box,  "FGCOLOR*:5", Colour_Not_Complete)

 		-- Need to keep track of multiple achievements in Vet dungeons. Index them by dungeon LineColumn.
 		Vet_Info={}
@@ -435,7 +414,7 @@ myzbox.value = alabel
 				dname = "key " .. key .." not found"
 				end
 				Vet_Info[key] = {count = 0}
-				accounts[acc].name[char].Vet_box:setcell(L,C,dname .. " (0)")
+				me.Vet_box:setcell(L,C,dname .. " (0)")
 		end


@@ -445,7 +424,7 @@ myzbox.value = alabel
 				local C = vet_dat[id].C
 				--Set colour of LC
 				local colour = "FGCOLOR" .. L .. ":" .. C
-				iup.SetAttribute(accounts[acc].name[char].Vet_box, colour, Colour_Complete)
+				iup.SetAttribute(me.Vet_box, colour, Colour_Complete)

 				key = tostring(L) .. tostring(C)	-- make name key
 				dname = grp_names[key]				-- Vet Dungeons are grp
@@ -454,37 +433,37 @@ myzbox.value = alabel
 				end
 				-- Increment count and display
 				Vet_Info[key].count = Vet_Info[key].count+1
-				accounts[acc].name[char].Vet_box:setcell(L,C,dname .. " (" .. Vet_Info[key].count ..")")
+				me.Vet_box:setcell(L,C,dname .. " (" .. Vet_Info[key].count ..")")
 			end
 		end

 		if thischar.ach[1159] ~= nil 	then -- Coh All special.
-			iup.SetAttribute(accounts[acc].name[char].Vet_box, "FGCOLOR3:3", Colour_Heading_Complete)
+			iup.SetAttribute(me.Vet_box, "FGCOLOR3:3", Colour_Heading_Complete)
 		end

 		if thischar.ach[1139] ~= nil 	then -- Craglorn all special.
-			iup.SetAttribute(accounts[acc].name[char].Vet_box, "BGCOLOR0:5", Colour_Heading_Complete)
+			iup.SetAttribute(me.Vet_box, "BGCOLOR0:5", Colour_Heading_Complete)
 		end

-		accounts[acc].name[char].Vet_box.Redraw= "ALL"
+		me.Vet_box.Redraw= "ALL"

 		-- Create Locations Box==============================================
-		accounts[acc].name[char].Map_box= iup.matrix {numcol=6, numcol_visible=6,  numlin=0, widthdef=70}
+		me.Map_box= iup.matrix {numcol=6, numcol_visible=6,  numlin=0, widthdef=70}

-		accounts[acc].name[char].Map_box:setcell(0,0, L.Location)
-		accounts[acc].name[char].Map_box:setcell(0,1, L.Visits)
-		accounts[acc].name[char].Map_box:setcell(0,2, L.FirstVisited)
-		accounts[acc].name[char].Map_box:setcell(0,3, L.FirstLevel)
-		accounts[acc].name[char].Map_box:setcell(0,4, L.TimesLeveled)
-		accounts[acc].name[char].Map_box:setcell(0,5, L.FirstDeath)
-		accounts[acc].name[char].Map_box:setcell(0,6, L.Deaths)
+		me.Map_box:setcell(0,0, L.Location)
+		me.Map_box:setcell(0,1, L.Visits)
+		me.Map_box:setcell(0,2, L.FirstVisited)
+		me.Map_box:setcell(0,3, L.FirstLevel)
+		me.Map_box:setcell(0,4, L.TimesLeveled)
+		me.Map_box:setcell(0,5, L.FirstDeath)
+		me.Map_box:setcell(0,6, L.Deaths)

-		iup.SetAttribute(accounts[acc].name[char].Map_box, "READONLY", "YES")
-		iup.SetAttribute(accounts[acc].name[char].Map_box, "ALIGNMENT0", "ALEFT")
-		iup.SetAttribute(accounts[acc].name[char].Map_box, "WIDTH0", "100")
-		iup.SetAttribute(accounts[acc].name[char].Map_box, "WIDTH1", "40")
-		iup.SetAttribute(accounts[acc].name[char].Map_box, "WIDTH4", "55")
-		iup.SetAttribute(accounts[acc].name[char].Map_box, "WIDTH6", "40")
+		iup.SetAttribute(me.Map_box, "READONLY", "YES")
+		iup.SetAttribute(me.Map_box, "ALIGNMENT0", "ALEFT")
+		iup.SetAttribute(me.Map_box, "WIDTH0", "100")
+		iup.SetAttribute(me.Map_box, "WIDTH1", "40")
+		iup.SetAttribute(me.Map_box, "WIDTH4", "55")
+		iup.SetAttribute(me.Map_box, "WIDTH6", "40")


 		local map_names = {}
@@ -495,56 +474,56 @@ myzbox.value = alabel
 		table.sort(map_names)
 		local Line =1
 		for _, map in ipairs(map_names) do
-			accounts[acc].name[char].Map_box.numlin = Line
+			me.Map_box.numlin = Line

-			accounts[acc].name[char].Map_box:setcell( Line,0, map)
+			me.Map_box:setcell( Line,0, map)

 			if thischar.maps[map].visit ~= nil then
-				accounts[acc].name[char].Map_box:setcell( Line,1, thischar.maps[map].visit)
+				me.Map_box:setcell( Line,1, thischar.maps[map].visit)
 			end

 			if thischar.maps[map].firstvisitdate ~= nil then
 				local firstvisit = os.date(dateformat,thischar.maps[map].firstvisitdate)
-				accounts[acc].name[char].Map_box:setcell( Line,2, firstvisit)
+				me.Map_box:setcell( Line,2, firstvisit)
 			end

 			if thischar.maps[map].firstlevel ~= nil then
-				accounts[acc].name[char].Map_box:setcell( Line,3, thischar.maps[map].firstlevel)
+				me.Map_box:setcell( Line,3, thischar.maps[map].firstlevel)
 			end

 			if thischar.maps[map].timeslevel ~= nil then
-				accounts[acc].name[char].Map_box:setcell( Line,4, thischar.maps[map].timeslevel)
+				me.Map_box:setcell( Line,4, thischar.maps[map].timeslevel)
 			end

 			if thischar.maps[map].firstdeathlevel ~= nil then
-				accounts[acc].name[char].Map_box:setcell( Line,5, thischar.maps[map].firstdeathlevel)
+				me.Map_box:setcell( Line,5, thischar.maps[map].firstdeathlevel)
 			end

 			if thischar.maps[map].deaths ~= nil then
-				accounts[acc].name[char].Map_box:setcell( Line,6, thischar.maps[map].deaths )
+				me.Map_box:setcell( Line,6, thischar.maps[map].deaths )
 			end
 		Line= Line +1
 		end
 -- Create WorldBoss Achievements Box==========================
-		accounts[acc].name[char].WB_box= iup.matrix {numcol=4, numcol_visible=4,  numlin=5, widthdef=110}
+		me.WB_box= iup.matrix {numcol=4, numcol_visible=4,  numlin=5, widthdef=110}

 		for i=1, 4 do  -- Load headings, not craglorn
-			accounts[acc].name[char].WB_box:setcell(0,i, Area_names[i].long)
-		end
-		accounts[acc].name[char].WB_box:setcell(0,0, L.Zone)
-		accounts[acc].name[char].WB_box:setcell(1,0, "1")
-		accounts[acc].name[char].WB_box:setcell(2,0, "2")
-		accounts[acc].name[char].WB_box:setcell(3,0, "3")
-		accounts[acc].name[char].WB_box:setcell(4,0, "4")
-		accounts[acc].name[char].WB_box:setcell(5,0, "5")
-		iup.SetAttribute(accounts[acc].name[char].WB_box, "READONLY", "YES")
-		iup.SetAttribute(accounts[acc].name[char].WB_box, "ALIGNMENT0", "ACENTER")
-
-		iup.SetAttribute(accounts[acc].name[char].WB_box,  "FGCOLOR*:1", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].WB_box,  "FGCOLOR*:2", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].WB_box,  "FGCOLOR*:3", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].WB_box,  "FGCOLOR*:4", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].WB_box,  "FGCOLOR*:5", Colour_Not_Complete)
+			me.WB_box:setcell(0,i, Area_names[i].long)
+		end
+		me.WB_box:setcell(0,0, L.Zone)
+		me.WB_box:setcell(1,0, "1")
+		me.WB_box:setcell(2,0, "2")
+		me.WB_box:setcell(3,0, "3")
+		me.WB_box:setcell(4,0, "4")
+		me.WB_box:setcell(5,0, "5")
+		iup.SetAttribute(me.WB_box, "READONLY", "YES")
+		iup.SetAttribute(me.WB_box, "ALIGNMENT0", "ACENTER")
+
+		iup.SetAttribute(me.WB_box,  "FGCOLOR*:1", Colour_Not_Complete)
+		iup.SetAttribute(me.WB_box,  "FGCOLOR*:2", Colour_Not_Complete)
+		iup.SetAttribute(me.WB_box,  "FGCOLOR*:3", Colour_Not_Complete)
+		iup.SetAttribute(me.WB_box,  "FGCOLOR*:4", Colour_Not_Complete)
+		iup.SetAttribute(me.WB_box,  "FGCOLOR*:5", Colour_Not_Complete)

 		-- Need to keep track of multiple achievements for WB in Zones. Index them by zone LineColumn.
 		WB_Info={}
@@ -559,7 +538,7 @@ myzbox.value = alabel
 				end
 				WB_Info[key] = {count = 0}
 				WB_Area[C] =0
-				accounts[acc].name[char].WB_box:setcell(L,C,dname .. " (0)")
+				me.WB_box:setcell(L,C,dname .. " (0)")
 		end


@@ -577,10 +556,10 @@ myzbox.value = alabel
 				end
 				-- Increment count and display
 				WB_Info[key].count = WB_Info[key].count+1
-				accounts[acc].name[char].WB_box:setcell(L,C,dname .. " (" .. WB_Info[key].count ..")")
+				me.WB_box:setcell(L,C,dname .. " (" .. WB_Info[key].count ..")")
 				--Check if done
 				if  WB_Info[key].count >= 6 then
-					iup.SetAttribute(accounts[acc].name[char].WB_box, colour_cell , Colour_Complete)
+					iup.SetAttribute(me.WB_box, colour_cell , Colour_Complete)
 				end
 				--Add to Area Completion
 				WB_Area[C] = WB_Area[C] +1
@@ -589,34 +568,34 @@ myzbox.value = alabel
 		--Set Column Colours if 30 done.
 		for i,j in pairs (WB_Area) do
 		if j > 29 then
-			iup.SetAttribute(accounts[acc].name[char].WB_box,  "BGCOLOR0:".. tostring(i), Colour_Heading_Complete)
+			iup.SetAttribute(me.WB_box,  "BGCOLOR0:".. tostring(i), Colour_Heading_Complete)
 		end
 		end

 -- Create SkillQuest Achievements Box==========================

-		accounts[acc].name[char].SQ_box= iup.matrix {numcol=4, numcol_visible=4,  numlin=5, widthdef=110}
-		accounts[acc].name[char].SQ_Info = {}
+		me.SQ_box= iup.matrix {numcol=4, numcol_visible=4,  numlin=5, widthdef=110}
+		me.SQ_Info = {}
 		for i=1, 4 do  -- Load headings, not craglorn
-			accounts[acc].name[char].SQ_box:setcell(0,i, Area_names[i].long)
-		end
-		accounts[acc].name[char].SQ_box:setcell(0,0, L.Zone)
-		accounts[acc].name[char].SQ_box:setcell(1,0, "1")
-		accounts[acc].name[char].SQ_box:setcell(2,0, "2")
-		accounts[acc].name[char].SQ_box:setcell(3,0, "3")
-		accounts[acc].name[char].SQ_box:setcell(4,0, "4")
-		accounts[acc].name[char].SQ_box:setcell(5,0, "5")
-		iup.SetAttribute(accounts[acc].name[char].SQ_box, "READONLY", "YES")
-		iup.SetAttribute(accounts[acc].name[char].SQ_box, "ALIGNMENT0", "ACENTER")
-
-		iup.SetAttribute(accounts[acc].name[char].SQ_box,  "FGCOLOR*:1", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].SQ_box,  "FGCOLOR*:2", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].SQ_box,  "FGCOLOR*:3", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].SQ_box,  "FGCOLOR*:4", Colour_Not_Complete)
-		iup.SetAttribute(accounts[acc].name[char].SQ_box,  "FGCOLOR*:5", Colour_Not_Complete)
+			me.SQ_box:setcell(0,i, Area_names[i].long)
+		end
+		me.SQ_box:setcell(0,0, L.Zone)
+		me.SQ_box:setcell(1,0, "1")
+		me.SQ_box:setcell(2,0, "2")
+		me.SQ_box:setcell(3,0, "3")
+		me.SQ_box:setcell(4,0, "4")
+		me.SQ_box:setcell(5,0, "5")
+		iup.SetAttribute(me.SQ_box, "READONLY", "YES")
+		iup.SetAttribute(me.SQ_box, "ALIGNMENT0", "ACENTER")
+
+		iup.SetAttribute(me.SQ_box,  "FGCOLOR*:1", Colour_Not_Complete)
+		iup.SetAttribute(me.SQ_box,  "FGCOLOR*:2", Colour_Not_Complete)
+		iup.SetAttribute(me.SQ_box,  "FGCOLOR*:3", Colour_Not_Complete)
+		iup.SetAttribute(me.SQ_box,  "FGCOLOR*:4", Colour_Not_Complete)
+		iup.SetAttribute(me.SQ_box,  "FGCOLOR*:5", Colour_Not_Complete)

 		-- Need to keep track of multiple achievements for SQ in Zones. Index them by zone LineColumn.
-		thisSQ_Info = accounts[acc].name[char].SQ_Info
+--		thisSQ_Info = me.SQ_Info
 		SQ_Faction={}

 		local ccount, count
@@ -638,132 +617,127 @@ myzbox.value = alabel
 					end
 				end
 				ccount = ccount + count		-- Track the faction (Column)
-				accounts[acc].name[char].SQ_box:setcell(L,C,dname .. " (" .. tostring(count) .. ")")
+				me.SQ_box:setcell(L,C,dname .. " (" .. tostring(count) .. ")")

 				local colour_cell = "FGCOLOR" .. L .. ":" .. C
 				if count == #SQ_Info[key].quests then		-- Got them all??
-					iup.SetAttribute(accounts[acc].name[char].SQ_box, colour_cell , Colour_Complete)  -- Yup
-        end
+					iup.SetAttribute(me.SQ_box, colour_cell , Colour_Complete)  -- Yup
+				end
 			end   -- L

 			--Set Column Heading Colours
 			if ccount >= 15 then
-				iup.SetAttribute(accounts[acc].name[char].SQ_box, "BGCOLOR0:" .. tostring(C), Colour_Heading_Complete)
+				iup.SetAttribute(me.SQ_box, "BGCOLOR0:" .. tostring(C), Colour_Heading_Complete)
 			end
-		end		--
+		end		-- C
 ---
 -- Create SkillQuest Achievements Detail Boxes=======================

-	accounts[acc].name[char].SQ_Detail_box = {}
-	accounts[acc].name[char].SQ_Detail_Zbox = {}
---		accounts[acc].name[char].SQ_Frame = iup.frame{title = "Quest Details"} -- Panel for details
-
-	local info, name, link
-	for key, info in pairs(SQ_Info) do	-- for each zone
-	--	print ("LAng: "..lang .. "  " ..key, dump(info))
-		accounts[acc].name[char].SQ_Detail_box[key]= iup.matrix {numcol=2, numcol_visible=2,  numlin=0}
-
-		local Line = 1
-		accounts[acc].name[char].SQ_Detail_box[key]:setcell(0,0, lingua[lang].L.Ach_ID)
-		accounts[acc].name[char].SQ_Detail_box[key]:setcell(0,1, lingua[lang].L.Name)
-		accounts[acc].name[char].SQ_Detail_box[key]:setcell(0,2, lingua[lang].L.Link)
-		iup.SetAttribute(accounts[acc].name[char].SQ_Detail_box[key], "READONLY", "YES")
-		iup.SetAttribute(accounts[acc].name[char].SQ_Detail_box[key], "ALIGNMENT0", "ACENTER")
-		iup.SetAttribute(accounts[acc].name[char].SQ_Detail_box[key], "ALIGNMENT1", "ALEFT")
-		iup.SetAttribute(accounts[acc].name[char].SQ_Detail_box[key], "ALIGNMENT2", "ALEFT")
-		iup.SetAttribute(accounts[acc].name[char].SQ_Detail_box[key],"WIDTH0", "30")
-		iup.SetAttribute(accounts[acc].name[char].SQ_Detail_box[key],"WIDTH1", "150")
-		iup.SetAttribute(accounts[acc].name[char].SQ_Detail_box[key],"WIDTH2", "250")
-		for _, id in ipairs (info.quests) do	-- get the quests of the zone
-		--	print (dump(id))
-			accounts[acc].name[char].SQ_Detail_box[key].numlin = Line
-			accounts[acc].name[char].SQ_Detail_box[key]:setcell(Line,0, tostring(id))
-
-			if Ach_Detail[id] == nil then
-				name = "UNKN"
-			else
-				name = Ach_Detail[id].name
+		me.SQ_Detail_box = {}
+		me.SQ_Detail_Zbox = {}
+	--		me.SQ_Frame = iup.frame{title = "Quest Details"} -- Panel for details
+
+		local info, name, link
+		for key, info in pairs(SQ_Info) do	-- for each zone
+		--	print ("LAng: "..lang .. "  " ..key, dump(info))
+			me.SQ_Detail_box[key]= iup.matrix {numcol=2, numcol_visible=2,  numlin=0}
+
+			local Line = 1
+			me.SQ_Detail_box[key]:setcell(0,0, L.Ach_ID)
+			me.SQ_Detail_box[key]:setcell(0,1, L.Name)
+			me.SQ_Detail_box[key]:setcell(0,2, L.Link)
+			iup.SetAttribute(me.SQ_Detail_box[key], "READONLY", "YES")
+			iup.SetAttribute(me.SQ_Detail_box[key], "ALIGNMENT0", "ACENTER")
+			iup.SetAttribute(me.SQ_Detail_box[key], "ALIGNMENT1", "ALEFT")
+			iup.SetAttribute(me.SQ_Detail_box[key], "ALIGNMENT2", "ALEFT")
+			iup.SetAttribute(me.SQ_Detail_box[key],"WIDTH0", "30")
+			iup.SetAttribute(me.SQ_Detail_box[key],"WIDTH1", "150")
+			iup.SetAttribute(me.SQ_Detail_box[key],"WIDTH2", "250")
+			for _, id in ipairs (info.quests) do	-- get the quests of the zone
+			--	print (dump(id))
+				me.SQ_Detail_box[key].numlin = Line
+				me.SQ_Detail_box[key]:setcell(Line,0, tostring(id))
+
+				if Ach_Detail[id] == nil then
+					name = "UNKN"
+				else
+					name = Ach_Detail[id].name
+				end
+				link = SQ_dat[id].link1
+				me.SQ_Detail_box[key]:setcell(Line,1, name)
+				me.SQ_Detail_box[key]:setcell(Line,2, link)
+				--print(name, link)
+				Line= Line+1
 			end
-			link = SQ_dat[id].link1
-			accounts[acc].name[char].SQ_Detail_box[key]:setcell(Line,1, name)
-			accounts[acc].name[char].SQ_Detail_box[key]:setcell(Line,2, link)
-			--print(name, link)
-			Line= Line+1
+			iup.Append(me.SQ_Detail_Zbox,me.SQ_Detail_box[key])
 		end
-		iup.Append(accounts[acc].name[char].SQ_Detail_Zbox,accounts[acc].name[char].SQ_Detail_box[key])
-	end



 --]]
 	 -- ====================================
 	--  == Prepare for the user display tabs
-		accounts[acc].name[char].tab = iup.vbox{
+		me.tab = iup.vbox{
 					["tabtitle"] = char,		-- This vbox will be a tab and the tab text is this

 					iup.hbox{		--Top Information bar
 							Alignment = "ACENTER",
-							iup.label{title=accounts[acc].name[char].gender, FONT="Times,BOLD,10"},
+							iup.label{title=me.gender, FONT="Times,BOLD,10"},
 							iup.label{title=thischar.Race .." / ".. thischar.Class, PADDING="10X0", FONT="Times,BOLD,10"},
 							iup.label{title=thischar.Alliance, PADDING="10X0"},
-							iup.label{title=L.Level .. ": ".. accounts[acc].name[char].levelstr, PADDING="10X0"},
+							iup.label{title=L.Level .. ": ".. me.levelstr, PADDING="10X0"},
 							iup.label{title=L.Created .. os.date(dateformat,thischar.Created), PADDING="10X0"},
 							iup.label{title=L.LLog .. os.date(dateformat,thischar.LoginTime), PADDING="10X0"},
-							iup.label{title=L.TPlayed .. accounts[acc].name[char].timeplayed .." " .. L.Hrs},
+							iup.label{title=L.TPlayed .. me.timeplayed .." " .. L.Hrs},
 							iup.fill{}
 							},
 					iup.label{SEPARATOR="HORIZONTAL"},
 					iup.vbox {		--Data tabs for Char
 						iup.tabs { iup.vbox {	["tabtitle"] =L.GrpDungeon,
 												iup.label{title=L.GrpLab,expand="HORIZONTAL"},
-												accounts[acc].name[char].Grp_box,
+												me.Grp_box,
 												iup.fill{}
 											},
 									iup.vbox {	["tabtitle"] =L.PubDungeon,
 												iup.label{title=L.PubLab,expand="HORIZONTAL"},
-												accounts[acc].name[char].Pub_box,
+												me.Pub_box,
 												iup.fill{}
 											},
 									iup.vbox {	["tabtitle"] =L.VetDungeon,
 												iup.label{title=L.VetLab,expand="HORIZONTAL"},
-												accounts[acc].name[char].Vet_box,
+												me.Vet_box,
 												iup.fill{}
 											},

 									iup.vbox {	["tabtitle"] =L.Leveling,
 										--		iup.label{title="LevLabel",expand="HORIZONTAL"},
-												accounts[acc].name[char].leveling_box,
+												me.leveling_box,
 												iup.fill{}
 											},
 									iup.vbox {	["tabtitle"] =L.Locations,
 											--	iup.label{title="LevLabel",expand="HORIZONTAL"},
-												accounts[acc].name[char].Map_box,
+												me.Map_box,
 												iup.fill{}
 											},
 									iup.vbox {	["tabtitle"] =L.WBosses,
 												iup.label{title=L.WBLab,expand="HORIZONTAL"},
-												accounts[acc].name[char].WB_box,
+												me.WB_box,
 												iup.fill{}
 											},
 									iup.vbox {	["tabtitle"] =L.SkillQuests,
 												iup.label{title=L.SkillLab,expand="HORIZONTAL"},
-												accounts[acc].name[char].SQ_box,
-									--			accounts[acc].name[char].SQ_Frame,
-										--		alabel,
-												iup.label{title="hello"},
-										--	myzbox,
-										--		SQ_Detail_Zbox[accounts[acc].lang],
-									 	--iup.zbox{alabel; alignment = "ACENTER"},
+												me.SQ_box,
+												iup.label{title="Detail"},
+
+												me.SQ_Detail_Zbox
 												iup.fill{}
 											},

 								},	-- end of tabs for dungeons
 							},
 					}  -- end of tabs for characters vbox
-				if SQ_Detail_Zbox[accounts[acc].lang] == nil then
-				print ("is Null")
-				end
-		iup.Append(accounts[acc].tabs,accounts[acc].name[char].tab)
+
+		iup.Append(accounts[acc].tabs,me.tab)

 		local panel =(#accounts[acc].names * 90)
 		if panel < 680  then