I can't seem to get a list to work in objSetData.
Also, what about storing lists in a list attached to gPlayerShip.
Basically, I want to store some info: a time stamp and a function to perform.
These two items are a list for each event.
The events are on a list together in gPlayership
I want to go through this list and compare the time stamp to the current time.
If the event time is equal to the current time, I want to perform an event (a message in this test case)
But I don't seem to understand how to store a list in a list as a variable in gPlayership.
Code: Select all
;this initializes the event list
(block (timeStamp)
(setq timeStamp 3)
(block (eventOne)
(setq eventOne (list timeStamp "message"))
(objSetData gPlayerShip "activeEventList" eventOne)
)
)
;then this function is performed when the ticker updates from the global timer
(setq tmrUpdateEventTimer (lambda Nil
;this is the function to see if there is an event for this cycle
(block (eventList currentTick)
;get some data from playership
(setq currentTick (objGetData gPlayerShip "ticker"))
(setq eventList (objGetData gPlayerShip "activeEventList"))
(block (event)
(enum eventList event
(block (time)
(setq time (item event 1)
(if (leq time currentTick)
(block (toDo)
(setq toDo (item event 2))
(tmrActiveEvent toDo)
)
)
)
)
)
)
)
))
(setq tmrActiveEvent (lambda (eventType)
(block Nil
(objSendMessage gPlayerShip Nil (cat "Message is: " eventType))
)
))