Page 1 of 1

Company rating via Server Admin Port

Posted: 10 Jan 2019 09:17
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.

Re: Company rating via Server Admin Port

Posted: 10 Jan 2019 21:14
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/

Re: Company rating via Server Admin Port

Posted: 10 Jan 2019 21:35
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).

Re: Company rating via Server Admin Port

Posted: 10 Jan 2019 21:53
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

Re: Company rating via Server Admin Port

Posted: 10 Jan 2019 22:02
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.

Re: Company rating via Server Admin Port

Posted: 10 Jan 2019 22:22
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);

Re: Company rating via Server Admin Port

Posted: 10 Jan 2019 23:09
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.

Re: Company rating via Server Admin Port

Posted: 10 Jan 2019 23:13
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.

Re: Company rating via Server Admin Port

Posted: 10 Jan 2019 23:47
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)

Re: Company rating via Server Admin Port

Posted: 10 Jan 2019 23:53
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.

Re: Company rating via Server Admin Port

Posted: 13 Jan 2019 18:54
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