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
Hezkore
Engineer
Engineer
Posts: 21
Joined: 02 Sep 2008 07:45

Company rating via Server Admin Port

Post by Hezkore » 10 Jan 2019 09:17

Is there a way to get company rating via the server admin port?
I'm talking about the rating shown in Company League Table.

agentw4b
Traffic Manager
Traffic Manager
Posts: 153
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Company rating via Server Admin Port

Post by agentw4b » 10 Jan 2019 21:14

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:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS

Hezkore
Engineer
Engineer
Posts: 21
Joined: 02 Sep 2008 07:45

Re: Company rating via Server Admin Port

Post by Hezkore » 10 Jan 2019 21:35

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).

agentw4b
Traffic Manager
Traffic Manager
Posts: 153
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Company rating via Server Admin Port

Post by agentw4b » 10 Jan 2019 21:53

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:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS

Hezkore
Engineer
Engineer
Posts: 21
Joined: 02 Sep 2008 07:45

Re: Company rating via Server Admin Port

Post by Hezkore » 10 Jan 2019 22:02

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.

agentw4b
Traffic Manager
Traffic Manager
Posts: 153
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Company rating via Server Admin Port

Post by agentw4b » 10 Jan 2019 22:22

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:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
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: 9275
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Company rating via Server Admin Port

Post by planetmaker » 10 Jan 2019 23:09

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.

Hezkore
Engineer
Engineer
Posts: 21
Joined: 02 Sep 2008 07:45

Re: Company rating via Server Admin Port

Post by Hezkore » 10 Jan 2019 23:13

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.

Eddi
Tycoon
Tycoon
Posts: 7369
Joined: 17 Jan 2007 00:14

Re: Company rating via Server Admin Port

Post by Eddi » 10 Jan 2019 23:47

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)
You might not exactly be interested in Ferion, but if you are, have fun :)

Hezkore
Engineer
Engineer
Posts: 21
Joined: 02 Sep 2008 07:45

Re: Company rating via Server Admin Port

Post by Hezkore » 10 Jan 2019 23:53

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.

agentw4b
Traffic Manager
Traffic Manager
Posts: 153
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Company rating via Server Admin Port

Post by agentw4b » 13 Jan 2019 18:54

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:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
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: No registered users and 3 guests