Event Order with multiple mods?

Place to post guides, observations, things related to modding that are not mods themselves.
Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

Event Order with multiple mods?

Post by Peppe »

Multiple mods trigger on the on_player_created event and their functions run in what order?

If I want my mod to run last on an event can I set/influence my order in the event stack?

Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: Event Order with multiple mods?

Post by Supercheese »

I'd imagine they'd run in order of which mod is loaded first on your mod list. You can influence this order by using dependencies.

Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

Re: Event Order with multiple mods?

Post by Peppe »

Supercheese wrote:I'd imagine they'd run in order of which mod is loaded first on your mod list. You can influence this order by using dependencies.
I have a dependency on the mod I hoped to run after in the event stack, but it runs first.

I played around with renaming my mod and could get it to run in the order i desired. But don't really want to rename the mod just to tweak the event handling.

Sort appears to be AZ-az -- like it is based on the ASCII value of the mod name.

Target mod was lowercase -- any mod name starting with capital ran before the target mod. Mod names lower case but alphabetically after the target mod ran after the target mod.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Event Order with multiple mods?

Post by aubergine18 »

If you set a dependency on another mod, that mod will get loaded before your mod, and thus register its events before your mod.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

Re: Event Order with multiple mods?

Post by Peppe »

aubergine18 wrote:If you set a dependency on another mod, that mod will get loaded before your mod, and thus register its events before your mod.
I have that already and that is not true.

It would be nice if it worked that way, but events appear to be executed based on mod name and not by when the listener was registered.

Rseding91
Factorio Staff
Factorio Staff
Posts: 14150
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Event Order with multiple mods?

Post by Rseding91 »

Peppe wrote:
aubergine18 wrote:If you set a dependency on another mod, that mod will get loaded before your mod, and thus register its events before your mod.
I have that already and that is not true.

It would be nice if it worked that way, but events appear to be executed based on mod name and not by when the listener was registered.
Correct. Events are fired in order by mod name.
If you want to get ahold of me I'm almost always on Discord.

Peppe
Fast Inserter
Fast Inserter
Posts: 223
Joined: Fri Nov 28, 2014 6:48 pm
Contact:

Re: Event Order with multiple mods?

Post by Peppe »

Rseding91 wrote:
Peppe wrote:
aubergine18 wrote:If you set a dependency on another mod, that mod will get loaded before your mod, and thus register its events before your mod.
I have that already and that is not true.

It would be nice if it worked that way, but events appear to be executed based on mod name and not by when the listener was registered.
Correct. Events are fired in order by mod name.
Thanks for the confirmation.

Bit of a corner case -- like most of a mod, but it adds something to the starting inventory, so I wanted to come in after it and remove the starter item.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Event Order with multiple mods?

Post by aubergine18 »

Seems 0.15 will change the event order :)

viewtopic.php?p=216063#p216063
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: Event Order with multiple mods?

Post by impetus maximus »

would be nice to have some control over the order, or at least the display order in game.
having multiple mods in the upper left corner. some come pretty far down.
having those to the far left would be helpful.

Post Reply

Return to “Modding discussion”