• Print

Author Topic: Commands, Maps, Settings, Bans, etc.  (Read 7426 times)

0 Members and 1 Guest are viewing this topic.

Offline WispySkies

  • Full Member
  • ***
  • Posts: 144
  • Karma: 0
  • I make random commands and Lua errors.
Commands, Maps, Settings, Bans, etc.
« on: November 13, 2015, 04:42:37 pm »
As the title says, those are the top main tabs in !menu. Is it easily achievable to add a new tab there? I found this thread from 2013 but I did not want to bump it. (I also PM'd Sticky on the 5th, no reply  :-[) /index.php/topic,6760.0.html

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Commands, Maps, Settings, Bans, etc.
« Reply #1 on: November 13, 2015, 07:05:28 pm »
I'm not experienced in GUI at all, but, if you take a peek at every XGUI file in the ulx addons/ulx/lua/xgui folder,  Stickly was nice enough to make a file for each of the main XGUI tabs (commands, groups, maps, settings, maps, ...)
Looking at the top few lines of each of those, it seems reasonably easy to surmise what his library command is to create a tab.
Big hint - He calls it a "panel"
And, as I suggested in that other thread you refererenced , the link I provided to those TTT commands also use the same premise.

No, he's not documented xlib, his own personal library of stuff he noticed he kept using over and over in XGUI.
However, one could study and learn many functions of what his XLIB does for Xgui by looking at the 3 ulx client modules for xgui located in /addons/ulx/lua/ulx/modules/cl, including...ta-da...xlib.lua
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline WispySkies

  • Full Member
  • ***
  • Posts: 144
  • Karma: 0
  • I make random commands and Lua errors.
Re: Commands, Maps, Settings, Bans, etc.
« Reply #2 on: November 13, 2015, 07:15:21 pm »
I'm not experienced in GUI at all, but, if you take a peek at every XGUI file in the ulx addons/ulx/lua/xgui folder,  Stickly was nice enough to make a file for each of the main XGUI tabs (commands, groups, maps, settings, maps, ...)
Looking at the top few lines of each of those, it seems reasonably easy to surmise what his library command is to create a tab.
Big hint - He calls it a "panel"
And, as I suggested in that other thread you refererenced , the link I provided to those TTT commands also use the same premise.

No, he's not documented xlib, his own personal library of stuff he noticed he kept using over and over in XGUI.
However, one could study and learn many functions of what his XLIB does for Xgui by looking at the 3 ulx client modules for xgui located in /addons/ulx/lua/ulx/modules/cl, including...ta-da...xlib.lua
Aye! :D Thank you.
Edit: That'll be a challenge not knowing what to change. I looked at it :p
« Last Edit: November 13, 2015, 07:21:07 pm by WispySkies »

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Commands, Maps, Settings, Bans, etc.
« Reply #3 on: November 14, 2015, 06:27:50 pm »
Yeah.. I still haven't had time to get around to it. :P I've bumped the documentation up on my TODO list and want to get (at least a very rudimentary) documentation out sometime this week. I'll keep you posted.
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline WispySkies

  • Full Member
  • ***
  • Posts: 144
  • Karma: 0
  • I make random commands and Lua errors.
Re: Commands, Maps, Settings, Bans, etc.
« Reply #4 on: November 14, 2015, 10:58:00 pm »
Yeah.. I still haven't had time to get around to it. :P I've bumped the documentation up on my TODO list and want to get (at least a very rudimentary) documentation out sometime this week. I'll keep you posted.
Aye! Thanks you :D

Offline WispySkies

  • Full Member
  • ***
  • Posts: 144
  • Karma: 0
  • I make random commands and Lua errors.
Re: Commands, Maps, Settings, Bans, etc.
« Reply #5 on: January 07, 2016, 06:56:10 pm »
Yeah.. I still haven't had time to get around to it. :P I've bumped the documentation up on my TODO list and want to get (at least a very rudimentary) documentation out sometime this week. I'll keep you posted.
Not to rush you or bump this since its old but I didn't want to create a new thread. Stickly, any change on this?
« Last Edit: January 07, 2016, 07:11:40 pm by JamminR »

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Commands, Maps, Settings, Bans, etc.
« Reply #6 on: January 08, 2016, 08:24:04 am »
Nope! :)

Seriously, though.. I have little free time D:

If you have any specific questions regarding XGUI stuff, though, then ask me and I can help you out.


EDIT: It seems like you want a new main tab- In that case, the quickest way to get started is to make a file in <your addon>/lua/ulx/xgui/<yourfile>.lua, and populate it with this sample template (taken from maps.lua):

Code: Lua
  1. local maps = xlib.makepanel{ parent=xgui.null }
  2.  
  3. -- Add stuff to your panel here!
  4.  
  5. xgui.addModule( "Maps", maps, "icon16/map.png" )
  6.  

Obviously, 'maps' is the name of the panel that will hold all of your stuff, and I generally use it to store all children elements, functions, any variables, etc. You can name this whatever you like. You can also access this globally by checking xgui.modules.tab[x].panel, where 'x' is a seemingly random number. xgui.modules.tab[x].name should show the name of the tab (see below), so that should help you find the right one. I really should make those indexed by name. Oh well.

Then, on the addModule function, "Maps" is the label that will show up on the tab, 'maps' points to your newly created panel, and "icon16/map.png" is the icon that will be on the tab. You can also add a required permission to see the tab as a fourth parameter, like so:

Code: Lua
  1. xgui.addModule( "Groups", groups, "icon16/group_gear.png", "xgui_managegroups" )
  2.  

That's the bare minimum to get running! Obviously you'll want to check out the rest of the XGUI code along with xlib.lua to see how I do one-line derma creation. The library isn't very standardized, but.. do whatever makes you most comfortable.
« Last Edit: January 08, 2016, 08:47:07 am by Stickly Man! »
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline WispySkies

  • Full Member
  • ***
  • Posts: 144
  • Karma: 0
  • I make random commands and Lua errors.
Re: Commands, Maps, Settings, Bans, etc.
« Reply #7 on: January 08, 2016, 12:40:29 pm »
Nope! :)

Seriously, though.. I have little free time D:

If you have any specific questions regarding XGUI stuff, though, then ask me and I can help you out.


EDIT: It seems like you want a new main tab- In that case, the quickest way to get started is to make a file in <your addon>/lua/ulx/xgui/<yourfile>.lua, and populate it with this sample template (taken from maps.lua):

Code: Lua
  1. local maps = xlib.makepanel{ parent=xgui.null }
  2.  
  3. -- Add stuff to your panel here!
  4.  
  5. xgui.addModule( "Maps", maps, "icon16/map.png" )
  6.  

Obviously, 'maps' is the name of the panel that will hold all of your stuff, and I generally use it to store all children elements, functions, any variables, etc. You can name this whatever you like. You can also access this globally by checking xgui.modules.tab[x].panel, where 'x' is a seemingly random number. xgui.modules.tab[x].name should show the name of the tab (see below), so that should help you find the right one. I really should make those indexed by name. Oh well.

Then, on the addModule function, "Maps" is the label that will show up on the tab, 'maps' points to your newly created panel, and "icon16/map.png" is the icon that will be on the tab. You can also add a required permission to see the tab as a fourth parameter, like so:

Code: Lua
  1. xgui.addModule( "Groups", groups, "icon16/group_gear.png", "xgui_managegroups" )
  2.  

That's the bare minimum to get running! Obviously you'll want to check out the rest of the XGUI code along with xlib.lua to see how I do one-line derma creation. The library isn't very standardized, but.. do whatever makes you most comfortable.
Wheeeeee! Thank you!

  • Print