• Print

Author Topic: Change Menu Command  (Read 5393 times)

0 Members and 1 Guest are viewing this topic.

Offline Darkblizzard

  • Newbie
  • *
  • Posts: 39
  • Karma: 1
Change Menu Command
« on: April 16, 2015, 05:32:36 pm »
Hello,
I was wondering where I'm able to change the "!menu" "!xgui" commands?
Thanks.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Change Menu Command
« Reply #1 on: April 16, 2015, 06:26:49 pm »
I'm sorry are you asking for help on changing !menu to !xgui?

Offline Darkblizzard

  • Newbie
  • *
  • Posts: 39
  • Karma: 1
Re: Change Menu Command
« Reply #2 on: April 16, 2015, 06:30:00 pm »
I'm just trying to change both the commands "!menu" and "!xgui" to something else. So I need to know where the file is to change it.

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Change Menu Command
« Reply #3 on: April 16, 2015, 06:33:07 pm »
You can change this in ulx/lua/ulx/modules/xgui_server.lua. Around line 40.

You're looking for:
Code: Lua
  1. ULib.addSayCommand( "!xgui", xgui_chatCommand )
  2. ULib.addSayCommand( "!menu", xgui_chatCommand )

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Change Menu Command
« Reply #4 on: April 16, 2015, 06:37:34 pm »
Locate this file: garrysmod/addons/ulx/lua/ulx/modules/xgui_server.lua when you open this you can see ULib.addSayCommand( "!xgui", xgui_chatCommand ) somewhere in the code (i'm on my phone so can not see the line) and you can edit that

Offline Darkblizzard

  • Newbie
  • *
  • Posts: 39
  • Karma: 1
Re: Change Menu Command
« Reply #5 on: April 16, 2015, 06:40:07 pm »
How about where can I change the concommand? Such as "ulx menu" in rcon, etc.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Change Menu Command
« Reply #6 on: April 16, 2015, 06:42:51 pm »
The way me and Timmy have explained should do that! Catch me if i'm wrong again i'm on my phone and can not check

Offline Darkblizzard

  • Newbie
  • *
  • Posts: 39
  • Karma: 1
Re: Change Menu Command
« Reply #7 on: April 16, 2015, 07:15:43 pm »
That only changed the chat command, how about the console command?

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Change Menu Command
« Reply #8 on: April 16, 2015, 07:51:32 pm »
Some examples run clientside

Code: Lua
  1. ULib.cmds.addCommandClient( "xgui", xgui.cmd_base )
  2. ULib.cmds.addCommandClient( "xgui show", function( ply, cmd, args ) xgui.show( args ) end, xgui.tab_completes )
  3. ULib.cmds.addCommandClient( "xgui hide", xgui.hide )
  4. ULib.cmds.addCommandClient( "xgui toggle", function() xgui.toggle() end )
  5.  
  6. ULib.cmds.addCommandClient( "ulx menu", function( ply, cmd, args ) xgui.toggle( args ) end, xgui.ulxmenu_tab_completes )

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Change Menu Command
« Reply #9 on: April 16, 2015, 07:54:57 pm »
All, before we go overboard and continue to tell people how to go about changing base Ulysses code, which will then prevent updates, or cause issues when using git or SVN, let's find out _why_ someone is trying to change it.
Though it may be a good reason, let's start simple.
Maybe a better, simpler, less likely to break ULX, option exists.

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

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Change Menu Command
« Reply #10 on: April 16, 2015, 08:38:47 pm »
All, before we go overboard and continue to tell people how to go about changing base Ulysses code, which will then prevent updates, or cause issues when using git or SVN, let's find out _why_ someone is trying to change it.
Though it may be a good reason, let's start simple.
Maybe a better, simpler, less likely to break ULX, option exists.
I see where the confusion comes in, but I was not suggesting to change the code.  I was showing him examples on how to add a command for what he was asking.  Requires 1 line of code in ANY clientside file and he can add an alias of ANY command he wants to.

  • Print