Company rating via Server Admin Port

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
Hezkore
Engineer
Engineer
Posts: 27
Joined: 02 Sep 2008 07:45

Company rating via Server Admin Port

Post by Hezkore »

Is there a way to get company rating via the server admin port?
I'm talking about the rating shown in Company League Table.
Keep it simple.
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Company rating via Server Admin Port

Post by agentw4b »

Hezkore wrote:Is there a way to get company rating via the server admin port?
I'm talking about the rating shown in Company League Table.
There is an Ottd stats project that stores company information into the SQL database
https://dev.openttdcoop.org/projects/ottdstats/
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
User avatar
Hezkore
Engineer
Engineer
Posts: 27
Joined: 02 Sep 2008 07:45

Re: Company rating via Server Admin Port

Post by Hezkore »

Hmm, alright.
I'm not really finding any proper information about how they're getting league table information though.
I basically want to know what company is leading (according to the Company League Table found in-game).
Keep it simple.
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Company rating via Server Admin Port

Post by agentw4b »

Easier it is probably through the "companies" console command. But GSCompany also has some interesting commands: https://nogo.openttd.org/api/1.8.0/classGSCompany.html
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
User avatar
Hezkore
Engineer
Engineer
Posts: 27
Joined: 02 Sep 2008 07:45

Re: Company rating via Server Admin Port

Post by Hezkore »

agentw4b wrote:Easier it is probably through the "companies" console command.
Sadly the `companies` command does not show the rating of the company, only ID and some economy stats that I'm already able to track.
Keep it simple.
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Company rating via Server Admin Port

Post by agentw4b »

Hezkore wrote:
agentw4b wrote:Easier it is probably through the "companies" console command.
Sadly the `companies` command does not show the rating of the company, only ID and some economy stats that I'm already able to track.
static int32 GetQuarterlyPerformanceRating (CompanyID company, uint32 quarter)
Get the performance rating of the given company in the given quarter.
---------------------------------------------------------------------------------------------------
GSCompany.GetQuarterlyPerformanceRating (company, quarter);
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Company rating via Server Admin Port

Post by planetmaker »

agentw4b wrote:
Hezkore wrote:
agentw4b wrote:Easier it is probably through the "companies" console command.
Sadly the `companies` command does not show the rating of the company, only ID and some economy stats that I'm already able to track.
static int32 GetQuarterlyPerformanceRating (CompanyID company, uint32 quarter)
Get the performance rating of the given company in the given quarter.
---------------------------------------------------------------------------------------------------
GSCompany.GetQuarterlyPerformanceRating (company, quarter);
Correct me, if I'm not well informed here: To me that means it's available to GameScripts. But the GameScript can make it in turn available to the admin port via GSAdmin::Send.
User avatar
Hezkore
Engineer
Engineer
Posts: 27
Joined: 02 Sep 2008 07:45

Re: Company rating via Server Admin Port

Post by Hezkore »

That's what I believe and I'm trying to figure out...
But the server wants a JSON structure of the code, not just raw game script.
So I'm guessing it's related to `ServerGS`, but I don't think you need the ServerGS script anymore.
I believe the server just has it built-in these days.

I'm trying to send stuff like:

Code: Select all

{
    "action" = "ping",
    "number" = 0
}
Which I found via the ServerGS readme - https://dev.openttdcoop.org/projects/gs ... me.txt#L44
But the server never responds with anything other than basically saying "I got this piece of code" in the console.
There's never any reply or even error message.

I've tried installing the ServerGS script, but there's no error or reply anyways.
Keep it simple.
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: Company rating via Server Admin Port

Post by Eddi »

after downloading ServerGS, you must enable it in openttd.cfg, and then start a new game (or upload a savegame where it has been activated in your client)
User avatar
Hezkore
Engineer
Engineer
Posts: 27
Joined: 02 Sep 2008 07:45

Re: Company rating via Server Admin Port

Post by Hezkore »

I downloaded the repo from https://dev.openttdcoop.org/projects/gs ... repository
Extracted into `openttd/game/servergs`
Edited the `openttd.cfg` (which btw should be called `.ini`):

Code: Select all

[game_scripts]
ServerGS = 
Restarted my server.
Joined my server and called `rcon _PASS_ newgame`
And sent an `AdminGamescript` packet to the server.
But as always, the reply is just:

Code: Select all

Packet: ServerConsole
message: [admin] GameScript JSON from '_USER_' (_VER_): '{"action"="ping","number"=0}'
origin: net
No reply from the gamescript, no error, no result.
Keep it simple.
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Company rating via Server Admin Port

Post by agentw4b »

I did not try to use this, but:

ServerGS 2 is downloable from oficial Bananas server.

ServerGS 3 is here:

viewtopic.php?f=65&t=68828
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Bing [Bot] and 18 guests