News:

Want to praise Simutrans?
Your feedback is important for us ;D.

Recent posts

#21
Scripting Scenarios and AI / Re: need welt->get_active_play...
Last post by makie - June 30, 2026, 02:06:15 PM
Most player play in single mode and the simplest method to cheat is to play without bankruptcy.
I'd like to see that player who delves into the depths of the Squirrel-API and write a script just to cheat in a multiplayer simutrans game. We are not at Counter-Strike.

Okay, I'll add a check that stops the script if there isn't enough money, with a note to rerun as a public player.
#22
Scripting Scenarios and AI / Re: need welt->get_active_play...
Last post by prissi - June 30, 2026, 01:27:26 PM
Ah, yes, this works only in the scenario modus. In normal game mode, the tools (and AIs) can only use the same tools as the player, so no cheating in multiplayer games. That was a design decision.

For what you want to achieve, the easiest way is probaly so have an error message if the player's name is not player_x(1).get_name() in the script, to only run it when the player is the public player.

function work(pl, pos) {
  if(pl.get_name()!=player_x(1).get_name()) {
    return "This tool must be run as public player"
  }
  ...
}
#23
Simutrans Help Center / Re: Tuturial
Last post by prissi - June 30, 2026, 01:21:24 PM
Make sure you have the latest version 124.5. Older one had a bug stuck at the date display when in month only format.

And which pakset?
#24
Patches & Projects / Re: Change direction of player...
Last post by prissi - June 30, 2026, 01:18:40 PM
The width was indeed only working for one size and looked wrong with different font sizes, true. r12051 should address this.

The gap felt wrong to me. Also, I found it easier in my testgames when there was a constant width for all halt with a share. Otherwise, shares between just two players (especially with darker colors) were harder to find compared to larger multishares. Maybe it is a matter of taste, I fear.
#25
Simutrans Help Center / Tuturial
Last post by Zignotty2021 - June 30, 2026, 01:02:07 PM
Hi I just downloaded the game again after a while not playing it.

I have a question I can't get the in game Tutorial to run?

What do I do?

Thanks
#26
Patches & Projects / Re: Change direction of player...
Last post by Nazalassa - June 30, 2026, 10:54:01 AM
In display settings the checkbox does not change state when clicked (otherwise it works fine).

Also, regarding the little permission rectangles above station names, I think I like the previous display more; with the new way there is no gap between the different rectangles and it scales weirdly when zooming/dezooming.
#27
Scripting Scenarios and AI / Re: need welt->get_active_play...
Last post by makie - June 30, 2026, 10:41:21 AM
Quote from: prissi on June 30, 2026, 08:35:40 AMOr you can use the trick of the testcode, and restore the budget after each build ...
pl.book_cash(amount - pl.get_current_net_wealth())
No,  doesn't work ::(

api_player.cc
Quoteif (scenario) {
        /**
        * Change bank account of player by given amount @p delta.
        * @param delta
        * @ingroup scen_only
        */
        register_method(vm, player_book_account, "book_cash", true);
    }
#28
Scripting Scenarios and AI / Re: need welt->get_active_play...
Last post by makie - June 30, 2026, 08:58:46 AM
Mea culpa. I trusted the documentation without testing it myself.
Quotelocal werkzeug = command_x(tool_switch_player)
        local is_ok = werkzeug.work(publicPlayer,p1,"")
command_x(tool_switch_player)  doesn't work at all
#29
Scripting Scenarios and AI / Re: need welt->get_active_play...
Last post by makie - June 30, 2026, 08:41:50 AM
Yes this work (I do it so) but:

local [b]public_pl = player_x(1)[/b]
    local factory_builder = command_x(tool_build_factory)
    return factory_builder.work([b]public_pl[/b], pos, "" + ignore_climates.tointeger() + rotation + base_prod + "," + name)
public_pl is ignored
Have you check who pay the factory? It is the player!

Quote from: prissi on June 30, 2026, 08:35:40 AMOr you can use the trick of the testcode, and restore the budget after each build ...
pl.book_cash(amount - pl.get_current_net_wealth())
Ok this trick is a solution i think. 8)
#30
Scripting Scenarios and AI / Re: need welt->get_active_play...
Last post by prissi - June 30, 2026, 08:35:40 AM
The script will fail if the public player is locked ...

But a quick check showed that this worked:
function build_factory(pos, ignore_climates, rotation, base_prod, name)
{
local public_pl = player_x(1)
local factory_builder = command_x(tool_build_factory)
return factory_builder.work(public_pl, pos, "" + ignore_climates.tointeger() + rotation + base_prod + "," + name)
}

And you can find out if the player is the public player, if pl.get_name() == player_x(1).get_name() then you are the public player.

Or you can use the trick of the testcode, and restore the budget after each build ...
pl.book_cash(amount - pl.get_current_net_wealth())