Refreshing Question

Arch

Legions Developer
I'm trying to port some of the gui files of the game into scripts that can be placed into the mods folder and be used. Currently, I'm working on the scoreboard, as seen below.
Legions%202012-02-24%2011-51-07-63.png


I've come across a problem though. The scoreboard itself doesn't refresh correctly. By refresh I mean the ping stays solid and the score(s) aren't added to the scoreboard. I know the image above is from a custom match. The ping stays solid on non-custom run matches as well (Public test, Hotswap, etc.). However the scoreboard does refresh on certain activities. Such as capturing a flag: it goes to the normal fluctuation of ping and adds the score to the scoreboard. The ping continues to fluctuate for about a minute or so and then goes back to the steady/solid ping as before. Re-spawning also refreshes the ping and score.

So, my question is: Is there a way to force the scoreboard to refresh?

Here's the script:
Code:
function EscapeMenuGui()
{
    new GuiControl(PauseGui)
    {
      canSaveDynamicFields = "0";
      Enabled = "1";
      isContainer = "1";
      Profile = "SyncMenuBG";
      HorizSizing = "width";
      VertSizing = "height";
      position = "0 0";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
     
        new GuiControl()
        {
            canSaveDynamicFields = "0";
            Enabled = "1";
            isContainer = "1";
            Profile = "SyncTransBG";
            HorizSizing = "left";
            VertSizing = "center";
            position = "-200 0";
            Extent = "151 234";
            minExtent = "151 234";
            canSave = "1";
            Visible = "1";
            hovertime = "1000";
           
            new GuiBitmapButtonCtrl(ResumeGameButton)
            {
                profile = "MenuTextButtonProfile";
                horizSizing = "center";
                vertSizing = "top";
                position = "0 0";
                extent = "152 25";
                minExtent = "152 25";
                visible = "1";
                accelerator = "escape";
                helpTag = "0";
                text = "Resume";
                bitmap = "mods/autoexec/Sync/Buttons/menuButton";
            };
               
            new GuiBitmapButtonCtrl(RespawnButton)
            {
                profile = "MenuTextButtonProfile";
                horizSizing = "center";
                vertSizing = "top";
                position = "0 30";
                extent = "152 25";
                minExtent = "152 25";
                visible = "1";
                accelerator = "";
                helpTag = "0";
                text = "Respawn";
                bitmap = "mods/autoexec/Sync/Buttons/menuButton";
            };
           
            new GuiBitmapButtonCtrl(JoinTeam1Button)
            {
                profile = "MenuTextButtonProfile";
                horizSizing = "center";
                vertSizing = "top";
                position = "0 60";
                extent = "152 25";
                minExtent = "152 25";
                visible = "1";
                accelerator = "";
                helpTag = "0";
                text = "Join Beta";
                bitmap = "mods/autoexec/Sync/Buttons/menuButton";
            };
                       
            new GuiBitmapButtonCtrl(JoinTeam0Button)
            {
                profile = "MenuTextButtonProfile";
                horizSizing = "center";
                vertSizing = "top";
                position = "0 90";
                extent = "152 25";
                minExtent = "152 25";
                visible = "1";
                accelerator = "";
                helpTag = "0";
                text = "Join Alpha";
                bitmap = "mods/autoexec/Sync/Buttons/menuButton";
            };
               
            new GuiBitmapButtonCtrl(LoadoutsButton)
            {
                profile = "MenuTextButtonProfile";
                horizSizing = "center";
                vertSizing = "top";
                position = "0 120";
                extent = "152 25";
                minExtent = "152 25";
                visible = "1";
                accelerator = "";
                helpTag = "0";
                text = "Loadouts";
                bitmap = "mods/autoexec/Sync/Buttons/menuButton";
            };
               
            new GuiBitmapButtonCtrl(GamePanelButton)
            {
                profile = "MenuTextButtonProfile";
                horizSizing = "center";
                vertSizing = "top";
                position = "0 150";
                extent = "152 25";
                minExtent = "152 25";
                visible = "1";
                accelerator = "";
                helpTag = "0";
                text = "Game Panel";
                bitmap = "mods/autoexec/Sync/Buttons/menuButton";
            };
                   
            new GuiBitmapButtonCtrl(InGameOptionsButton)
            {
                class = "OptionsButton";
                profile = "MenuTextButtonProfile";
                horizSizing = "center";
                vertSizing = "top";
                position = "0 180";
                extent = "152 25";
                minExtent = "152 25";
                visible = "1";
                accelerator = "";
                helpTag = "0";
                text = "Options";
                bitmap = "mods/autoexec/Sync/Buttons/menuButton";
            };
               
            new GuiBitmapButtonCtrl(LeaveGameButton)
            {
                profile = "MenuTextButtonProfile";
                horizSizing = "center";
                vertSizing = "top";
                position = "0 210";
                extent = "152 25";
                minExtent = "152 25";
                visible = "1";
                accelerator = "";
                helpTag = "0";
                text = "Leave game";
                bitmap = "mods/autoexec/Sync/Buttons/menuButton";
            };
        };
       
        new GuiControl()
        {
            isContainer = "1";
            modal = "false";
            profile = "SyncMenuBG";
            horizSizing = "center";
            vertSizing = "bottom";
            position = "0 0";
            extent = "10000 25";
               
            new GuiMLTextCtrl()
            {
                profile = "SpeedDisplayProfile";
                horizSizing = "center";
                vertSizing = "center";
                extent = "10000 10";
                position = "0 5";
                text = "<just:center>" @ "Scoreboard";
            };
        };
       
        new GuiMLTextCtrl(ScoreboardHeader)
        {
            profile = "ScoreHeaderTextProfile";
            horizSizing = "center";
            vertSizing = "bottom";
            position = "0 75";
            extent = "600 22";
            minExtent = "600 22";
            visible = "1";
            helpTag = "0";
            lineSpacing = "2";
            allowColorChars = "0";
        };
       
        new GuiMLTextCtrl(ScoreboardSubHeader)
        {
            profile = "ScoreHeaderTextProfile";
            horizSizing = "center";
            vertSizing = "bottom";
            position = "0 100";
            extent = "600 22";
            minExtent = "600 22";
            visible = "1";
            helpTag = "0";
            lineSpacing = "2";
            allowColorChars = "0";
        };
       
        new GuiScrollCtrl(ScoreboardContent)
        {
            canSaveDynamicFields = "0";
            Enabled = "1";
            isContainer = "1";
            Profile = "SyncTransBG";
            HorizSizing = "center";
            VertSizing = "height";
            position = "0 125";
            Extent = "600 278";
            MinExtent = "600 278";
            canSave = "1";
            Visible = "1";
            hovertime = "1000";
            willFirstRespond = "1";
            hScrollBar = "alwaysOff";
            vScrollBar = "alwaysOn";
            constantThumbHeight = "0";
            childMargin = "0 0";
        };
    };
    GameHud.add(EscapeMenuGui);
}
 
