Post: Players Menu Display/Selection Issues
10-10-2015, 07:09 PM #1
BullyWiiPlaza
Climbing up the ladder
(adsbygoogle = window.adsbygoogle || []).push({}); In my GSC menu, I have a sub menu with each player in the lobby. Note that it is using You must login or register to view this content..

The problem with the base is that in-game not all 12 players can be displayed on a single page. When there are 10 or more entries, all entries in the list become invisible.
First question: How do I fix the "invisible entries" bug when there are too many entries on one page in the menu? Can I fit all 18 players in there somehow?

Since Shark's menu assumes that there are only 12 players at maximum, it will not pickup other players when there are e.g. up to 18 people in the match. To fix the players menu, I decided to add a "more" button to access the second page of players.

In the createMenu() function, I'm using this:
    self.playerOptionsIdentifier = "Specific Players";
self add_option(self.adminMenuIdentifier, self.playerOptionsIdentifier, ::submenu, self.playerOptionsIdentifier, "");
self add_menu(self.playerOptionsIdentifier, self.adminMenuIdentifier, self.adminMenuAccessRequirements);
self.morePlayerOptionsIdentifier = "More Players";


My updatePlayersMenu() function now looks like this:

    updatePlayersMenu()
{
// Remove all entries
self.menu.menucount[self.playerOptionsIdentifier] = 0;
self.menu.menucount[self.morePlayerOptionsIdentifier] = 0;

maximumPlayersPerPageCount = 8;
playersCount = level.players.size;

// Do not start a 3rd page with players
if(playersCount > 17)
{
playersCount = 17;
}

for (i = 0; i < playersCount; i++)
{
player = level.players[i];
playerName = getPlayerName(player);

if(i < maximumPlayersPerPageCount)
{
// Add players to first page
playerMenuIdentifier = self.playerOptionsIdentifier;
}
else
{
// Add players to second page
playerMenuIdentifier = self.morePlayerOptionsIdentifier;
}

// Add more players sub menu
if(i == maximumPlayersPerPageCount)
{
self add_option(self.playerOptionsIdentifier, "more...", ::submenu, playerMenuIdentifier, "");
self add_menu(playerMenuIdentifier, self.playerOptionsIdentifier, self.adminMenuAccessRequirements);
}

// Prevent the cursor from getting out of bounds when players drop out of the lobby
maximumMenuIndex = maximumPlayersPerPageCount;
if(self.menu.curs[playerMenuIdentifier] > maximumMenuIndex)
{
self.menu.scrollerpos[playerMenuIdentifier] = maximumMenuIndex;
self.menu.curs[playerMenuIdentifier] = maximumMenuIndex;
}

// Add each player as option
self add_option(playerMenuIdentifier, "[" + verificationToColor(player.status) + "^7] " + playerName, ::submenu, "pOpt " + i, "[" + verificationToColor(player.status) + "^7] " + playerName);

self add_menu_alt("pOpt " + i, playerMenuIdentifier);

// Add options for each player
statisticsIdentifier = "Statistics" + i;
self add_option("pOpt " + i, "Statistics", ::submenu, statisticsIdentifier, "");
self add_menu(statisticsIdentifier, "pOpt " + i, self.adminMenuAccessRequirements);
self add_option(statisticsIdentifier, "Level 55", ::setLevel55, player);
// ...
}
}

The code works kinda but with 18 players they also don't fit on 2 pages (8 + 9 = 17). Additionally, I have a menu selection bug where the cursor is not on any selectable field in the player options menu the first time I get there for each player, so I have to scroll once first for it to become a valid selection.

Second question: Why is the selection bugged? It works properly everywhere else in the menu. What did I screw up there? I believe it might have to do with the submenu() function as well since it handles the updating of the players menu:

    submenu(input, title)
{
if (verificationToNumber(self.status) >= verificationToNumber(self.menu.status[input]))
{
self.menu.options clear(self);

if (input == self.mainMenuIdentifier)
{
self thread StoreText(input, self.mainMenuIdentifier);
}
else if (input == self.playerOptionsIdentifier || input == self.morePlayerOptionsIdentifier)
{
self updatePlayersMenu();
self thread StoreText(input, "Players");
}
else
{
self thread StoreText(input, title);
}

self updateScrollbar();

self.CurMenu = input;

self.menu.scrollerpos[self.CurMenu] = self.menu.curs[self.CurMenu];
self.menu.curs[input] = self.menu.scrollerpos[input];
self updateScrollbar();

if (!self.menu.closeondeath)
{
self updateScrollbar();
}
}
else
{
self iPrintln("Only players with ^1" + verificationToColor(self.menu.status[input]) + " ^7can access this menu");
}
}


Thank you for helping Smile
(adsbygoogle = window.adsbygoogle || []).push({});
10-10-2015, 07:15 PM #2
FRINZ
I’m too L33T
just update the players menu i can help u out with this hmu on skype imhxtez c:
10-10-2015, 08:44 PM #3
-Numb
You talkin to me?
Originally posted by BullyWiiPlaza View Post
I have a menu selection bug where the cursor is not on any selectable field in the player options menu the first time I get there for each player, so I have to scroll once first for it to become a valid selection.


I can't help with the rest but to fix that go on add_menu_alt(Menu, prevmenu) function and add this to it: self.menu.scrollerpos[Menu] = 0;

The following user thanked -Numb for this useful post:

BullyWiiPlaza
10-11-2015, 12:20 AM #4
BullyWiiPlaza
Climbing up the ladder
Originally posted by Numb View Post
I can't help with the rest but to fix that go on add_menu_alt(Menu, prevmenu) function and add this to it: self.menu.scrollerpos[Menu] = 0;

Indeed! I still had a call to add_menu_alt(Menu, prevmenu) which didn't contain setting the scroller position yet.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo