Event Procrastination

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
catfighter
Militia Commander
Militia Commander
Posts: 466
Joined: Fri Nov 08, 2013 5:17 am
Location: Laughing manically amidst the wreckage of the Iocrym fleet.

Although I was earlier told that it is not currently possible to delay a weapon's fire, I would like to ask more generally: Is it possible to make any part of the game pause for a specific amount of time? Many programming languages have a PAUSE function to make the program wait for a set amount of time before continuing execution of code (or some similar function), but I have not seen one in TLisp. Does such a function exist? Or is there a way to simulate one?

I wanted to use this for things like making a weapon delay fire to play a power-up sound effect, making a usable item have a short-term effect and then wait before starting a different long-term effect, or other similar applications. I am aware of the time-stop function, but I don't think it's usable for these kinds of things. I appreciate any help! :)
Behold my avatar, one of the few ships to be drawn out pixel by pixel in the dreaded... Microsoft Paint!

Day 31: "I have successfully completed my time reversal experiment! Muahahaha!!!"
Day 30: "I might have run into a little problem here."
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

You can simulate pause functionality by setting a timer and fire an event after x ticks. It ain't perfect, but it will result in delayed execution of your desired block of code.

~Pixelfck
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
User avatar
catfighter
Militia Commander
Militia Commander
Posts: 466
Joined: Fri Nov 08, 2013 5:17 am
Location: Laughing manically amidst the wreckage of the Iocrym fleet.

Thanks! But what's the code bit for "after x ticks"? (I don't have much experience outside of ships/weapons/shields/etc)
Behold my avatar, one of the few ships to be drawn out pixel by pixel in the dreaded... Microsoft Paint!

Day 31: "I have successfully completed my time reversal experiment! Muahahaha!!!"
Day 30: "I might have run into a little problem here."
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

You would get something like:

Code: Select all

<Events>
		<OnWeaponFire>
			(block Nil
				; your code here
				(sysAddObjTimerEvent 40 gSource "OnDelayedAction") ; 40 is the delay in ticks
				)
		</OnWeaponFire>
		
		<OnDelayedAction>
			(block Nil
				; your code here
				)
		</OnDelayedAction>
	</Events>
I'm not sure the <OnWeaponFire /> event exists or that it is the one you want, but it should serve as an example.

~Pixelfck
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Look for the timer functions on the current funclist or Xelerus. There are timers for stations, ships, overlays(I think?) and event handlers. You can use any of those objects to hold your code and execute them when it is time. If you have more questions about specifics please ask.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Post Reply