The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on July 28, 2021, 04:53:14 PM

Title: tool_id = 4099? What tool is this?
Post by: Yona-TYT on July 28, 2021, 04:53:14 PM
tool_id = 4099? What tool is this? Why does it run without clicking and breaks into the tunnel construction? I think this is what is confusing me.
Title: Re: tool_id = 4099? What tool is this?
Post by: Dwachs on August 23, 2021, 05:45:28 PM
This is from terra forming the terrain for the tunnel portals.
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on August 23, 2021, 05:48:40 PM
Quote from: Dwachs on August 23, 2021, 05:45:28 PMThis is from terra forming the terrain for the tunnel portals.
But I think it is not defined in the constants.
Title: Re: tool_id = 4099? What tool is this?
Post by: prissi on August 24, 2021, 02:57:40 PM
Any number larger than 4096 conatins the tool flag. 4096 indicates general tool, 9291 dialog tools and 0x4000 simple tools.
Title: Re: tool_id = 4099? What tool is this?
Post by: Dwachs on August 24, 2021, 03:14:56 PM
should be defined as constants tool_raise_land/tool_lower_land
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on October 28, 2024, 12:12:56 PM
Is there a way to determine the tool_id?

Apparently tool_exec_script and tool_exec_two_click_script do not work for script tools integrated with scripts(xyz) in toolbars.


I'm trying to test the pak64 tutorial in pak64.german.
It already works in automatic mode. But the menus are a bit crazy. The most serious error is that you can't build a post office because the post office buildings aren't displayed.
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on October 28, 2024, 07:30:56 PM
Quote from: Andarix on October 28, 2024, 12:12:56 PMApparently tool_exec_script and tool_exec_two_click_script do not work for script tools integrated with scripts(xyz) in toolbars.
I have been wanting to implement something like this for a while now so I can have more information about the tool currently in use:

I was hoping that this last one would be implemented: https://forum.simutrans.com/index.php/topic,23228.0.html

That would allow me to make many improvements to the tutorial.
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on October 28, 2024, 07:38:23 PM
test-tools.zip
Quote from: Andarix on October 28, 2024, 12:12:56 PMI'm trying to test the pak64 tutorial in pak64.german.
It already works in automatic mode. But the menus are a bit crazy. The most serious error is that you can't build a post office because the post office buildings aren't displayed.

I have a script tool that helps me identify menu ids, I'll check it out.
Captura de pantalla -2024-10-28 01-07-44.png
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on October 28, 2024, 07:53:01 PM
For pak64.german the menus are very different so I think more specific changes need to be made :

// placeholder for some menus icon
t_icon <- {road = 0x8006, rail = 0x8003, ship = 0x8007, plane = 0x8008, other = 0x8009, slope = 0x8001, tram = 0x8005}
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on October 30, 2024, 05:21:22 PM
Added list for tool ids

https://github.com/simutrans/tutorial_pak64/pulls (https://github.com/simutrans/tutorial_pak64/pulls)
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on October 30, 2024, 06:59:16 PM
Quote from: Andarix on October 30, 2024, 05:21:22 PMAdded list for tool ids

https://github.com/simutrans/tutorial_pak64/pulls (https://github.com/simutrans/tutorial_pak64/pulls)

This is great! Thank you very much for your great contribution. 8)
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on October 30, 2024, 08:22:24 PM
First of all, the mixed formatting with taps and spaces means that more lines are changed than were actually changed. I prefer spaces because tabs can be set to different widths. The Simutrans program code also uses spaces, which is why I set my editor up like this.



The current tool system in the tutorial script is very confusing and many things are duplicated. In the pull request I added a new file where the tools should be collected. The first function there should deactivate everything that is not used in the entire tutorial.

It is not yet fully aligned.

Instead of hiding the terrain tools individually, it would make more sense to hide the menu itself. I am still exploring this, as it is all written in a rather confusing way.

I have also stored the package data in a file, as this makes it easier to switch the tutorial between the packages.

https://github.com/simutrans/tutorial_pak64/pulls (https://github.com/simutrans/tutorial_pak64/pulls)

Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on October 30, 2024, 09:42:19 PM
Quote from: Andarix on October 30, 2024, 08:22:24 PMFirst of all, the mixed formatting with taps and spaces means that more lines are changed than were actually changed. I prefer spaces because tabs can be set to different widths. The Simutrans program code also uses spaces, which is why I set my editor up like this.



