ULX

Author Topic: sui_scoreboard with UTime and Steam Avatars  (Read 116119 times)

0 Members and 1 Guest are viewing this topic.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #90 on: December 30, 2010, 07:20:56 PM »
Megiddo, thanks, see any other problem with the code replacement suggestion?

Krooks,
Try this in server console.
Code: [Select]
lua_run print(GAMEMODE.Name)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #91 on: December 30, 2010, 08:28:58 PM »
I don't see anything wrong with the code, no.
Experiencing God's grace one day at a time.

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #92 on: December 31, 2010, 04:41:54 PM »
Hey sorry for this late reply, Christmas time n all, things get busy ;)
Hope everyone had a good one (if you celebrate) and a happy new year!

On the server's consol, I get "Sandbox" for print(GAMEMODE.Name) and print(GM.Name) returns a nil value.

As a note I changed the lowercase s to a capital S in the code you provided with no results.
« Last Edit: December 31, 2010, 04:51:55 PM by krooks »
My TTT server. Join the fun!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #93 on: December 31, 2010, 05:40:55 PM »
As a note I changed the lowercase s to a capital S in the code you provided with no results.

No worries, we've been busy too.
So, GAMEMODE contains the right table information.
The change you made (capital S) should definitely not work, as I use string.lower lua function to convert GAMEMODE.Name to lower case.
You could try
Code: [Select]
elseif GAMEMODE.Name == "Sandbox" then
but that shouldn't work any better than original suggestion.

I'm really at a loss as to why it's not working. No errors when server is starting up about a null table? (Maybe Gamemode table fills after script runs?)

Just to verify for me, if you change that line 13 back to JUST 'else', the scoreboard works, but in every gamemode including those that do thier own?
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #94 on: December 31, 2010, 06:57:49 PM »
Tried the new code, and like you expected, it didn't work.
To go more in depth, it does not show _at all_ when I make these changes, only the default scoreboard shows.

I just changed it back to "else", and can confirm it shows up in sandbox, but also shows in other gamemodes.
It does not display any stats on those gamemodes (im sure their unique scoring etc isn't written into the code, so obviously they wouldn't) but the thing about it, is it shows up on top of the provided gamemode scoreboard, blocking it.
And to make things worse, it will not go away, making the game unplayable.

That's the best I can do as far as a description goes ^^

Errors:
nil value for tempadduser lua:29
a missing 'end' to close 'function' on line 73 of AutoPromote lua:164
My TTT server. Join the fun!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #95 on: January 04, 2011, 03:22:27 PM »
Not forgotten, just not made / found time to test/research deeper.
As for the errors, well, it's not this release causing those (kind of obvious, no?)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #96 on: January 04, 2011, 03:25:45 PM »
It's all good man, take your time.
Yes I had an idea that they would be unrelated, but I've had plugins conflict on me before, so figured I'd list it all  ;D
My TTT server. Join the fun!

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #97 on: January 04, 2011, 03:47:07 PM »
Hmm, I think I remember running into an error with this once in XGUI, not being able to properly determine the gamemode name right when the scripts were loaded.. I'll try and look at my code as soon as possible.
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #98 on: January 04, 2011, 07:58:54 PM »
Did you guys try ULib.isSandbox()? http://ulyssesmod.net/docs/files/lua/ulib/shared/util-lua.html#isSandbox
It returns true if sandbox or sandbox-derived, but.. might not work if you want ONLY sandbox.


EDIT: Nevermind, it's just as I suspected. The sui_scoreboard script is being loaded before the GAMEMODE is properly established, and before even ULib/ULX loads. In order to get your check to work properly, you'll have to delay the startup of sui_scoreboard (done with Timer.Simple( 0, function )). However, this ends up delaying it till it's pretty much the last thing loaded, so this may or may not end up causing more problems (for the few minutes I tested it, everything was working fine.)

Assuming the sui_scoreboard.lua file is exactly the same whether you have the UTime versions or not (or some other modified version), then your code should look something like this:

Code: [Select]
if SERVER then
AddCSLuaFile( "autorun/sui_scoreboard.lua" )
AddCSLuaFile( "sui_scoreboard/admin_buttons.lua" )
AddCSLuaFile( "sui_scoreboard/cl_tooltips.lua" )
AddCSLuaFile( "sui_scoreboard/player_frame.lua" )
AddCSLuaFile( "sui_scoreboard/player_infocard.lua" )
AddCSLuaFile( "sui_scoreboard/player_row.lua" )
AddCSLuaFile( "sui_scoreboard/scoreboard.lua" )
AddCSLuaFile( "sui_scoreboard/vote_button.lua" )

include( "sui_scoreboard/rating.lua" )

else
local function sui_startup()
if GAMEMODE.Name == "Sandbox" then
include( "sui_scoreboard/scoreboard.lua" )

SuiScoreBoard = nil

timer.Simple( 1.5, function()

function GAMEMODE:CreateScoreboard()

if ( ScoreBoard ) then

ScoreBoard:Remove()
ScoreBoard = nil

end

SuiScoreBoard = vgui.Create( "SuiScoreBoard" )

return true

end

function GAMEMODE:ScoreboardShow()

if not SuiScoreBoard then
self:CreateScoreboard()
end

GAMEMODE.ShowScoreboard = true
gui.EnableScreenClicker( true )

SuiScoreBoard:SetVisible( true )
SuiScoreBoard:UpdateScoreboard( true )

return true

end

function GAMEMODE:ScoreboardHide()

GAMEMODE.ShowScoreboard = false
gui.EnableScreenClicker( false )

SuiScoreBoard:SetVisible( false )

return true

end

end )
end
end
timer.Simple( 0, sui_startup )
end

It creates a function with all of the sui_scoreboard client startup code, then calls it after the timer.Simple goes through (which is basically when everything is loaded, ESPECIALLY the gamemode). Once that function is called, the first thing we do is check and see if it's a Sandbox gamemode or not-- If it is, then continue loading sui_scoreboard, if not, then just cancel it.

Hope that helps!
« Last Edit: January 04, 2011, 08:06:17 PM by Stickly Man! »
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #99 on: January 04, 2011, 08:18:17 PM »
Stickly man, the GAMEMODE table not being ready was actually my first theory I was going to test.
Even the original code itself has a timer in it to add the "CreateScoreboard" function to GAMEMODE table delayed, so I thought that was the root cause.
Thanks for chasing it down.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #100 on: January 04, 2011, 11:43:18 PM »
will be giving this a go tomorrow, thanks
My TTT server. Join the fun!

Offline kapstok1211

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #101 on: January 06, 2011, 02:18:34 AM »
How do I make it so that if a player reaches like 15 hours, he will get promoted to the next group?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #102 on: January 06, 2011, 07:44:22 AM »
How do I make it so that if a player reaches like 15 hours, he will get promoted to the next group?

Use AutoPromote
Experiencing God's grace one day at a time.

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #103 on: January 06, 2011, 10:25:39 AM »
Oops, thought I replied to this with the results, I guess I didn't!
The code Stickly Man provided worked perfectly, thank you!

Now.. to fix other (unrelated) addons in the same way :( lol
Maybe I learned enough from this to figure it out though :)

Thanks again
My TTT server. Join the fun!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: sui_scoreboard with UTime and Steam Avatars
« Reply #104 on: January 06, 2011, 06:11:57 PM »
Welcome. If you ever want help with (well, just about) any Lua code (or, even non-Lua), check out the developers corner area of the forum. Even if one single team member can't find the solution to your challenge/question/idea/whatever, we combine forces well enough to do it, and of course, our community as a whole has a diverse base.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming