Global recurring timer

Freeform discussion about anything related to modding Transcendence.
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

I got my 50k!!!

Code: Select all

<Events> 
        <OnCreate>
             (block Nil
            	(objSetData gPlayerShip "ticker" 0)

            	(sysAddObjRecurringTimerEvent 30 gSource "OnCheckEntry")
             )
         </OnCreate>

         <OnCheckEntry>
             (block Nil
            (objIncData gPlayerShip "ticker" 1)
			(if (eq (objGetData gPlayership "ticker") 2)
				
				(plyCredit gPlayer 50000)
				
			 )
            (objSendMessage gPlayerShip Nil (cat "Tick: " (objGetData gPlayerShip "ticker")))
            )
         </OnCheckEntry>
</Events>

Try removing the if.. lol!!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

the line

(objSetData gPlayerShip "ticker" 0)

isn't working like you think it is working (see my previous post)

gPlayerShip is not set before the OnCreate of the player ship my last test proves it

edit: well we knew that you needed a delay don't forget we have non repeating events too 8)
Crying is not a proper retort!
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

I kind of thought that. So objIncData actually creates the ticker variable in gPlayership. I got the script from Apemant's timer sample and hadn't changed it. It was set up for a different object, though.
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

the problem comes from that other ships can be using your ship class so you can't assume that you will always be the player ship in the on create (this is all for the case of gplayership being gSource). So the only way to solve that (that I know of currently) is to have a delay.
Crying is not a proper retort!
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

So how does one solve the problem of the event being lost through systems?

is there something like an [OnGate] tag that can fix this?

This is a lot more complicated then I thought. I am really liking the idea of a global entity for storing events now!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

no but a <OnGateIn> event for the player would work (just reset the events for appropriate objects)

I would like both <OnGateIn> and <OnGateOut> events for player that way we can do things per system like doing thing when a player first enters a system
Last edited by Betelgeuse on Sat Mar 08, 2008 6:25 pm, edited 1 time in total.
Crying is not a proper retort!
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

Quick! get those on the list for 0.99 update!

I am really surprised there isn't a way to set a timer running outside of a system- I was hoping the playership would keep the timer around, and I think George thought it would as well.

Both Bobby and I tried attaching the timers to Stars and putting a background ticker in every system- this might be the temporary solution for you F50. If a timer is running in each system, and using the gPlayership to track the ticks, then the timer seems to be working between systems and updating continuously on the playership.
Post Reply