Post by Wiccaan on Feb 14, 2006 18:33:43 GMT -5
Simple script with nothing major yet. Just some basics to show info about yourself, your target, and your EXP. EXP thanks to Nebula. Im releasing this with no copy write, so do what ever you want with it. I added the version / author thing cause it seems to be needed. But Im not worried about what you do with it. As I said its nothing major.
(Also, note that most of the things dont work because the FFXIRead.dll has yet to be updated since Decembers update. I have the new offsets if they are needed. Tiny PM me if you need them.)
Edit:: Eww.. proboards sucks lol removes indentation ; ;
(Also, note that most of the things dont work because the FFXIRead.dll has yet to be updated since Decembers update. I have the new offsets if they are needed. Tiny PM me if you need them.)
------------------------------------------------------------
-- Basic Configuration Settings
------------------------------------------------------------
-- INIFile : Name of INI File. Used for Window Size.
----------------------------------------------------
INIFile = "windower.ini"
-- Display Location (PlayerMon)
-------------------------------
XPos = 18
YPos = 45
-- Font Used While Displaying
------------------------------
DisplayFont = "Courier New"
FontSize = 8
-- Stats Settings
------------------
--// Overall Displays
DisplayPlayerS = true -- Overall Player Display
DisplayTargetS = true -- Overall Target Display
DisplayExpS = true -- Overall ExpWatch Display
-- Values False are Broken due to FFXIRead.dll
--// Player Monitor Display
DisplayName = true
DisplayJob = true
DisplayTNL = true
DisplayGil = true
DisplayCoords = true
--// Target Monitor Display
DisplayTargetName = true
DisplayTargetHP = true
DisplayTargetDist = true
--// ExpWatch Display
DisplayGain = true
DisplayAverage = true
DisplayExpHR = true
DisplayTTL = true
DisplayMTL = true
------------------------------------------------------------
-- Script Properties ( Do Not Edit )
------------------------------------------------------------
Windower.script_SetVersion(".1")
Windower.script_SetAuthor("Wiccaan")
Windower.script_SetContact("wiccaan@comcast.net")
Windower.console_Write(" ")
Windower.console_Write("FFXIMonitor -- By Wiccaan")
Windower.console_Write("Thanks to TinyTerror and Nebula")
Windower.console_Write(" ")
resY = 600 --value incase unable to load from ini and not in the cmdline
function loadcfg ()
local cfg = assert(io.open("../../../"..INIFile,"r"))
for line in cfg:lines() do
if string.find(line,"Y Resolution") then
local Y = tonumber(string.sub(line,string.find(line,"%d+")))
if math.mod(Y*(4/3),16)==0 then resY = Y end --make sure its a valid res
break
end
end
end
pcall(loadcfg) --don't hang on not being able to open the config
------------------------------------------------------------
-- Create Our Text Object
------------------------------------------------------------
PlayerMonTxt = Graphics.text_CreateObject()
Graphics.text_SetPosition(XPos,YPos,PlayerMonTxt)
Graphics.text_SetColor(255,255,255,255,PlayerMonTxt)
Graphics.text_SetFont(DisplayFont,FontSize,PlayerMonTxt)
Graphics.text_SetBold(true,PlayerMonTxt)
ExpMonTxt = Graphics.text_CreateObject()
Graphics.text_SetBGColor(145,242,123,67,ExpMonTxt)
Graphics.text_SetPosition(XPos,resY-18,ExpMonTxt)
Graphics.text_SetColor(255,255,255,255,ExpMonTxt)
Graphics.text_SetFont(DisplayFont,FontSize,ExpMonTxt)
Graphics.text_SetBold(true,ExpMonTxt)
-- Loading Text Sections
--------------------------------
Graphics.text_SetText("Loading...",PlayerMonTxt)
Graphics.text_SetText("Loading...",ExpMonTxt)
------------------------------------------------------------
-- ExpWatch Variables
-- Add / Change If Needed
------------------------------------------------------------
Exp = FFXI.player_GetCurrentXP()
ExpD = 0
ExpMax = 0
ExpTnl = 0
ExpTotal = 0
ExpHr = 0
ExpTime = 0
tStart = 0
MobCnt = 0
ExpAvg = 0
ExpMTL = 0
ExpTTL = 0
Job = FFXI.player_GetMainJob()
Level = FFXI.player_GetMainJobLevel()
Visible = 1
------------------------------------------------------------
-- Get Job Name From ID Number
-- This will return the jobs 3 letter abbreviation
-- from the ID number read from memory.
-- (Thanks to Nebula)
------------------------------------------------------------
function GetJobName(id)
local name, id = "", tonumber(id)
if id == 1 then name="WAR"
elseif id == 2 then name="MNK"
elseif id == 3 then name="WHM"
elseif id == 4 then name="BLM"
elseif id == 5 then name="RDM"
elseif id == 6 then name="THF"
elseif id == 7 then name="PLD"
elseif id == 8 then name="DRK"
elseif id == 9 then name="BST"
elseif id == 10 then name="BRD"
elseif id == 11 then name="RNG"
elseif id == 12 then name="SAM"
elseif id == 13 then name="NIN"
elseif id == 14 then name="DRG"
elseif id == 15 then name="SMN"
else name="---"
end
return name
end
------------------------------------------------------------
-- Reset Variables
-- This is used to clear the variables to hold new info
-- after each loop.
------------------------------------------------------------
function reset()
Exp = FFXI.player_GetCurrentXP()
ExpD = 0
ExpMax = 0
ExpTnl = 0
ExpTotal = 0
ExpHr = 0
ExpTime = 0
tStart = 0
MobCnt = 0
ExpAvg = 0
ExpMTL = 0
ExpTTL = 0
Job = FFXI.player_GetMainJob()
Level = FFXI.player_GetMainJobLevel()
show()
end
function user_reset()
reset()
Output = "Resetting PlayerMon..."
Graphics.text_SetText(Output,PlayerMonTxt)
Output = "Resetting ExpMon..."
Graphics.text_SetText(Output,ExpMonTxt)
Windower.script_Sleep(2000)
return true
end
function hide ()
Visible = 0
return Graphics.text_HideAll()
end
function show ()
Visible = 1
return Graphics.text_ShowAll()
end
------------------------------------------------------------
-- String Manipulation Functions
-- Format Time -- Put Time Into H:I:S Format
-- Format Number -- Replace String Int with Commas
------------------------------------------------------------
function format_time(seconds)
return string.format('%02d:%02d:%02d',math.floor(seconds/3600),math.mod(math.floor(seconds/60),60),math.mod(seconds,60))
end
function format_number(num)
local len, tmp = string.len(num), ""
for i=len,1,-1 do
if math.mod(len-(i-1)-1,3)==0 and i ~= len then
tmp = string.char(string.byte(num,i))..","..tmp;
else
tmp = string.char(string.byte(num,i))..tmp;
end
end
return tmp;
end
------------------------------------------------------------
-- Command Processing
-- Commands Used For Lunar Console
------------------------------------------------------------
function ProcessCommand (Command)
if Command == "show" then show()
elseif Command == "hide" then hide()
elseif Command == "reset" then user_reset()
end
end
function ProcessCommands ()
for i=1, Windower.script_GetCommandCount(), 1 do
ProcessCommand(Windower.script_GetCommand())
end
end
------------------------------------------------------------
------------------------------------------------------------
--- MAIN LOOP -- DO NOT EDIT --
------------------------------------------------------------
------------------------------------------------------------
while true do
ProcessCommands()
------------------------------------------------------------
-- Set Global Variables To Hold Player Info
------------------------------------------------------------
PlayerName = FFXI.player_GetName()
PlayerGil = FFXI.player_GetCurrentGil()
PlayerJob = GetJobName(FFXI.player_GetMainJob())
PlayerSub = GetJobName(FFXI.player_GetSubJob())
PlayerJobLvl = FFXI.player_GetMainJobLevel()
PlayerSubLvl = FFXI.player_GetSubJobLevel()
PlayerX = FFXI.player_GetXPos()
PlayerY = FFXI.player_GetYPos()
PlayerZ = FFXI.player_GetZPos()
PlayerHP = FFXI.player_GetCurrentHP()
PlayerHPMax = FFXI.player_GetMaxHP()
PlayerMP = FFXI.player_GetCurrentMP()
PlayerMPMax = FFXI.player_GetMaxMP()
PlayerExp = FFXI.player_GetCurrentXP()
PlayerExpMax = FFXI.player_GetLevelXP()
PlayerExpTnl = FFXI.player_GetRemainingXP()
TargetName = FFXI.target_GetName()
TargetHPP = FFXI.target_GetHPPercent()
TargetDistance = FFXI.target_GetTargetDistance()
------------------------------------------------------------
-- ===================================================================================
-- == Player Monitor Section
-- == All Player Monitor Scripting Found Here.
-- ===================================================================================
-- Global Output Section
Border = string.format("==================================\n")
BorderThin = string.format("----------------------------------\n")
LineBreak = string.format("\n")
-- Borders
PlayerBorderTop = string.format("== Player Status =================\n")
TargetBorderTop = string.format("== Target Status =================\n")
-- Player Status Section
NameString = string.format("| Name : %s \n", PlayerName)
-- Remove Job Lvl If No Job Present
if (PlayerJob == "---") then PlayerJobLvl = "" end
if (PlayerSub == "---") then PlayerSubLvl = "" end
JobString = string.format("| Job : %s%s/%s%s \n",PlayerJob,PlayerJobLvl,PlayerSub,PlayerSubLvl)
PlayerTNL = string.format("| TNL : %s \n", PlayerExpTnl)
TotalGil = string.format("| Gil : %s \n", PlayerGil)
CoordString = string.format("| CurX : %s\n| CurY : %s\n| CurZ : %s\n",PlayerX,PlayerY,PlayerZ)
-- Target Status Section
TNameString = string.format("| Name : %s \n", TargetName)
-- If No Target Remove HP
if (TargetName == "") then
THPString = string.format("| HP : \n")
else
THPString = string.format("| HP : %s \n", TargetHPP)
end
TDString = string.format("| Dist : %s \n", TargetDistance)
Output = ""
if DisplayPlayerS then
Output = Output .. string.format(PlayerBorderTop)
Output = Output .. string.format(BorderThin)
if DisplayName then Output = Output .. string.format(NameString) end
if DisplayJob then Output = Output .. string.format(JobString) end
if DisplayTNL then Output = Output .. string.format(PlayerTNL) end
if DisplayGil then Output = Output .. string.format(TotalGil) end
if DisplayCoords then Output = Output .. string.format(CoordString) end
Output = Output .. string.format(Border)
end
Output = Output .. string.format(LineBreak)
if DisplayTargetS then
Output = Output .. string.format(TargetBorderTop)
Output = Output .. string.format(BorderThin)
if DisplayTargetName then Output = Output .. string.format(TNameString) end
if DisplayTargetHP then Output = Output .. string.format(THPString) end
if DisplayTargetDist then Output = Output .. string.format(TDString) end
Output = Output .. string.format(Border)
end
Graphics.text_SetText(Output,PlayerMonTxt)
-- ===================================================================================
-- == Exp Monitor Section
-- == All Exp Monitor Scripting Found Here.
-- ===================================================================================
-- Check For Zoning
if FFXI.player_GetLevelXP() == 0 then
Output2 = "Zoning or not yet logged in..."
reset()
else
ExpD = FFXI.player_GetCurrentXP()
--------------------
-- Switching Jobs --
--------------------
if Job ~= FFXI.player_GetMainJob() then
Output2 = "Changing Jobs..."
reset()
end
--------------
-- Leveling --
--------------
if Level ~= FFXI.player_GetMainJobLevel() and tStart ~= 0 and Exp ~= ExpD then
local LevelD = FFXI.player_GetMainJobLevel()
if LevelD > Level then --level up
ExpTotal = ExpTotal + ExpTnl
Exp = 0
else
ExpTotal = ExpTotal - (FFXI.player_GetRemainingXP() + Exp)
Exp = FFXI.player_GetCurrentXP()
end
Level = LevelD
end
----------------
-- Exp Change --
----------------
if Exp ~= ExpD then
if ExpD > Exp then
if tStart == 0 then
tStart = os.clock()
ExpTime = 0
end
MobCnt = MobCnt + 1
end
----------------------
-- Random Death Fix --
----------------------
if tStart ~= 0 then
ExpTotal = ExpTotal + (ExpD-Exp)
ExpAvg = math.floor( ExpTotal/MobCnt )
end
end
Exp = FFXI.player_GetCurrentXP()
ExpTnl = FFXI.player_GetRemainingXP()
ExpMax = FFXI.player_GetLevelXP()
if tStart ~= 0 then
ExpTime = os.difftime(os.clock(),tStart)
ExpMTL = math.ceil( ExpTnl/ExpAvg )
ExpHr = math.floor( (ExpTotal/((ExpTime/3600)+1)) * (3600/ExpTime) )
ExpTTL = (ExpTnl/ExpHr) * 3600
if ExpHr == 0 then reset() end
end
-- Display ExpWatcher
Output2 = ""
if DisplayExpS then
Output2 = Output2 .. string.format("EXP: %s/%s TNL: %s ",format_number(Exp),format_number(ExpMax),format_number(ExpTnl))
if DisplayGain then Output2 = Output2 .. string.format("Gain: %s ",format_number(ExpTotal)) end
if DisplayAverage then Output2 = Output2 .. string.format("Avg: %s ",format_number(ExpAvg)) end
if DisplayExpHr then Output2 = Output2 .. string.format("Exp/Hr: %s ",format_number(ExpHr)) end
if DisplayTTL then Output2 = Output2 .. string.format("TTL: %s ",format_time(ExpTTL)) end
if DisplayMTL then Output2 = Output2 .. string.format("Mobs/Lvl: %s ",format_number(ExpMTL)) end
end
end
Graphics.text_SetText(Output2,ExpMonTxt)
Windower.script_Sleep(100)
end
Edit:: Eww.. proboards sucks lol removes indentation ; ;