package SyncGuiPack
{
    function HudOverlay::AddHudElements(%this)
    {
        parent::AddHudElements(%this);
       
        EscapeMenuGui();
    }
};
activatepackage(SyncGuiPack);
 

Triad

Legions Developer
The current scoreboard (ScoreboardGui) calls for updates when an onWake event occurs and hides the GUI when an onSleep occurs with the following functions:

Code:
function ScoreboardGui::onWake( %this )
{
  commandToServer('ShowScoreHud');
}
 
function ScoreboardGui::onSleep( %this )
{
  commandToServer('HideScoreHud');
}

But since you have created your own, you need to add these functions for your GUI. However, you may need to add a container GuiControl that wraps the scoreboard section of your code, give it a name, and then create the functions:

Code:
function Your_GUI_Control_Name::onWake( %this )
{
  commandToServer('ShowScoreHud');
}
 
function Your_GUI_Control_Name::onSleep( %this )
{
  commandToServer('HideScoreHud');
}

This isn't tested, but that's my guess to the problem.
 

Arch

Legions Developer
The current scoreboard (ScoreboardGui) calls for updates when an onWake event occurs and hides the GUI when an onSleep occurs with the following functions:

Code:
function ScoreboardGui::onWake( %this )
{
  commandToServer('ShowScoreHud');
}
 
function ScoreboardGui::onSleep( %this )
{
  commandToServer('HideScoreHud');
}

But since you have created your own, you need to add these functions for your GUI. However, you may need to add a container GuiControl that wraps the scoreboard section of your code, give it a name, and then create the functions:

Code:
function Your_GUI_Control_Name::onWake( %this )
{
  commandToServer('ShowScoreHud');
}
 
function Your_GUI_Control_Name::onSleep( %this )
{
  commandToServer('HideScoreHud');
}

This isn't tested, but that's my guess to the problem.
This did it. Thanks a bunch. ;)
 

Piggeh

Puzzlemaster
Just want to say - I really like this HUD. It looks polished and minimalistic. Great job, and keep up the amazing work :D
 

Arch

Legions Developer
Just want to say - I really like this HUD. It looks polished and minimalistic. Great job, and keep up the amazing work :D
Thanks



And I actually have another question unrelated to refreshing. (I am more of a GUI guy, I suck at the logic portion.)

Is it possible to input the value of the clock/countdown timers into a GuiMLTextCtrl? I looked over countdownTimer.cs and spit-balled a few ideas I had but none of them seemed to do much good.
 

Volt Cruelerz

Legions Developer
Yes. You just need to add a callback function. The client receives indications of how much time is left every five minutes of game time IIRC in addition to when you first join. Simply sync it then and you should be fine.
 

RockeyRex

Legions Developer
Is it possible to input the value of the clock/countdown timers into a GuiMLTextCtrl? I looked over countdownTimer.cs and spit-balled a few ideas I had but none of them seemed to do much good.
client/gui/scripts/gameHud.cs
 
Top