unvSetExtensionData and consoles

Found a bug in the game? Post it in one of the applicable sub forums depending on the version you are using. Tech support is also available in the Tech Support subforum.
Post Reply
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

I was trying to test out unvSetExtensionData using the transdata /run and it didn't work. Maybe we would have a general area where mods all can communicate and the console can get/set from that.
Crying is not a proper retort!
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

it didnt work because there is no Extension loaded (i would guess) but an area where everything can communicate is a good idea, maybe change the function to
(unvSetExtensionData extensionunid scope attrib data) and (unvGetExtensionData extensionunid scope attrib)
even tho that could cause issues and allow mods to screw other peoples data...
maybe a new local only command with above syntax will work
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Betelgeuse wrote:I was trying to test out unvSetExtensionData using the transdata /run and it didn't work. Maybe we would have a general area where mods all can communicate and the console can get/set from that.
You're right. Unfortunately, TransData is does not currently handle storage (it doesn't load or save the Storage.xml file). If you can file a ticket for that, I believe I can fix it.

As for a common storage, you can implement that on your own:

1. Create an extension with a <Globals> section. Something like:

Code: Select all

(setq betelsGlobalWrite (lambda (key value)
   (unvSetExtensionData 'local key value)
   ))

(setq betelsGlobalRead (lambda (key value)
   (unvGetExtensionData 'local key value)
   ))
2. Since the two functions above are defined inside a given extension, they will always write to that extension's private area. Other extensions can use those functions, thus sharing the private area.
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?

Just to clarify, I used this and it worked (instead of George's example for betelsGlobalRead ):

Code: Select all

			(setq RPCGlobalWrite (lambda (key value)
			   (unvSetExtensionData 'local key value)
			   ))
			;(unvGetExtensionData scope attrib)
			(setq RPCGlobalRead (lambda (key)
			   (unvGetExtensionData 'local key)
			   ))
unvGetExtensionData probably shouldn't have the 2nd argument, but I don't know, I'm pretty new to this as well >.<
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