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

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

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

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

Post 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...
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
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

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

Post by agentw4b »

It would also be good if Gamescript could delete cities. For now, he can only add them.
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
2TallTyler
Route Supervisor
Route Supervisor
Posts: 507
Joined: 11 Aug 2019 18:15
Contact:

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

Post 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.
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

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

Post 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
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
kkidslogin
Engineer
Engineer
Posts: 23
Joined: 01 Feb 2024 21:02
Location: Tal'dorese Empire

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

Post 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.
Certified forum helper ©. Also active in the Scratch forums, where I have over 2300 posts as of the last count.

Played OpenTTD since 1.4.4 8)
User avatar
2TallTyler
Route Supervisor
Route Supervisor
Posts: 507
Joined: 11 Aug 2019 18:15
Contact:

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

Post 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. :)
User avatar
kkidslogin
Engineer
Engineer
Posts: 23
Joined: 01 Feb 2024 21:02
Location: Tal'dorese Empire

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

Post 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!
Certified forum helper ©. Also active in the Scratch forums, where I have over 2300 posts as of the last count.

Played OpenTTD since 1.4.4 8)
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

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

Post 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.
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
2TallTyler
Route Supervisor
Route Supervisor
Posts: 507
Joined: 11 Aug 2019 18:15
Contact:

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

Post 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.
User avatar
jfs
Tycoon
Tycoon
Posts: 1764
Joined: 08 Jan 2003 23:09
Location: Denmark

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

Post 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.
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

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

Post by agentw4b »

It would be enough if the Gamescript could also use RCON. A lot of things would be greatly simplified.
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
_dp_
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 18 Dec 2013 12:32

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

Post 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.
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

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

Post 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
Attachments
admin.png
(438.26 KiB) Not downloaded yet
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
_dp_
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 18 Dec 2013 12:32

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

Post 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.
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

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

Post 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.
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
_dp_
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 18 Dec 2013 12:32

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

Post by _dp_ »

You can chose which company story book you want to open when you press the button
Attachments
Screenshot from 2024-02-21 23-59-56.png
Screenshot from 2024-02-21 23-59-56.png (202.07 KiB) Viewed 1107 times
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

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

Post by agentw4b »

I also wanted to introduce a hacking tool for fun: a time-limited number generator. :-)
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
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

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

Post 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.
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
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

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

Post 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.
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
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

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

Post 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.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: Google [Bot] and 13 guests