Page 1 of 3

Categories

Posted: 08 Sep 2017, 12:33
by Lobby
Since version 337 you're able to define your own categories. Here you can see what that means:
Inked2017-09-08 12.06.06_LI.jpg
Let's say we have the following plugin:

Code: Select all

[
  {
    "id":"$lobby_camp_dummy00",
    "type":"park",
    "title":"Plain area",
    "text":"Just a plain area.",
    "width":1,
    "height":1,
    "frames":[{"bmp":"dummy.png"}]
  }
]
dummy.png
dummy.png (543 Bytes) Viewed 21143 times
As it's a building of type park it will be put into the park category automatically. We want to put it into an own camping category.

So let's define a new category for camping:

Code: Select all

  {
    "id":"$cat_lobby_camp00",
    "type":"category",
    "title":"Camping",
    "frames":[{"bmp":"icon.png"}],
    "ordinal":10
  }
As icon I use this 26x26 pixel sized image:
icon.png
icon.png (488 Bytes) Viewed 21143 times
I recommend to always use a size of 26x26 pixels for icons for consistency. In order to put our plugin into this category we have to specify the category manually:

Code: Select all

  {
    "id":"$lobby_camp_dummy00",
    "type":"park",
    "category":"$cat_lobby_camp00",    // This way we define the category to put this park into
    "title":"Plain area",
    "text":"Just a plain area.",
    "width":1,
    "height":1,
    "frames":[{"bmp":"dummy.png"}]
  }
Pay attention on that the category you're referring to has to be defined before your plugin. Otherwise it cannot be assigned. The result looks now like this:The result:
2017-09-08 12.06.55.png
Now you may want to put your category to a more meaningful position: behind the existing park category. To do so, we can use the attribute ordinal which can be also used to order items within a category:

Code: Select all

  {
    "id":"$cat_lobby_camp00",
    "type":"category",
    "title":"Camping",
    "frames":[{"bmp":"icon.png"}],
    "ordinal":10    // Specify own position (after park, in this case)
  }
The number you provide for ordinal determines which position should be used, with 0 being the first place. The result:
2017-09-08 12.07.51.png
Last but not least we may want to use another preview for our cool plank area. To do so, we can provide a preview frame like this in our plugin:

Code: Select all

  {
    "id":"$lobby_camp_dummy00",
    "type":"park",
    "category":"$cat_lobby_camp00",
    "title":"Plain area",
    "text":"Just a plain area.",
    "width":1,
    "height":1,
    "frames":[{"bmp":"dummy.png"}],
    "preview frames":[{"bmp":"icon.png"}]   // A single frames to use for preview
  }
Result:
2017-09-08 12.20.58.png
The whole code in a single file looks like this:

Code: Select all

[
  {
    "id":"$cat_lobby_camp00",
    "type":"category",
    "title":"Camping",
    "frames":[{"bmp":"icon.png"}],
    "ordinal":10
  },
  {
    "id":"$lobby_camp_dummy00",
    "type":"park",
    "category":"$cat_lobby_camp00",
    "title":"Plain area",
    "text":"Just a plain area.",
    "width":1,
    "height":1,
    "frames":[{"bmp":"dummy.png"}],
    "preview frames":[{"bmp":"icon.png"}]
  }
]
You can use the code:

Code: Select all

"separator": true
to put a line that separates parts of a category

Have fun :space

Re: Categories

Posted: 08 Sep 2017, 12:38
by Josh
WoW :D

Re: Categories

Posted: 08 Sep 2017, 12:57
by actemendes
It's unbelievable

Re: Categories

Posted: 08 Sep 2017, 13:01
by Bearbear76
Well done !

Re: Categories

Posted: 08 Sep 2017, 14:37
by KINGTUT10101
Can you put two different plug-ins in a custom catagory or will it cause problems?

Re: Categories

Posted: 08 Sep 2017, 14:42
by CommanderABab
I believe so, after all the military road is still a road, but doesn't appear in the transport menu.

Re: Categories

Posted: 08 Sep 2017, 14:57
by Lobby
Yes, you can mix them in any way you like to. That's also how other items are organized internally. In case you want to put a plugin into another native category here are the ids:

$cat_terrain00
$cat_road00
$cat_zone00
$cat_residential00
$cat_commercial00
$cat_industrial00
$cat_energy00
$cat_water00
$cat_park00
$cat_sport00
$cat_public00
$cat_education00
$cat_religion00
$cat_award00
$cat_firebrigade00
$cat_police00
$cat_medic00
$cat_military00
$cat_decoration00
$cat_disaster00

