Thank you, I'm not sure where I was messing up but you helped me fix it. here is the whole thing
timer = {}
timer[1] = 0
------------------------------------------------------------------------------------------
------------------------------script config-----------------------------------------------
------------------------------------------------------------------------------------------
local tod_act = 1 -- if you want to see am or pm
local time_enabled = 1 -- if you want the player to open the clock or not.
local twenty_four_hour_clock = 0 --0 for 12 hour days 1 for 24 hour days
local day_hours = 12 -- how many hours in A day
-- CONFIGURE THE POSTION OF THE CLOCK
--image position as wrist
local watch_wrist_x = 20
local watch_wrist_y = 20
--image position as hud
local image_posx = 50
local image_posy = 50
local image_sizex = 10
local image_sizey = 10
local image_depth = 100
local text_size = 1
local hour_x = 15
local hour_y = 90
local minute_x = 17
local minute_y = 90
local second_x = 19
local second_y = 90
local tod_x = 21
local tod_y = 90
local twenty_four_hour_clock = 0 -- 0 = 12 hour clock 1 = 24 hour clock
local tod = "am" --time of day as in am and pm
watch_obtained = 0
------------------------------------------------------------------------------------------
------------------------------End of script config----------------------------------------
------------------------------------------------------------------------------------------
local second = 0
local minute = 0
local hour = 0
local show_clock = 0 -- button vars
local clock_pressed = 0 -- button var
local watch_loca = "hud" -- can be hud or wrist watch location
function clock_init(e)
watch_image = LoadImage("scriptbank\\images\\Marks\\000.png")
watch_sprite = CreateSprite(watch_image)
SetSpriteSize (watch_sprite , image_sizex,image_sizey)
SetSpriteDepth (watch_sprite, image_depth)
HideHuds()
end -- init
function clock_main(e) -- start main--------------------------------------------------------------------
------------------------------------------------------------------------------------------
------------------------------Button settup-----------------------------------------------
------------------------------------------------------------------------------------------
if GetScancode() == 44 and clock_pressed == 0 and time_enabled == 1 and watch_obtained == 1 then
clock_pressed = 1
if show_clock == 0 then
show_clock = 1
else
show_clock = 0
end
end
if GetScancode() == 0 then
clock_pressed = 0
end
if show_clock == 1 then
SetSpritePosition(watch_sprite,image_posx,image_posy)
elseif show_clock == 0 then
SetSpritePosition(watch_sprite,200,200)
end
------------------------------------------------------------------------------------------
------------------------------ The time set up -------------------------------------------
------------------------------------------------------------------------------------------
if show_clock == 1 then
if watch_loca == "hud" and watch_obtained == 1 then
TextCenterOnX(hour_x,hour_y,text_size,""..hour)
TextCenterOnX(minute_x,minute_y,text_size," : "..minute)
TextCenterOnX(second_x,second_y,text_size," : "..second)
if tod_act == 1 then
Text(tod_x,tod_y,1,""..tod)
end
elseif watch_loca == "wrist" and watch_obtained == 1 then
TextCenterOnX(hour_x,hour_y,text_size,""..hour)
TextCenterOnX(minute_x,minute_y,text_size," : "..minute)
TextCenterOnX(second_x,second_y,text_size," : "..second)
if tod_act == 1 then
Text(tod_x,tod_y,1,""..tod)
end
end
if timer[1] == 0 then
timer[1] = g_Time + 1000 -- timer
elseif g_Time > timer[1] then
-- time
timer[1] = g_Time + 1000
--PromptDuration("second has passed",250) DEBUGGING
second = second + 1
end
if second == 60 then
--PromptDuration("minute has passed",250) DEBUGGING
minute = minute + 1
second = 0
end
if minute == 60 then
--PromptDuration("hour has passed",250) DEBUGGING
hour = hour + 1
minute = 0
end
if hour == twenty_four_hour_clock == 0 then
hour = 1
--to change am and pm
if tod_act == 1 then
if tod == "am" then
tod = "pm"
elseif tod == "pm" then
tod = "am"
end
else
hour = 0
end
end
------------------------------------------------------------------------------------------
------------------------------ The time set up -------------------------------------------
------------------------------------------------------------------------------------------
end -- --show the clock
end -- new end main
I set it up for configuration, I've spent probably 2 days on this script and I've learned a lot from every one. This will eventually be my hud hopefully for my game. I had intended making it either come up as a watch in the center of the screen with a larger image, or be hud at the bottom of the screen but in due time.
the image, the attach files thing wouldn't load.
https://www.dropbox.com/s/btd0j5mpjvgj2n7/000.png?dl=0Markchapman10 is my Skype let's have some dev talk.