The current tool system in the tutorial script is very confusing and many things are duplicated. In the pull request I added a new file where the tools should be collected. The first function there should deactivate everything that is not used in the entire tutorial.

It is not yet fully aligned.

Instead of hiding the terrain tools individually, it would make more sense to hide the menu itself. I am still exploring this, as it is all written in a rather confusing way.

I have also stored the package data in a file, as this makes it easier to switch the tutorial between the packages.

https://github.com/simutrans/tutorial_pak64/pulls (https://github.com/simutrans/tutorial_pak64/pulls)


That system is part of the original tutorial, it's really confusing, that's why it took me so long to implement the diffusion of icons in the menus.

The rules I follow with this are:
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on October 31, 2024, 06:25:23 PM
new partial pull request (https://github.com/simutrans/tutorial_pak64/pull/8)

@Yona
Can you please add the tools with 4xxx number to the tool_id_list.ods?
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on October 31, 2024, 09:13:48 PM
(The forum should support "CSV" file extensions to attach such files)

Quote from: Andarix on October 31, 2024, 06:25:23 PMnew partial pull request (https://github.com/simutrans/tutorial_pak64/pull/8)

@Yona
Can you please add the tools with 4xxx number to the tool_id_list.ods?
I don't quite understand what you're asking me, so I made a list for each case:

Hex (pak64):
0x1000,0x1001,0x1002,0x1003,0x1004,0x1005,0x1027,0x100e,0x100f,0x1010,0x1011,0x1012,0x1021,0x1014,0x1007,0x1015,0x1013,0x100b,0x1008,0x1006,0x101f,0x1020,0x1029,0x1028,0x1023,0x101e,0x1026,
Base 10 (pak64):
4096,4097,4098,4099,4100,4101,4135,4110,4111,4112,4113,4114,4129,4116,4103,4117,4115,4107,4104,4102,4127,4128,4137,4136,4131,4126,4134,
Hex (pak64.german):
0x1000,0x1001,0x1002,0x1003,0x1004,0x1005,0x1013,0x100e,0x1023,0x100b,0x101e,0x1006,0x101f,0x1029,0x1020,0x1028,0x1010,0x1012,0x1021,0x1014,0x1011,0x1008,0x1007,0x100f,0x1015,0x1026,0x1027,
Base 10 (pak64.german):
4096,4097,4098,4099,4100,4101,4115,4110,4131,4107,4126,4102,4127,4137,4128,4136,4112,4114,4129,4116,4113,4104,4103,4111,4117,4134,4135,
Edit.
I made a list with their respective names for the tools I request, I did this in pak64.german:
List_tools_pak64german.txt (Change the extension to CSV).
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on October 31, 2024, 10:42:58 PM
thanks
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on October 31, 2024, 11:27:50 PM
And pak64:
List_tools_pak64.txt
Title: Re: tool_id = 4099? What tool is this?
Post by: Isaac Eiland-Hall on November 01, 2024, 02:44:58 AM
Quote from: Yona-TYT on October 31, 2024, 09:13:48 PM(The forum should support "CSV" file extensions to attach such files)


(https://i.imgur.com/iU3Vksn.png)

https://i.imgur.com/iU3Vksn.png

(Added :) )
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on November 01, 2024, 02:46:39 AM
Quote from: Isaac Eiland-Hall on November 01, 2024, 02:44:58 AM(https://i.imgur.com/iU3Vksn.png)

https://i.imgur.com/iU3Vksn.png

(Added :) )
Great!. 🎉🎉🎉🎉
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 01, 2024, 10:08:08 AM
Chapter 2 should now work with the new system.

In pak64, however, the extensions of stations are also displayed. I don't yet know how to distinguish between stations and extensions.

https://github.com/simutrans/tutorial_pak64/pull/9 (https://github.com/simutrans/tutorial_pak64/pull/9)
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on November 02, 2024, 01:21:45 AM
Quote from: Andarix on November 01, 2024, 10:08:08 AMChapter 2 should now work with the new system.

In pak64, however, the extensions of stations are also displayed. I don't yet know how to distinguish between stations and extensions.

https://github.com/simutrans/tutorial_pak64/pull/9 (https://github.com/simutrans/tutorial_pak64/pull/9)
Station buildings cannot be differentiated since they have the same waytype (I correct myself, in some cases the waytype <= 0, so they can be filtered)
 and the same tool_id as a stop. There is a parameter that identifies when they are buildings, but I'm afraid it is not sent to the script API, the same happens with the system_type.

However, to hide extension buildings, in some cases it works by filtering by: waytype < 0
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 02, 2024, 01:36:00 AM
Well, in pak64.german, stations and extensions have been distributed to their own menus. That makes things easier now.

Currently, there still seem to be problems with darkening/blurring tools.

But the review of the display of tools has priority for now. I hope what I write is easier for you to understand than what has been written so far.
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on November 02, 2024, 02:42:58 AM
function start_chapter() //Start only once per chapter and start game
I think general_disabled_tools(player_x.nr) and chapter_step_enabled_tools(player_x.nr) should also be called from start_chapter() because it is executed at game start and when there is a change between chapters (That includes when a vehicle is removed).

Currently there is a problem, and that is that the tools are not updated when I load a savegame in chapter 3, st 2.
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 02, 2024, 08:04:44 AM
Add chapter_step_enabled_tools( pl ) end of chapter_disabled_tools( pl ) shold solved this.
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 03, 2024, 12:20:56 PM
From my side, the tool review is complete.

However, I have not tested all of the tools. Some further work may be required.

I hope that the tool manipulation is now a little easier to understand.
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on November 03, 2024, 07:59:00 PM
https://github.com/simutrans/tutorial_pak64/commit/3b80779bbe55d52315421dc78484352cff1a666c

Add the tunnels in step F and the signs in step I.

Edit.

Remove tool in CH2
https://github.com/simutrans/tutorial_pak64/commit/111a04dad8abd1fc4e6a2c0414b5c7130fc635ea

Edit2.

Remove and Remove Way in CHP3
https://github.com/simutrans/tutorial_pak64/commit/50677436e547ad73d1f30cbfb1d0f901b5736ec4

Edit3.
Remove and  Way tool in CP4
https://github.com/simutrans/tutorial_pak64/commit/ee96ad600e56ba398145fa0dc128b2bb2a8854d7
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on November 03, 2024, 08:52:56 PM
https://github.com/simutrans/tutorial_pak64/commit/4dd149eaede04549c25cb18f0203fde89ba105e6
Chapter 5 is a bit confusing with the tools, but the idea is to keep the previously used tools, does this mess up the menus in pak64.german?.

Here is a screenshot of what the menus look like in pak64 with this change:
Captura de pantalla -2024-11-03 16-49-13.png
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on November 03, 2024, 09:27:57 PM
In chapter 6 wt_power is not used, it is only used in chapter 5.

I made the following changes but I'm not sure if this is correct.

https://github.com/simutrans/tutorial_pak64/commit/afa47c5c10a18b870ec0dac7ab7554b4ab68047f

The result in the menus is as expected so for me it's fine like this:
Captura de pantalla -2024-11-03 17-24-07.png
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 03, 2024, 10:19:50 PM
There are no differences between the paksets for the tools themselves.

However, the Powerline tools have their own menu in pak64.german. They are no longer included in the special tools, which is why they do not have to be disabled if the Powerline menu is disabled. But it doesn't matter.

There are differences in the menus.
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on November 03, 2024, 10:52:29 PM
Quote from: Andarix on November 03, 2024, 10:19:50 PMThere are no differences between the paksets for the tools themselves.

However, the Powerline tools have their own menu in pak64.german. They are no longer included in the special tools, which is why they do not have to be disabled if the Powerline menu is disabled. But it doesn't matter.

There are differences in the menus.

The menus in pak64 look good now, however I haven't been able to test with pak64.german due to the difference with the industrial chain.

I'll wait for some beta version of the pak in the future.
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 03, 2024, 11:25:09 PM
During my test I found 2 errors in the menus in pak64.german.

Chapter 3 Step 8
The slope tools are not displayed. The tools needed to raise the tracks are also in the underground menu. However, the text says that they are the slope tools.

Chapter 4 Step B
The ship tools are not displayed.

[EDIT]
After saving and writing here the shiptools are now displayed.
strange
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 03, 2024, 11:37:32 PM
Quote from: Yona-TYT on November 03, 2024, 10:52:29 PMThe menus in pak64 look good now, however I haven't been able to test with pak64.german due to the difference with the industrial chain.

...

If these factories are missing, it is not a problem.

Screenshot 2024-11-04 003502.jpg

Unfortunately, the map has double heights, which results in an ugly landscape when loading with one height. It will take some time to adapt the surface.
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on November 03, 2024, 11:56:00 PM
Quote from: Andarix on November 03, 2024, 11:25:09 PMThe slope tools are not displayed. The tools needed to raise the tracks are also in the underground menu. However, the text says that they are the slope tools.
https://github.com/simutrans/tutorial_pak64/commit/e704fc99e75057873fbf6c1e4cf7832a1c91ddb6

I think that fixes the slopes for step H.

Additionally the tools are not used in the tutorial:
                          tool_raise_land,
                          tool_lower_land,
                          tool_restoreslope
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 04, 2024, 12:39:54 AM
fix for transformer in pak64.german

chapter 5 step C transformer 3

https://github.com/simutrans/tutorial_pak64/pull/13 (https://github.com/simutrans/tutorial_pak64/pull/13)
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 04, 2024, 10:39:46 AM
I have a problem in Chapter 6 Step D with pak64.german

The icon for the list tools is displayed as inactive.
And the icon for the road tools (0x800e) is not displayed.
The icon for the special tools is not displayed as inactive.
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on November 04, 2024, 11:46:46 AM
Quote from: Andarix on November 04, 2024, 10:39:46 AMThe icon for the list tools is displayed as inactive.
Quote from: Andarix on November 04, 2024, 10:39:46 AMThe icon for the special tools is not displayed as inactive.

https://github.com/simutrans/tutorial_pak64/commit/0ca3aefc4326d39cb36e187c482932f8cf7a3f1c
There was a bad id.

Quote from: Andarix on November 04, 2024, 10:39:46 AMAnd the icon for the road tools (0x800e) is not displayed.
This is strange, even returning true in function is_tool_allowed(pl, tool_id, wt) in chapter 6, the roads menu does not appear. :(


Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 04, 2024, 01:03:48 PM
Quote from: Yona-TYT on November 04, 2024, 11:46:46 AM...
This is strange, even returning true in function is_tool_allowed(pl, tool_id, wt) in chapter 6, the roads menu does not appear. :(


I don't know why the activation doesn't work. I removed the icon from the block list.

https://github.com/simutrans/tutorial_pak64/pull/14 (https://github.com/simutrans/tutorial_pak64/pull/14)
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on November 06, 2024, 09:06:19 AM
Quote from: Andarix on November 04, 2024, 01:03:48 PMI don't know why the activation doesn't work. I removed the icon from the block list.
https://github.com/simutrans/tutorial_pak64/pull/14 (https://github.com/simutrans/tutorial_pak64/pull/14)

I tried to fix that, if it doesn't work please let me know.
https://github.com/simutrans/tutorial_pak64/commit/e3a219483e3ff1d58111c6169b06012b4eb373c8
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 07, 2024, 11:54:55 AM
class_chapter_07.nut

line 18 define
  t_allowed_list = [
            tool_build_way, tool_build_station, tool_build_depot, tool_build_wayobj, tool_build_roadsign, 4108,
            tool_remove_way, tool_remove_wayobj, tool_make_stop_public, tool_stop_mover, tool_merge_stop, 4103
          ]


This should be controlled via the class_basic_gui.nut.
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on November 07, 2024, 02:33:46 PM
Quote from: Andarix on November 07, 2024, 11:54:55 AMclass_chapter_07.nut
line 18 define
  t_allowed_list = [
            tool_build_way, tool_build_station, tool_build_depot, tool_build_wayobj, tool_build_roadsign, 4108,
            tool_remove_way, tool_remove_wayobj, tool_make_stop_public, tool_stop_mover, tool_merge_stop, 4103
          ]

This should be controlled via the class_basic_gui.nut.
That list is for the is_work_allowed_here function, not for the gui.
Title: Re: tool_id = 4099? What tool is this?
Post by: Andarix on November 07, 2024, 03:52:55 PM
4103 = tool_clear_reservation

Permitted tools for a chapter are in chapter_step_enabled_tools( pl ). There is currently nothing there for Chapter 7. If no step is specified, the information there applies to the whole chapter.
Title: Re: tool_id = 4099? What tool is this?
Post by: Yona-TYT on December 13, 2024, 07:51:17 PM
Quote from: Andarix on November 07, 2024, 03:52:55 PM4103 = tool_clear_reservation

Permitted tools for a chapter are in chapter_step_enabled_tools( pl ). There is currently nothing there for Chapter 7. If no step is specified, the information there applies to the whole chapter.
If you are right, I will modify. ;)

Edit.

Chg : https://github.com/simutrans/tutorial_pak64/commit/beef15eb55d7addff56e3afe17da9c19b50cece1