How Do I Subscribe To The Event "OnTrade"?

Discuss modding questions and implementation details.
User avatar
Magicono43
Posts: 1141
Joined: Tue Nov 06, 2018 7:06 am

Re: How Do I Subscribe To The Event "OnTrade"?

Post by Magicono43 »

numidium3rd wrote: Tue Apr 14, 2020 12:41 am I tested it out myself and it appears that a new instance of DaggerfallTradeWindow is created every time you use UIWindowFactory... meaning that the event you set is lost every time. Should've figured. This is a strong case for having that event be static in the codebase in my opinion. I'll have to see what Hazelnut thinks.

Anyway, BadLuckBurt's solution seems fine for the time being. Sorry for wasting your time.
No no, sorry for wasting your time, I was the one asking the question after all, lol.

Appreciate the attempt though, it would be nice if this was made static just for ease, but I honestly don't know the potential ramifications of that overall, like it was probably made non-static for a reason I figure. Thanks for your time.

User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: How Do I Subscribe To The Event "OnTrade"?

Post by Hazelnut »

It's intended for when a trade window is used by a mod so that it can run code when the trade has occurred. It's used in the Archs guild mod. It will need some changes to be usable as you intend, possibly converting to a persistent instance instead of using a new instance each time. Sorry, this will have to wait until I can find some time to work though it.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Magicono43
Posts: 1141
Joined: Tue Nov 06, 2018 7:06 am

Re: How Do I Subscribe To The Event "OnTrade"?

Post by Magicono43 »

Hazelnut wrote: Tue Apr 14, 2020 2:51 pm It's intended for when a trade window is used by a mod so that it can run code when the trade has occurred. It's used in the Archs guild mod. It will need some changes to be usable as you intend, possibly converting to a persistent instance instead of using a new instance each time. Sorry, this will have to wait until I can find some time to work though it.
That's fine, i'm probably one of the few people that even tried to mess with this honestly, so I don't think the demand is that high, lol. Burt's solution seems to work for now, so i'm just glad I am able to have the event be detected without having to change the base-code.

Post Reply