I get this error when trying to compile:
Quote: "Declaration name 'SYS_DisplayMode()' is not valid at line 68."
This line is highlighted: (which isn't line 68):
Quote: "global SYS_FrameTimer as SYS_FRAMETIMER_INFO"
Line 68 is this:
Quote: "set display mode SYS_DisplayMode(DMode).width, SYS_DisplayMode(DMode).height, SYS_DisplayMode(DMode).depth"
Have read through numerous posts on the forum and tried all kinds of suggested solutions, but the error remains...
Have tried Renaming variables, Removing comments, ReOrdering commands, even tried deleting the whole function and rewriting it...
Any ideas of how to fix this?
type SYS_MODE_INFO
width as integer
height as integer
depth as integer
endtype
type SYS_TIMER_INFO
duration as integer
remain as integer
elapsed as integer
active as boolean
endtype
type SYS_FRAMETIMER_INFO
old as integer
dif as integer
endtype
type SYS_MOUSE_INFO
x as integer
y as integer
mmx as integer
mmy as integer
click as integer
endtype
function SYS_Init()
global SYS_DisplayMode() as SYS_MODE_INFO
global SYS_Timer() as SYS_TIMER_INFO
global SYS_FrameTimer as SYS_FRAMETIMER_INFO
global SYS_Mouse as SYS_MOUSE_INFO
global SYS_NumDisplayModes as integer
global SYS_NumTimers as integer
global SYS_Valid as boolean
SYS_NumDisplayModes = 0
SYS_NumTimers = 0
SYS_BuildDisplayModeList()
SYS_Valid = 1
endfunction
function SYS_Terminate()
SYS_Valid = 0
SYS_NumTimers = 0
SYS_NumDisplayModes = 0
undim SYS_Timer()
undim SYS_DisplayMode()
endfunction
function SYS_Update()
if SYS_Valid = 1
SYS_FrameTimer.dif = hitimer() - SYS_FrameTimer.old
SYS_FrameTimer.old = hitimer()
SYS_UpdateTimers()
SYS_Mouse.x = MouseX()
SYS_Mouse.y = MouseY()
SYS_Mouse.mmx = MouseMoveX()
SYS_Mouse.mmy = MouseMoveY()
SYS_Mouse.click = MouseClick()
endif
endfunction
function SYS_SetDisplayMode(DMode as integer)
Success as boolean
Success = 0
dec DMode, 1
if SYS_NumDisplayModes > 0 and DMode >= 0 and DMode < SYS_NumDisplayModes
set display mode SYS_DisplayMode(DMode).width, SYS_DisplayMode(DMode).height, SYS_DisplayMode(DMode).depth
Success = 1
endif
endfunction Success
function SYS_BuildDisplayModeList()
perform checklist for display modes()
for i=1 to checklist quantity()
array insert at bottom SYS_DisplayMode()
SYS_DisplayMode().width = checklist value a(i)
SYS_DisplayMode().height = checklist value b(i)
SYS_DisplayMode().depth = checklist value c(i)
inc SYS_NumDisplayModes, 1
next i
endfunction
function SYS_GetDisplayMode(Width as integer, Height as integer, Depth as integer)
DMode as integer
DMode = 0
if SYS_NumDisplayModes > 0
do
for i=0 to SYS_NumDisplayModes-1
if SYS_DisplayMode(i).width = Width and SYS_DisplayMode(i).height = Height and SYS_DisplayMode(i).depth = Depth
DMode = i + 1
exitfunction DMode
endif
next i
if DMode = 0 and Depth = 32
Depth = 16
else
exitfunction DMode
endif
loop
endif
endfunction DMode
function SYS_CreateTimer(Duration as integer)
TimerIndex as integer
TimerIndex = -1
if SYS_Valid = 1 and Duration > 0
array insert at bottom SYS_Timer()
SYS_Timer().duration = Duration
SYS_Timer().elapsed = 0
SYS_Timer().remain = Duration
SYS_Timer().active = 0
TimerIndex = SYS_NumTimers
inc SYS_NumTimers, 1
endif
endfunction TimerIndex
function SYS_DeleteTimer(TimerIndex)
Success as boolean
Success = 0
if SYS_NumTimers > 0 and TimerIndex >= 0 and TimerIndex < SYS_NumTimers
array delete element SYS_Timer(), TimerIndex
dec SYS_NumTimers, 1
Success = 1
endif
endfunction Success
function SYS_StartTimer(TimerIndex as integer)
Success as boolean
Success = 0
if SYS_NumTimers > 0 and TimerIndex >= 0 and TimerIndex < SYS_NumTimers
SYS_Timer(TimerIndex).active = 1
Success = 1
endif
endfunction Success
function SYS_StopTimer(TimerIndex as integer)
Success as boolean
Success = 0
if SYS_NumTimers > 0 and TimerIndex >= 0 and TimerIndex < SYS_NumTimers
SYS_Timer(TimerIndex).active = 0
Success = 1
endif
endfunction Success
function SYS_ResetTimer(TimerIndex as integer)
Success as boolean
Success = 0
if SYS_NumTimers > 0 and TimerIndex >= 0 and TimerIndex < SYS_NumTimers
SYS_Timer(TimerIndex).remain = SYS_Timer(TimerIndex).duration
SYS_Timer(TimerIndex).elapsed = 0
Success = 1
endif
endfunction Success
function SYS_SetTimerDuration(TimerIndex as integer, Duration as integer)
Success as boolean
Success = 0
if SYS_NumTimers > 0 and TimerIndex >= 0 and TimerIndex < SYS_NumTimers
if Duration > 0
SYS_Timer(TimerIndex).duration = Duration
Success = 1
endif
endif
endfunction Success
function SYS_TimerDuration(TimerIndex as integer)
Duration as integer
Duration = -1
if SYS_NumTimers > 0 and TimerIndex >= 0 and TimerIndex < SYS_NumTimers
Duration = SYS_Timer(TimerIndex).duration
endif
endfunction Duration
function SYS_TimerRemain(TimerIndex as integer)
Remain as integer
Remain = -1
if SYS_NumTimers > 0 and TimerIndex >= 0 and TimerIndex < SYS_NumTimers
Remain = SYS_Timer(TimerIndex).remain
endif
endfunction Remain
function SYS_TimerElapsed(TimerIndex as integer)
Elapsed as integer
Elapsed = -1
if SYS_NumTimers > 0 and TimerIndex >= 0 and TimerIndex < SYS_NumTimers
Elapsed = SYS_Timer(TimerIndex).elapsed
endif
endfunction Elapsed
function SYS_TimerPercent(TimerIndex as integer)
Percent as float
Percent = -1.0
Elapsed as float
Duration as float
if SYS_NumTimers > 0 and TimerIndex >= 0 and TimerIndex < SYS_NumTimers
Elapsed = SYS_Timer(TimerIndex).elapsed
Duration = SYS_Timer(TimerIndex).duration
Percent = Elapsed / Duration
endif
endfunction Percent
function SYS_TimerActive(TimerIndex as integer)
Active as integer
Active = -1
if SYS_NumTimers > 0 and TimerIndex >= 0 and TimerIndex < SYS_NumTimers
Active = SYS_Timer(TimerIndex).remain
endif
endfunction Active
function SYS_TimerDone(TimerIndex as integer)
Done as integer
Done = -1
if SYS_NumTimers > 0 and TimerIndex >= 0 and TimerIndex < SYS_NumTimers
if SYS_Timer(TimerIndex).remain <= 0
Done = 1
else
Done = 0
endif
endif
endfunction Done
function SYS_UpdateTimers()
if SYS_NumTimers > 0
for i=0 to SYS_NumTimers-1
if SYS_Timer(i).active = 1
dec SYS_Timer(i).remain, SYS_FrameTimer.dif
SYS_Timer(i).elapsed = SYS_Timer(i).duration - SYS_Timer(i).remain
if SYS_Timer(i).remain <= 0
SYS_Timer(i).active = 0
SYS_Timer(i).remain = 0
SYS_Timer(i).elapsed = SYS_Timer(i).duration
endif
endif
next i
endif
endfunction