Jump to content
Kered13

Kered13's Utilities and Widgets

Recommended Posts

Instead of spamming this forum by creating a topic for everything I make, I'm going to condense everything into this thread, which I'll just update. Except OptionsGadgets, which I'm leaving in it's own thread because it's a substantial project of it's own (though it depends on several of these utilities.

 

All code can be found here. Utilities are in the Utils folder, and widgets are at the top level. Some widgets are based on other people's work, and I have tried to credit them in the comments.

 

I'll give a brief summary here of the highlights:

 

 

Utilities

 

OptionsGadgets: See here.

 

Utils.lua: Misc. utility functions. Of note are:

- toString: I got this off StackOverflow and made some small changes. This will convert any variable into a human-readable string. Most notably this includes recursively expanding tables. It safely handles self-referential loops in tables as well. This is VERY useful for debugging.

- fixedPrint: The consolePrint function crashes the game when trying to print 2048 or more characters. This may seem like a lot, but it's really easy to go over this limit with large tables. fixedPrint works around this limit by breaking large prints into multiple lines. There is still a 2048 character per-line limit, but this is much harder to reach. Also VERY useful for debugging.

 

Lists.lua: Functional-style functions for dealing with lists, such as map and reduce. (A list is a table containing consecutive integer keys starting with 1).

 

Tables.lua: Similar to Lists, but for dealing with tables.

 

Constants.lua: Useful constants for widgets that are not included in reflexcore. I don't have much there right now, but it will probably grow.

 

ConVars.lua: This creates a global (sorry Bonuspunkt) table that is backed by console variables. This means that you can write "ConVars.foo = 10", and the console variable "ui_widgetname_foo" will be created (if necessary) and assigned the value 10. You can then read this console variable with ConVars.foo. If the users changes the console variable, it will be reflected automatically in ConVars. This even supports tables, "ConVars.foo = {a = 1, b = 3}" will create the console variables "ui_widgetname_foo.a" and "ui_widgetname_foo.b" with the values 1 and 2, respectively. This should make supporting console variables much easier.

 

 

Widgets

 

KeredCrosshair: A significant improvement on health-colored crosshairs. You can set the number of thresholds, the threshold levels, and can choose to interpolate colors between thresholds.

 

KeredFragMessages: Quake Live-style frag messages. You can control the text, color, and lifespan of the messages.

 

KeredScoreboard: Probably the least interesting widget, this is just a simple emulation of the Quake Live default scoreboard for people like me who are too used to the QL UI. Has no options.

 

KeredAvailableWeapons: Automatically switches away when you empty a weapon. Can set weapon priority in the options menu.

 

KeredTimer: Simply the stock timer, but with an option for counting up (I prefer count up timers myself).

 

KeredGameMessages: The stock GameMessages widget, but can be repositioned.

 

 

Let me know if you encounter any bugs, and I'll do my best to fix them.

Share this post


Link to post
Share on other sites

Ay Kered 13. I have encountered a bug. Although it may be because I did something wrong. I have put your widgets in my widget folder and whenever I try to click on one of the widgets, the whole menu disappears. It happens with all the widgets and I have to restart my config since when I click on options menu, nothing appears. Cheers. 

Message that appears in console: KeredHUD/KeredFragMessage.lua:145: attempt to index field 'optionsUi' (a nil value)

Share this post


Link to post
Share on other sites

Ay Kered 13. I have encountered a bug. Although it may be because I did something wrong. I have put your widgets in my widget folder and whenever I try to click on one of the widgets, the whole menu disappears. It happens with all the widgets and I have to restart my config since when I click on options menu, nothing appears. Cheers.

That's the typical result of an error on the options menu. To debug it, I need to know what the error message was. First reload everything and check the console for errors. You should see some messages like "Initializing KeredSomething", but if there are also any error messages then tell me what they are and in which widget initialization they happened.

Then only if there are no error messages after reloading, go to the options menu and pick one of the widgets. When the menu disappears, open the console and there will be an error message. Tell me what that says.

Also, make sure you downloaded any dependencies along with the widget you want. You can see the dependencies by checking the require lines.

Share this post


Link to post
Share on other sites

That's the typical result of an error on the options menu. To debug it, I need to know what the error message was. First reload everything and check the console for errors. You should see some messages like "Initializing KeredSomething", but if there are also any error messages then tell me what they are and in which widget initialization they happened.

Then only if there are no error messages after reloading, go to the options menu and pick one of the widgets. When the menu disappears, open the console and there will be an error message. Tell me what that says.

Also, make sure you downloaded any dependencies along with the widget you want. You can see the dependencies by checking the require lines.

Found the issue. You have to rename the folder to Kered13. Anything else won't work :)

Edit1: There's only one widgets that still does that, "KeredOptionsGadgetTest". 

Share this post


Link to post
Share on other sites

 

Found the issue. You have to rename the folder to Kered13. Anything else won't work :)

Yes, you would have to change the require lines to make it work. Probably not worth the trouble.

 

 

Edit1: There's only one widgets that still does that, "KeredOptionsGadgetTest".

This is a widget that I use for testing the OptionsGadgets library. It's not important for you, but if it has an error there may be a problem in the library. What is the error message in the console?

EDIT: This is fixed now.

Edited by Kered13

Share this post


Link to post
Share on other sites

I've added a couple new very small widgets: A timer with the option to count up, and a game message widget that can be repositioned. I also fixed a bug with the scoreboard and removed obsolete code from available weapons.

Share this post


Link to post
Share on other sites

I've added a couple new very small widgets: A timer with the option to count up, and a game message widget that can be repositioned. I also fixed a bug with the scoreboard and removed obsolete code from available weapons.

The options for count up timer does not show when I select it in widgets menu! 

Share this post


Link to post
Share on other sites

Thanks for the tools and widgets Kered13, really cool. However I have been having a bug with the scoreboard. Sometimes it works flawlessly, and sometimes it works for a few rounds and then just disappear. I have to reboot the game for it to come back. Any way to fix that, or is it something wrong I did? Thanks

Share this post


Link to post
Share on other sites

The options for count up timer does not show when I select it in widgets menu! 

​I'll look into it.

Thanks for the tools and widgets Kered13, really cool. However I have been having a bug with the scoreboard. Sometimes it works flawlessly, and sometimes it works for a few rounds and then just disappear. I have to reboot the game for it to come back. Any way to fix that, or is it something wrong I did? Thanks

When this happens there should be an error message in the console (as long as you notice the problem before the console fills up). If you can post that error message, it will help.

Also, if you can tell me what mode this happens in and maybe what circumstances, if you notice at the moment it disappears.

Share this post


Link to post
Share on other sites

​I'll look into it.

When this happens there should be an error message in the console (as long as you notice the problem before the console fills up). If you can post that error message, it will help.

Also, if you can tell me what mode this happens in and maybe what circumstances, if you notice at the moment it disappears.

​Ok i'll try to check for the message in the console next time it happens. I mainly play a1v1 and atdm. My widget is in the top left corner. It happens randomly after a round, and doesnt come back until I restart the game. Thanks for the reply.

Share this post


Link to post
Share on other sites

I've had bugs like that in the past. There's probably another that I need to quash. I just pushed a big update, it's almost entirely back end stuff but you should make sure you download it. It will be much harder to debug if you're not on the latest version.

The options for count up timer does not show when I select it in widgets menu! 

​I fixed this now. Turns out I just forgot to call my initialization code for the options

Share this post


Link to post
Share on other sites

I've had bugs like that in the past. There's probably another that I need to quash. I just pushed a big update, it's almost entirely back end stuff but you should make sure you download it. It will be much harder to debug if you're not on the latest version.

​I fixed this now. Turns out I just forgot to call my initialization code for the options

​Ah nice! tnx for the widget man! 

Share this post


Link to post
Share on other sites

Hi, I'm new to reflex and this is my first attempt at installing a custom widget.  I was looking for something that displays a Quake Live style CTF Scoreboard, and was hoping this was my answer.  Unfortunately, I was unable to get this widget to work.  I even installed all of the .lua files from the utilities directory, just to make sure I wasn't missing a dependent file.

I have attached the screenshot of the errors returned in the console.

Any help would be greatly appreciated.  Thanks in advance!

Edit:  https://youtu.be/YcdZO3AhYA8  The top center section of the screen is exactly what I'm looking for.  Where it displays captures and flag status.  Would anyone mind pointing me in the right direction to find this? 

20160421031039_1.jpg

Share this post


Link to post
Share on other sites

I'll go ahead and tell you that my widget doesn't display anything like that, it just shows simple score numbers.

As for the problem you're getting, it looks like you didn't put the files in the right location. You have to preserve the folder structure or the require statements won't work correctly. That means the Utils files need to go in a Utils folder, and the OptionsGadgets files need to go in the OptionsGadgets folder. The easiest thing to do is to just extract everything in the download into your Reflex ui widgets folder exactly as is, then delete the widgets you don't want.

Share this post


Link to post
Share on other sites
13 hours ago, bran said:

Edit:  https://youtu.be/YcdZO3AhYA8  The top center section of the screen is exactly what I'm looking for.  Where it displays captures and flag status.  Would anyone mind pointing me in the right direction to find this? 

That is a custom HUD for reflex called DP_Two HUD. Here's the thread where you can download it from: 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×