News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

rules with null value in the default parameter

Started by Yona-TYT, December 29, 2024, 07:35:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT



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.

prissi

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.

Yona-TYT

You say it is not possible to filter a tool whose parameter is null ?.

prissi

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.

Yona-TYT

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.