onFireWeapon with missiles

Freeform discussion about anything related to modding Transcendence.
Post Reply
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

Is there a way to get onFireWeapon to work with missiles? I have a launcher that's capable of firing Dragonfly cartridges, but onFireWeapon doesn't seem to work when inside the code of an ammo type.

I'd prefer not to use onFireWeapon inside the code of the launcher itself, as that code is created using typCreate and should be as clean as possible for forward compatibility. It's easier to change code for an overwritten missile than it is for a typCreated weapon, as the latter is difficult to troubleshoot. (typGetXML doesn't pull up XML for typCreated weapons, which makes it impossible to read the XML of a device created that way, and I can't modify the code on the fly and then re-load the game in order to test stuff.)
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?

I don't think missiles have events in general, so you might be forced to have it on the missile. If you want to look at XML of typcreated weapons just do
(PrintTo 'log (typGetXML ...))
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.
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

Have you been able to successfully pull up the XML of a typCreated weapon? I get Nil if I try to do it in the debug console.
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?

Checking it out, if not I'll make a ticket on ministry.

Uh one workaround might be to store all of the typcreated XML onto a unid using TypSetData then use TypGetData to get the XML but dunno if it gets stored as XML or something else.
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.
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

RPC wrote:Checking it out, if not I'll make a ticket on ministry.

Uh one workaround might be to store all of the typcreated XML onto a unid using TypSetData then use TypGetData to get the XML but dunno if it gets stored as XML or something else.
Thanks! Let me know if you can get the XML to pull up.

Yeah, I was going to save the XML somewhere and then pull it back out later as a workaround. That would work for any items I typCreate but not for typCreated items made by other mods and then accessed by my own mod, of course.

There's a function that can turn a normal string into XML. I'm not 100% sure, but I think XML is its own type of string, as I've had the XML manipulation functions fail before on normal strings that I construct myself. The strings work if I run them through XMLcreate:

(xmlCreate xml) -> xml

http://multiverse.kronosaur.com/news.hexm?id=1063
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?

Yeah TypSetData/TypGetData work. You can also typCreate from TypGetData that gets the xml you stored earlier so no need to make it into a string (I think the XML types we are feeding into TypCreate are valid string representations of XML anyways).
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.
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

RPC wrote:Yeah TypSetData/TypGetData work. You can also typCreate from TypGetData that gets the xml you stored earlier so no need to make it into a string (I think the XML types we are feeding into TypCreate are valid string representations of XML anyways).
String manipulation functions like (find) work on XML strings, so the data type is treated like a string for practical purposes. It is strange that feeding a string I've built myself into the XML manipulation functions doesn't always work. I don't know if there's a way to check directly if there are two different types of strings, XML strings and 'normal' strings.
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?

I don't know if there's a way to check directly if there are two different types of strings, XML strings and 'normal' strings.
Good point. I think that for the purposes of TLISP they're treated the same and that TypCreate is really just a string-> XML function.
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.
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

There's specifically a function for turning normal strings into XML:

(xmlCreate xml) -> xml

I've had to use this on occasion when the XML manipulation functions throw an error.
Post Reply