items questions on fire event and eq

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

I have some questions. :)

When you fire an item event with objFireItemEvent does gItem and gSource get set and reset when it gets returned or is it up to the caller to do those things?

Given two devices of the same type and data installed on a single ship would they evaluate eq to True?
Given two armors of the same type and data installed on a single ship would they evaluate eq to True?

bonus question: In onUninstall is gItem installed. (assuming gItem is the item being uninstalled)
Crying is not a proper retort!
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Betelgeuse wrote:I have some questions. :)

When you fire an item event with objFireItemEvent does gItem and gSource get set and reset when it gets returned or is it up to the caller to do those things?
gItem and gSource are set and reset.
Betelgeuse wrote:Given two devices of the same type and data installed on a single ship would they evaluate eq to True?
Given two armors of the same type and data installed on a single ship would they evaluate eq to True?
No, in both cases. The installation location will be different for each item (a different device slot or a different armor segment location).
Betelgeuse wrote:bonus question: In onUninstall is gItem installed. (assuming gItem is the item being uninstalled)
There may be a bug here.

For devices, it is called BEFORE the item is uninstalled. But for armor, it is called just AFTER.

I think for armor I will move the call to before the item is uninstalled.

Note that in either case, the item is in a transition state. The original goal of the OnUninstall event is to give you a hook to undo things that the item did on install (such as add an overlay to the ship). If you try to manipulate the item itself, there probably are bugs and unintended consequences.

Also, in the future I will provide a way to prevent an item from being uninstalled.
User avatar
Aeonic
Militia Commander
Militia Commander
Posts: 469
Joined: Sun Jun 14, 2009 1:05 am
Location: Designing his dream ship.

george moromisato wrote:Also, in the future I will provide a way to prevent an item from being uninstalled.
Sweet. I've always wanted some evil Advanced Sentient Patch Spiders that cling to your ship and eat your hull until you manage to get them blasted off.
Last Cause Of Death: Destroyed by Karl Svalbard's last Lucifer missile, right after I blew him up. And the crowd cheers.
Image
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

thanks, in onUnInstall I want to do stuff based on installed items, but now that I know that eq evaluates to nil even in cases where everything other than location is the same makes it possible to filter out the current item (because it isn't going to be installed after the event occurs)
Crying is not a proper retort!
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Betelgeuse wrote:thanks, in onUnInstall I want to do stuff based on installed items, but now that I know that eq evaluates to nil even in cases where everything other than location is the same makes it possible to filter out the current item (because it isn't going to be installed after the event occurs)
Cool, you can rely on that.

One bug that I found: Currently, you shouldn't manipulate any items in the OnUninstall call--for example, adding items to the ship in the middle of OnUninstall will either crash or corrupt memory. I'll fix that in RC3 [But even then, you probably shouldn't manipulate the item being uninstalled.]
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

is gItem installed or not consistently with armors and devices? Also does the onUnInstall bug effect uninstalling in onUnInstall and installing devices in onInstall? (I was going to use virtual 0 slot devices)
Crying is not a proper retort!
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

what if an item is forcefully deleted? will uninstall still trigger if it is installed?
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Betelgeuse wrote:is gItem installed or not consistently with armors and devices? Also does the onUnInstall bug effect uninstalling in onUnInstall and installing devices in onInstall? (I was going to use virtual 0 slot devices)
In RC3, it is consistent between armors and devices. In RC2 it is not.

I think, as long as the item existed on the ship prior to OnUninstall/OnInstall, then I think you're OK--but I'm not sure. Either way, it is fixed in RC3.

(And you'll be able to add virtual items and install/uninstall in OnInstall/OnUninstall--at least I hope so: it's a bug if not.)

BTW, also in RC3 is a way to enumerate virtual items.

Thanks, as always, for pushing the limits! :)
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Wolfy wrote:what if an item is forcefully deleted? will uninstall still trigger if it is installed?
No, you will get an error message if you try.
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

ok, so it's a non-issue, right?
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

george moromisato wrote:
Betelgeuse wrote:is gItem installed or not consistently with armors and devices? Also does the onUnInstall bug effect uninstalling in onUnInstall and installing devices in onInstall? (I was going to use virtual 0 slot devices)
In RC3, it is consistent between armors and devices. In RC2 it is not.
oh sorry I meant to say in onInstall is gItem installed or not ...
enumerating virtual items is going to be helpful 8)

edit: is there a way of using a UNID in objGetItems?

edit2: nvm I just saw it is on a ticket for 1.1
Crying is not a proper retort!
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Betelgeuse wrote:oh sorry I meant to say in onInstall is gItem installed or not ...
enumerating virtual items is going to be helpful 8)

edit: is there a way of using a UNID in objGetItems?

edit2: nvm I just saw it is on a ticket for 1.1
In OnInstall, gItem is installed for both armor and devices.
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

(And you'll be able to add virtual items and install/uninstall in OnInstall/OnUninstall--at least I hope so: it's a bug if not.)
http://wiki.neurohack.com/transcendence/trac/ticket/220
:?
I am not using virtual items currently but will use them in RC3 (if that bug is fixed of course)
Crying is not a proper retort!
Post Reply