ULX

Author Topic: Slider  (Read 1561 times)

0 Members and 1 Guest are viewing this topic.

Offline Sakromanie

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Slider
« on: November 09, 2015, 12:19:41 PM »
Hello. I am fairly new to ULX and has been developing commands for the sake of education. Now, I wonder if there is an easy way of making sliders. If you look at "ulx slap", you can pick how much damage should be dealt using the slider. Can I make one that is easy and will work with any ULX command? Thanks.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Slider
« Reply #1 on: November 09, 2015, 10:04:21 PM »
If you're talking about the sliders on the 'cmds' tab, those are generated automatically. Any ulx commands that are properly registered will show up in XGUI if you have access to it. Here's the default code for ULX slap- should give you an idea of how to create the basic command:
https://github.com/Nayruden/Ulysses/blob/master/ulx/lua/ulx/modules/sh/fun.lua#L4-L24

If you're working on your own GUI code, then I use a library I made called "xlib" to make the GUI making code a lot easier. For example, here's the admin votemap sliders on the Settings->Server tab:
https://github.com/Nayruden/Ulysses/blob/master/ulx/lua/ulx/xgui/settings/server.lua#L110-L116

If your code doesn't rely on ULX/ULib, then you can manually create your own slider (this should work):
http://wiki.garrysmod.com/page/Category:DNumSlider
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6