Re: Categories

Posted: 08 Sep 2017, 15:14
by Josh
After making the camping category, it puts the caravans & tents in the camping category and the residential category

Re: Categories

Posted: 08 Sep 2017, 15:19
by Lobby
RCI buildings are handled in a special way. Might be changed in the future. After all, you can put them into a category.

Re: Categories

Posted: 08 Sep 2017, 15:27
by Josh
You can use the code:

Code: Select all

"separator": true
to put a line that separates parts of a category

Re: Categories

Posted: 08 Sep 2017, 16:52
by CommanderABab
Got one made! :)Image


Image

Re: Categories

Posted: 24 Sep 2017, 00:48
by mdk_813
I have a question about this:
In the example above, the category is defined at the beginning of the plugin-json, before the definition of the plugin itself. That is fine, if you have one plugin, for which you want to make a special category.
But, I would like to make a category that incorporates a number of different plugins.
Is it possible to define once and for all a category in one separate json-file, so that I just have to set the category in the jsons of all future plugins? Or would I have to define the category everytime at the start of each single plugin all over again?

edit: I deleted some stuff that I discovered was incorrect. nevermind.

Re: Categories

Posted: 24 Sep 2017, 11:44
by Lobby
It's not important where a category is defined as long as it's read in before plugins start using it. Maybe create a new directory for the category and name it so that it's read in at first in any case.

These plugins define only categories, for example:
Plugin storage
More categories (no longer available)

Re: Categories

Posted: 19 Jul 2018, 18:30
by sairam
There are some categories left.

Code: Select all

 $cat_terrain00
  $cat_asphalt00

$cat_transport00
  $cat_road00
  $cat_roaddeco00
  $cat_bus00
  $cat_train00
  $cat_airport00
    
$cat_zone00
  $cat_residential00
  $cat_commercial00
  $cat_industrial00
    
$cat_supply00
  $cat_energy00
  $cat_water00
  $cat_wastedisposal00
  $cat_bodydisposal00

$cat_public00
  $cat_park00
  $cat_sport00
  $cat_public00
  $cat_management00
  $cat_award00
  $cat_religion00
  $cat_decoration00
  $category_christmas00
  $category_firework00

$cat_service00
  $cat_firebrigade00
  $cat_education00
  $cat_medic00
  $cat_police00
  $cat_military00

$cat_landmark00

$cat_disaster00 

Re: Categories

Posted: 08 Aug 2018, 05:41
by sairam
I have a doubt that the can i place my category next to the RCI categories. I am doing a plugin which is next to RCI categories. So I just asked i used ordinal but doesn't works. Please can any of you one help me.

Re: Categories

Posted: 08 Aug 2018, 13:30
by Bearbear76
sairam wrote: 08 Aug 2018, 05:41 I have a doubt that the can i place my category next to the RCI categories. I am doing a plugin which is next to RCI categories. So I just asked i used ordinal but doesn't works. Please can any of you one help me.
Try something like this

Code: Select all

[{
"id":"ID",
"title":"Text",
"category":"$cat_zone00",
"type":"category",
"ordinal":x,
"frames":[{"bmp":"icon.png"}]
}]

Re: Categories

Posted: 08 Aug 2018, 15:52
by sairam
Not working.

Re: Categories

Posted: 08 Aug 2018, 18:25
by CommanderABab
Try:

Code: Select all

  "ordinal from":"$existing_category_id_00",
    "ordinal":1,
to place your category after it.

Re: Categories

Posted: 09 Aug 2018, 04:18
by sairam
Not working

Code: Select all

 [{"category":"$cat_zone00","frames":[{"bmp":"icon.png"}],"id":"$cat_cat_zone","ordinal from":"$cat_industrial00",
    "ordinal":1,"title":"buildings","type":"category"}]

Re: Categories

Posted: 12 Aug 2018, 04:44
by Bearbear76
Screenshot_2018-08-12-11-42-05.jpg
So if you want to do something like this you would have to write your JSON like the way I wrote above :json

The JSON I used :

Code: Select all

[{
"id":"Cat_typ0",
"ordinal":0,
"type":"category",
"category":"$cat_zone00",
"frames":[{"bmp":"Cat_Icon.png"}],
"title":"Rnd Category"
}]