Author Topic: Any way to force autorun priorities?  (Read 1888 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Any way to force autorun priorities?
« on: May 05, 2017, 11:22:47 AM »
So after some research and it seems that the lua loading priority is
Code: [Select]
lua/autorun
lua/autorun/server|client
addons/lua/autorun
addons/lua/autorun/server|client
gamemode/

Is there any way to force an addon to load AFTER a specific addon has loaded? I was thinking of making them all under a function and if the addon it's waiting for isn't defined yet, wait a few seconds then re-execute the function once it has.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Any way to force autorun priorities?
« Reply #1 on: May 05, 2017, 07:21:04 PM »
I believe that addons are loaded in alphabetical order. Try renaming your addon directories so that they're ordered in the way you would like. Or you could number them.

garrysmod/addons/1.ULib/
garrysmod/addons/2.ULX/
garrysmod/addons/3.Pointshop/
garrysmod/addons/4.OtherAddonExample/


etc etc etc.

Not 100% sure this would work, but it might.

Keep in mind the way the filesystem orders numbers.

12 might come before 2.

example:

0
1
11
12
2
3
4
5
6
7
8
9

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Any way to force autorun priorities?
« Reply #2 on: May 05, 2017, 07:56:21 PM »
Been a long time since I've seen this discussed. 3-4 years ago now for sure, it was alphabetical, especially in linux where upper case and lower case were sorted differently. (I forget, think uppercase was before lower)

Unfortunately, there's no way to rename workshop subscriptions to meet your order need.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Any way to force autorun priorities?
« Reply #3 on: May 05, 2017, 07:57:09 PM »
If it was that important, you could extract workshop addons and convert them to legacy addons.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Any way to force autorun priorities?
« Reply #4 on: May 05, 2017, 08:08:52 PM »
It isn't incredibly important, but it could be useful. I learned that for my purposes it wasn't necesary because it doesn't use other addons on autorun, but during certain hooks (that happen after the server is already running)
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Any way to force autorun priorities?
« Reply #5 on: May 05, 2017, 08:21:45 PM »
Does the addon you're wanting to run after have 'ready/loaded' callback hooks?
Or a table that's only in the addon?
Shouldn't be difficult to monitor either and run after.
ULib has a 'player ready' hook that gets called on server and client when a client is ready to run commands.



"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Any way to force autorun priorities?
« Reply #6 on: May 06, 2017, 06:10:50 AM »
Nah, it's nothing like that. It runs off of ULibCommandCalled and PlayerDisconnected hooks.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.