Post by senoska on Jan 19, 2006 9:04:10 GMT -5
Im really new at this, acually this is the frist thing I wrote, Im sure you will notice a fimiler script ^^; I plan to add more (such as airship timers etc) HOW EVER I have a problem I need fixing, and I know for 100% a fact its a nub mistake.
Thanks
-Senoska
Thanks
-Senoska
Windower.console_SetVisible(False)
Windower.console_Clear()
Windower.console_Write("Welcome to FFConsole")
Windower.script_Sleep(1000)
Windower.console_Write("Scripted, and tested by Team - Tarutaru and other scripters.")
Windower.script_Sleep(1000)
Windower.console_Write("Have fun!")
Windower.script_Sleep(1000)
-----------------------------------------------------------------------
----------------------Graphics and text-------------------------
-----------------------------------------------------------------------
Recast=Graphics.primitive_CreateObject( )
Graphics.primitive_SetColor(50,0,0,225,Recast)
Graphics.primitive_SetPosition(371,83,Recast)
Graphics.primitive_SetSize(300, 100,Recast)
Consoler=Graphics.primitive_CreateObject( )
Graphics.primitive_SetColor(50,0,0,225,Consoler)
Graphics.primitive_SetPosition(371,48,Consoler)
Graphics.primitive_SetSize(300, 32,Consoler)
Consoler1=Graphics.primitive_CreateObject( )
Graphics.primitive_SetColor(50,0,0,225,Consoler1)
Graphics.primitive_SetPosition(18,584,Consoler1)
Graphics.primitive_SetSize(652,15,Consoler1)
Console1=Graphics.text_CreateObject()
Graphics.text_SetPosition(18,584,Console1)
Graphics.text_SetFont("Arial",10,Console1)
Graphics.text_SetColor(255,0,255,0,Console1)
Graphics.text_SetVisibility(1,Console1)
TargetIn=Graphics.text_CreateObject()
Graphics.text_SetPosition(371,48,TargetIn)
Graphics.text_SetFont("Arial",10,TargetIn)
Graphics.text_SetColor(255,0,255,0,TargetIn)
Graphics.text_SetVisibility(1,TargetIn)
Recast=Graphics.text_CreateObject()
Graphics.text_SetPosition(371,83,Recast)
Graphics.text_SetFont("Arial",10,Recast)
Graphics.text_SetColor(255,0,255,0,Recast)
Graphics.text_SetVisibility(1,Recast)
-----------------------------------------------------------------------
------------------------Target Info--------------------------------
-----------------------------------------------------------------------
while true do
Name=FFXI.target_GetName( )
CurrentHP=FFXI.player_GetCurrentHP( )
CurrentMP=FFXI.player_GetCurrentMP( )
HPMax=FFXI.player_GetMaxHP()
MPMax=FFXI.player_GetMaxMP()
TP=FFXI.player_GetCurrentTP()
HPP=FFXI.target_GetHPPercent( )
CurrentGil=FFXI.player_GetCurrentGil( )
ChatLine=string.format(" Target Name: %s Target HP: %s\r\n HP: %s/%s MP: %s/%s TP: %s\r\n",Name, HPP, CurrentHP, HPMax, CurrentMP, MPMax, TP)
Graphics.text_SetText(ChatLine,TargetIn)
MainLevel=FFXI.player_GetMainJobLevel( )
SubLevel=FFXI.player_GetSubJobLevel( )
CurrentXP=FFXI.player_GetCurrentXP( )
RemainingXP=FFXI.player_GetRemainingXP( )
LevelXP=FFXI.player_GetLevelXP( )
ChatLine=string.format("Level:%s/%s Current EXP:%s/%s TNL:%s",MainLevel,SubLevel,CurrentXP,LevelXP,RemainingXP)
Graphics.text_SetText(ChatLine,Console1)
-----------------------------------------------------------------------
------------------------Recast Timers--------------------------
-----------------------------------------------------------------------
RemainingXP=FFXI.player_GetRemainingXP( )
ChatLine=string.format(" Recast Timers:", Recast)
Graphics.text_SetText(ChatLine,Recast)
a=true
b=0
commandstring=""
init1 = 0
init2 = 0
init3 = 0
init4 = 0
init5 = 0
init6 = 0
on1=false
on2 = false
on3 = false
on4 = false
on5 = false
on6 = false
label1 = ""
label2 = ""
label3 = ""
label4 = ""
label5 = ""
label6 = ""
time1 = 0
time2 = 0
time3 = 0
time4 = 0
time5 = 0
time6 = 0
t1 = Graphics.text_CreateObject()
Graphics.text_SetColor(255,0,255,0, t1)
Graphics.text_SetPosition(378,100, t1)
Graphics.text_SetBold(true, t1)
t2 = Graphics.text_CreateObject()
Graphics.text_SetColor(255,0,255,0, t2)
Graphics.text_SetPosition(378,116, t2)
Graphics.text_SetBold(true, t2)
t3 = Graphics.text_CreateObject()
Graphics.text_SetColor(255,0,255,0, t3)
Graphics.text_SetPosition(378,132, t3)
Graphics.text_SetBold(true, t3)
t4 = Graphics.text_CreateObject()
Graphics.text_SetColor(255,0,255,0, t4)
Graphics.text_SetPosition(378,148, t4)
Graphics.text_SetBold(true, t4)
t5 = Graphics.text_CreateObject()
Graphics.text_SetColor(255,0,255,0, t5)
Graphics.text_SetPosition(340, 35, t5)
Graphics.text_SetBold(true, t5)
t6 = Graphics.text_CreateObject()
Graphics.text_SetColor(255,0,255,0, t6)
Graphics.text_SetPosition(420, 35, t6)
Graphics.text_SetBold(true, t6)
t7 = Graphics.text_CreateObject()
Graphics.text_SetColor(255,0,255,0, t7)
Graphics.text_SetPosition(20, 90, t7)
--functions-------
function start(timernum, t, label)
if timernum == "1" then
on1 = true
label1 = label
time1 = tonumber(t)
init1 = os.clock()
Graphics.text_SetText(label1 .. ": " .. time1, t1)
elseif timernum == "2" then
on2 = true
label2 = label
time2 = tonumber(t)
init2 = os.clock()
Graphics.text_SetText(label2 .. ": " .. time2, t2)
elseif timernum == "3" then
on3 = true
label3 = label
time3 = tonumber(t)
init3 = os.clock()
Graphics.text_SetText(label3 .. ": " .. time3, t3)
elseif timernum == "4" then
on4 = true
label4 = label
time4 = tonumber(t)
init4 = os.clock()
Graphics.text_SetText(label4 .. ": " .. time4, t4)
elseif timernum == "5" then
on5 = true
label5 = label
time5 = tonumber(t)
init5 = os.clock()
Graphics.text_SetText(label5 .. ": " .. time5, t5)
elseif timernum == "6" then
on6 = true
label6 = label
time6 = tonumber(t)
init6 = os.clock()
Graphics.text_SetText(label6 .. ": " .. time6, t6)
else
Graphics.text_SetText("Timer.Start: Error: invalid timer#", t7)
end
return 0
end
function off(tnum)
tnum = tonumber(tnum)
if tnum == 1 then
on1 = false
Graphics.text_SetText("", t1)
elseif tnum == 2 then
on2 = false
Graphics.text_SetText("", t2)
elseif tnum == 3 then
on3 = false
Graphics.text_SetText("", t3)
elseif tnum == 4 then
on4 = false
Graphics.text_SetText("", t4)
elseif tnum == 5 then
on5 = false
Graphics.text_SetText("", t5)
elseif tnum == 6 then
on6 = false
Graphics.text_SetText("", t6)
else
Graphics.text_SetText("Timer.Off: Error: invalid timer#", t7)
end
return 0
end
function commandcheck()
if Windower.script_GetCommandCount() > 0 then
while Windower.script_GetCommandCount() > 0 do
commandstring=Windower.script_GetCommand()
if commandstring == "start" then
arg1 = Windower.script_GetCommand()
arg2 = Windower.script_GetCommand()
arg3 = Windower.script_GetCommand()
start(arg1, arg2, arg3)
elseif commandstring == "off" then
arg1 = Windower.script_GetCommand()
off(arg1)
else
Control.control_SendString("/echo Timer command invalid.")
end
end
end
return 0
end
function roundnum(n)
local basenum = math.floor(n)
if n - basenum > .5 then
return math.ceil(n)
else
return math.floor(n)
end
end
--While loop for countdown/update------------------------
while a == true do
commandcheck()
if on1 then
elapsed = os.clock() - init1
ctime = time1 - elapsed
if ctime < 0 then ctime = 0 end
Graphics.text_SetText(label1 .. ": " .. roundnum(ctime), t1)
end
if on2 then
elapsed = os.clock() - init2
ctime = time2 - elapsed
if ctime < 0 then ctime = 0 end
Graphics.text_SetText(label2 .. ": " .. roundnum(ctime), t2)
end
if on3 then
elapsed = os.clock() - init3
ctime = time3 - elapsed
if ctime < 0 then ctime = 0 end
Graphics.text_SetText(label3 .. ": " .. roundnum(ctime), t3)
end
if on4 then
elapsed = os.clock() - init4
ctime = time4 - elapsed
if ctime < 0 then ctime = 0 end
Graphics.text_SetText(label4 .. ": " .. roundnum(ctime), t4)
end
if on5 then
elapsed = os.clock() - init5
ctime = time5 - elapsed
if ctime < 0 then ctime = 0 end
Graphics.text_SetText(label5 .. ": " .. roundnum(ctime), t5)
end
if on6 then
elapsed = os.clock() - init6
ctime = time6 - elapsed
if ctime < 0 then ctime = 0 end
Graphics.text_SetText(label6 .. ": " .. roundnum(ctime), t6)
end
end
Windower.script_Sleep(1000)
end