Hi Eros, Roberto and Petr.

before I spend several hours via trial and error, I wanna ask the masters of module creation first.

I'm working on a new module to manage game events. I have a function that will have a row of optional
parameters. How do I parse it? Here is the code so far. Please look at the commented line under the function header.
This is the format of the command.

[code=thinbasic]

'----------------------------------------------------------------------------
Function EV_AddEvent() As Ext
'Add ( functionName [,startTime [, eventType [,eventGroup [, activeFlag ]]]]) As eventID
'----------------------------------------------------------------------------
Local fname As String
Local evtype As Ext

If thinBasic_CheckOpenParens() Then
thinBasic_ParseString fname
If thinBasic_CheckComma() Then
thinBasic_ParseNumber evtype
If thinBasic_CheckCloseParens() Then

newevent = memalloc(SizeOf(tEvent))

eventid = eventid + 1

@newevent.eventID = eventid
@newevent.eventGroup = 0
@newevent.objectID = 0
@newevent.eventType = evType
@newevent.startTime = 0
@newevent.intervalCount = 0
@newevent.intervalTime = 0
@newevent.endTime = 0
@newevent.repeatflag = 0
@newevent.activeflag = 0
@newevent.funcName = fname
@newevent.pUDT = 0
@newevent.preEvent = lastevent
@newevent.postEvent = 0

currevent = newevent
If eventcount = 0 Then
firstevent = newevent
Else
@lastevent.postevent = newevent
End If
eventcount = eventcount + 1
lastevent = newevent
'MsgBox (Trim$(@newevent.funcName))

Function = eventID
End If
End If
End If
End Function


[/code]