Page 1 of 2

add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 19 Feb 2024 09:14
by agentw4b
Please add commands for kick, ban, setting_newgame, restart (doesn't matter that it crashes the control script, it will start again after restart), rcon to the NoGo API for Gamescripts. I'm working on an Admin interface using buttons in Storybook and I miss these options a lot. Although the use of Adminport is still promoted, the official developers do not offer any suitable client that can receive commands from the game and do these things. They are only third-party tools that do something, but using them requires months of learning programming languages...

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 19 Feb 2024 09:23
by agentw4b
It would also be good if Gamescript could delete cities. For now, he can only add them.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 19 Feb 2024 17:00
by 2TallTyler
Game Scripts cannot add towns because towns cannot be deleted in-game -- only in Scenario Editor, and then only if no stations, industries, houses, etc., refer to that town as their parent location.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 19 Feb 2024 18:07
by agentw4b
The game script can add cities, but cannot delete them. I use the city founder in the "City Founder GS" gamescript.
GSTown::FoundTown

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 19 Feb 2024 22:22
by kkidslogin
2TallTyler wrote: 19 Feb 2024 17:00 Game Scripts cannot add towns because towns cannot be deleted in-game -- only in Scenario Editor, and then only if no stations, industries, houses, etc., refer to that town as their parent location.
Just an idea: why shouldn't it be possible? I don't know what goes on in the code, but why not iterate through the company infrastructure and industries that refer to that town, set them to another nearby town (Or unincorporate them, perhaps), delete the houses, and delete the town reference? This could be a possible solution.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 20 Feb 2024 13:32
by 2TallTyler
Yes, it can be solved. I'm just explaining why it's not as simple as adding a missing method to the script API. PRs welcome. :)

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 20 Feb 2024 14:08
by kkidslogin
2TallTyler wrote: 20 Feb 2024 13:32 Yes, it can be solved. I'm just explaining why it's not as simple as adding a missing method to the script API. PRs welcome. :)
Time to learn C++ then!

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 20 Feb 2024 14:20
by agentw4b
So I mainly don't understand why Gamescripts were created in the "squirrell language" to replace the console, when they didn't replace everything from the console and a lot of things have to be solved in various complex procedures. Also, plain text output from the closed Gamescript API is a technical problem. However, everything is answered here: Activate the Admin port or by parsing logs via python scripts. But similar functionalities should simply be enabled by default in Gamescripts. It would save server admins nerves.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 20 Feb 2024 15:06
by 2TallTyler
Looking forward to reviewing your PR! :)

I believe in Scenario Editor there is an error if you try to delete a town that is referenced by something, so you might start there.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 20 Feb 2024 16:03
by jfs
Game scripts were not created to replace the console.

Game scripts are intended to change the rules of the game by modifying the game world and giving players goals and such.
The console is intended to manage the game, and can be supplemented with the admin port.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 20 Feb 2024 20:02
by agentw4b
It would be enough if the Gamescript could also use RCON. A lot of things would be greatly simplified.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 20 Feb 2024 20:11
by _dp_
Considering story book is fully visible to everyone using it for admin interface doesn't sound like a good idea. And, yeah, GameScript is so not made for this task, I'm not sure how you're even going to authenticate an admin with it.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 21 Feb 2024 08:03
by agentw4b
In each script, you can set which company the script works for. In my program I'm creating, I'm assuming that the administrator also has a business, and that the administrator will change during the game.
Image


Image

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 21 Feb 2024 12:05
by _dp_
But everyone can see story book of each company. And I'm pretty sure that pin you enter there gets broadcasted to every client.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 21 Feb 2024 18:15
by agentw4b
I think it's divided into the global story book and the company story books, so you can't see everything, but I'll try...good reminder.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 21 Feb 2024 18:30
by _dp_
You can chose which company story book you want to open when you press the button

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 21 Feb 2024 18:31
by agentw4b
I also wanted to introduce a hacking tool for fun: a time-limited number generator. :-)

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 21 Feb 2024 18:58
by agentw4b
If other users could see the buttons pressed directly, it would be a problem, unfortunately I have canceled the Openttd server now, so I can't verify it now.......I can hide the resulting PIN with asterisks or it may not show at all.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 24 Feb 2024 07:52
by agentw4b
I tested it with a friend and he can't see what I press for the buttons on the page, so this is not a problem.

Re: add commands for kick, ban, setting_newgame, restart to Gamescript

Posted: 24 Feb 2024 13:31
by Eddi
this is just my personal opinion, but it feels a lot like "wrong tool for the job".

for server admin stuff, use the admin port. do not abuse the game script.