The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on December 29, 2024, 07:35:17 PM

Title: rules with null value in the default parameter
Post by: Yona-TYT on December 29, 2024, 07:35:17 PM


When tile_x.remove_object() is executed the default parameter that this sends is not null, for example:
t.remove_object(player, mo_label)

For a text label the default parameter = "27"

To take advantage of this, I would like to create a rule like: rules.forbid_way_tool(pl, tool_id, wt_all, "null")

This would then allow removing text labels using "t.remove_object(player, mo_label)", but forbid the use of tool remover on other objects.
Title: Re: rules with null value in the default parameter
Post by: prissi on December 30, 2024, 03:52:28 AM
If a player executes the interactive removal tool, the default_paramter is not set, i.e. NULL. You cannot selectively forbid removing the players stuff, that is not possible. Such a tool would only block other scripts.
Title: Re: rules with null value in the default parameter
Post by: Yona-TYT on December 30, 2024, 11:24:33 AM
You say it is not possible to filter a tool whose parameter is null ?.
Title: Re: rules with null value in the default parameter
Post by: prissi on December 30, 2024, 02:30:37 PM
You can filter that tool. With NULL, It would block all removal actions, no matter what you are going to remove. If you filter for default_parameter "27", then it would only filter script tools, as these are the only ones using this parameter.
Title: Re: rules with null value in the default parameter
Post by: Yona-TYT on December 30, 2024, 08:39:47 PM
Quote from: prissi on December 30, 2024, 02:30:37 PMYou can filter that tool. With NULL, It would block all removal actions, no matter what you are going to remove. If you filter for default_parameter "27", then it would only filter script tools, as these are the only ones using this parameter.

I see, if I use null it would be the same as using "" or using 0 , or at least that's what I understood. There are no rules to indicate the type of object that should be deleted and those that should not.