Author Topic: Modular Mod Tool Bar Spaces  (Read 29298 times)

0 Members and 1 Guest are viewing this topic.

Offline Necora

  • Modders
  • Trader
  • *****
  • Posts: 488
Modular Mod Tool Bar Spaces
« on: February 12, 2017, 10:56:23 AM »
Good day everyone,

I was playing around with getting my own space on each sub-tool bar, so that I can break my main mod up and release bits independently, with out worrying about multiple placement issues or spamming up existing tool bars.

I think I discovered something, but I need someone like @kid1293 , @Discrepancy , or @RedKetchup to test it out and confirm.

First, I started a new mod, based on the apiary example. I made a trapper. In the 'MyMods/Trapper folder', I added another folder, 'Game' and a file 'NecoraToolbar.rsc' so it is 'MyMods/Trapper/Game/NecoraToolbar.rsc'. This rsc looked like this...

Quote
- MyMods/Trapper/Game/NecoraToolbar.rsc

Toolbar base
{
   StringTable _stringTable = "Dialog/NecoraTBStringTable.rsc";
   SpriteSheet _spriteSheet = "Dialog/NecoraTBSpriteSheet.rsc";
}

ExternalList resource
{
   External _resources
   [
      "NecoraFood",
      "NecoraHousing"
   ]
}

Toolbar NecoraFood : "base"   
{   
   Toolbar _parent = "Game/Toolbar.rsc:food";
   int _sortPriority = 100;

   String _toolTip = "NecoraFoodTip";   
   String _image = "NecoraFood";
   Action _action = ShowGroup;

   bool _autoHotKey = true;
   Keys _hotKey = Toolbar1;
}

Toolbar NecoraHousing : "base"   
{   
   Toolbar _parent = "Game/Toolbar.rsc:housing";
   int _sortPriority = 100;

   String _toolTip = "NecoraHousingTip";   
   String _image = "NecoraHousing";
   Action _action = ShowGroup;

   bool _autoHotKey = true;
   Keys _hotKey = Toolbar1;
}

You'll see I added a sprite sheet (and associated texture, material etc.) into the 'Trapper/Dialog' folder, along with a string table. The sprite sheet just points to a few 32x32 icons, in this case one, a maple leaf, for each tool bar icon. Same with string table.

Quote
MyMods/Trapper/Dialog/NecoraTBStringTable.rsc

StringTable resource
{
   Entry _strings
   [
      { String _name = "NecoraFoodTip";            String _text = "Necora's Food"; }
      { String _name = "NecoraHousingTip";            String _text = "Necora's Housing"; }
   ]
}

Quote
MyMods/Trapper/Dialog/NecoraTBSpriteSheet.rsc

SpriteSheet resource
{
   String _materialName = "NecoraTBSpriteSheetMaterial.rsc";
   String _imageName = "Build/NecoraTBSpriteSheet.png";
   int _imageWidth = 256;
   int _imageHeight = 256;
   bool _padForFiltering = true;
   
   Sprite _sprites
   [
      { String _name = "NecoraFood";         String _source = "Dialog/MapleLeaf.png"; }
      { String _name = "NecoraHousing";      String _source = "Dialog/MapleLeaf.png"; }
   ]
}

So now, I can add a tool bar icon to each sub menu, one for housing, food, storage, industry etc.

All I need to do, is make sure that these files are in the 'Dialog' and 'Game' folder of every mod I break my big one up into.

For example, I made this trapper, then copied the whole Trapper folder, renamed it AnotherTrapper, and three files within to AnotherTrapper/AnotherTrapper.rsc, AnotherTrapper/AnotherTrapperResources.rsc, and AnotherTrapper/Template/AnotherTrapper.rsc. Everything else was left the same. I built and packaged it up.

I moved both mods, Trapper.pkm and AnotherTrapper.pkm into my Windata in the steam folder, fired it up, enabled both mods, loaded a game, and the results are in the attached picture. As you can see, there is 1 maple leaf icon in the food tool bar, and both trappers are sitting happily side by side within it, despite both being separate mods.

So @RedKetchup you can have an RK menu on either the main tool bar or in different sub tool bars, with all mods into it with no crashes etc.!

Somebody with lots of separate mods please test this!

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 10995
Re: Modular Mod Tool Bar Spaces
« Reply #1 on: February 12, 2017, 12:06:18 PM »
oh i need to test that !!!!!
(after i finished what i am making)
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .

Offline elemental

  • Architect
  • *****
  • Posts: 750
Re: Modular Mod Tool Bar Spaces
« Reply #2 on: February 12, 2017, 01:14:42 PM »
This looks extremely promising.

Offline kid1293

  • Modders
  • Banished Expert
  • *****
  • Posts: 3830
  • Never confuse movement with progress
Re: Modular Mod Tool Bar Spaces
« Reply #3 on: February 12, 2017, 01:19:32 PM »
One (maybe stupid) question -
why in folders 'Game' and 'Dialog' ?
Doesn't 'UI' folder work?

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 10995
Re: Modular Mod Tool Bar Spaces
« Reply #4 on: February 12, 2017, 01:26:03 PM »
i dunno... when i tried that 2 years ago it didnt worked :( so i dunno... maybe i did things wrong ? maybe :P

i can say : YES !!!!! IT WORKS !!!!!!!

Necora.... I <3 YOU !!!!!



1st screenshot : i did my first mod .. .Beach Party 1.0

2nd screenshot : i copied all dialog and game folder to my 2nd mod... Country Little House 2.0


> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 10995
Re: Modular Mod Tool Bar Spaces
« Reply #5 on: February 12, 2017, 01:41:19 PM »
hahahaha so awesome !!!

Finally my OLD Dream came thru !!!


just added a 3rd : ChooChoo 2.0 and a 4th Training Camp 1.0
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .

Offline QueryEverything

  • Advisor
  • Banished Expert
  • *****
  • Posts: 1063
Re: Modular Mod Tool Bar Spaces
« Reply #6 on: February 12, 2017, 01:57:36 PM »
i dunno... when i tried that 2 years ago it didnt worked :( so i dunno... maybe i did things wrong ? maybe :P

i can say : YES !!!!! IT WORKS !!!!!!!

Necora.... I <3 YOU !!!!!



1st screenshot : i did my first mod .. .Beach Party 1.0

2nd screenshot : i copied all dialog and game folder to my 2nd mod... Country Little House 2.0




@RedKetchup looking great!!

I know when I copy & paste code, if it's from the US or the EU into my worksheets it doesn't always work, I normally find it's something as little as an " ' " or " - ` etc, or in one instance it was because I was trying to get a long " - " to work instead of the normal " - ".  It may have been that Luke sent you the code and visually it looked the same as what you were attempting, but the slight difference in characters changed things, and crashed them.
It happens a lot in VBA & MySQL when you grab code snippets from somewhere.  Oh, the hours I've wasted ...  hahahaha
~ QE, I query because I like learning new things. 

Banished pinterest & Banished mod ideas
(Gently) Please: if you download mods please rate them, this helps & encourages the modders. :)

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 10995
Re: Modular Mod Tool Bar Spaces
« Reply #7 on: February 12, 2017, 02:16:42 PM »
@QueryEverything  : i have no idea.... last hour was super fast testing ... all my code was already made... i ve just to got to "cut" "paste" everything like necora told me and it worked ! before it didnt  :'(


even Medieval Town gone on my RK toolbar ^^


that mean : REDO EVERYTHING i did since 2 years LOL and put EVERYTHING on my own toolbar lol
that mean also i can now do a NMT Series ! (split everything in NMT and release them in little seperated modules haha)

i will have alot of work for 1-2 weeks lol
i need to prepare ALL my mods for it but i wont release that before 1.0.7 in case i need to redo things again with next patch changes ^^
« Last Edit: February 12, 2017, 02:20:40 PM by RedKetchup »
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .

Offline brads3

  • Banished Expert
  • *****
  • Posts: 4408
Re: Modular Mod Tool Bar Spaces
« Reply #8 on: February 12, 2017, 02:39:59 PM »
super awesome!!!!!!!!!!!

Offline elemental

  • Architect
  • *****
  • Posts: 750
Re: Modular Mod Tool Bar Spaces
« Reply #9 on: February 12, 2017, 03:19:16 PM »
So does this mean it's possible to have one button on the main toolbar ("themed sets" or "modder's menu" or something like that) that any modder can place a mod under? So all the big mods can then go under that one toolbar button instead of having all of them sitting on the main toolbar? By this I mean we would have one Mods button, you press that and then you get RK button, DSSV button, Kid button, Necora button, plus more. Nice and neat and organised.

Would anyone else like to see mods arranged like that? It would really clean things up and keep that main toolbar much shorter and neater.

Offline QueryEverything

  • Advisor
  • Banished Expert
  • *****
  • Posts: 1063
Re: Modular Mod Tool Bar Spaces
« Reply #10 on: February 12, 2017, 04:30:18 PM »
So does this mean it's possible to have one button on the main toolbar ("themed sets" or "modder's menu" or something like that) that any modder can place a mod under? So all the big mods can then go under that one toolbar button instead of having all of them sitting on the main toolbar? By this I mean we would have one Mods button, you press that and then you get RK button, DSSV button, Kid button, Necora button, plus more. Nice and neat and organised.

Would anyone else like to see mods arranged like that? It would really clean things up and keep that main toolbar much shorter and neater.

Not a bad idea, having a "Mods" button / toolbar.  That way for some oldies like me, who our memories are little whackaddoooo  haha :)  we know we need to go "there" for mods, and it keeps the vanilla in tact.
Look, it made sense at the time I was starting this comment ...  then I realised the stupidity.

Run along, mumma's had a long morning ....
~ QE, I query because I like learning new things. 

Banished pinterest & Banished mod ideas
(Gently) Please: if you download mods please rate them, this helps & encourages the modders. :)

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 10995
Re: Modular Mod Tool Bar Spaces
« Reply #11 on: February 12, 2017, 04:36:12 PM »
personally, i would be OK with a MOD icon where everyone has an icon toolbar siting on it.
and everyone inside their icon they would put ALL their mods :)
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .

Offline Necora

  • Modders
  • Trader
  • *****
  • Posts: 488
Re: Modular Mod Tool Bar Spaces
« Reply #12 on: February 12, 2017, 05:19:55 PM »
One (maybe stupid) question -
why in folders 'Game' and 'Dialog' ?
Doesn't 'UI' folder work?

I have no idea, I guess these are constant between all mods? Where as your UI is specific to that mod? I simply just copied the exact same lay out that the Resource/Game/Toolbar.rsc uses, which is what we refer to when we want to put something into the food toolbar for example.

I have no idea if the location of this NecoraToolBar.rsc or RKToolBar.rsc makes any difference.

Here was my thinking about it. I figured, if we want to put a mod into the food tool bar, in the MyMods/Trapper/Trapper.rsc file we list our tool bar, which refers to the parent tool bar which is 'food' in the Resoure/Game/Toolbar.rsc. So I figured, why can't we do that with mods? Refer all individual mods to one master tool bar file? So I simply copied the Resource/Game/Toolbar.rsc, removed everything and added my own tool bar slots in the same manner, then placed this into a Trapper/Game folder. This NecoraToolbar.rsc refers back to the Toolbar.rsc in Game/Resource to read for the 'food' or 'housing' toolbars etc. I guess you could just edit the original Toolbar.rsc, keep it the same name, and move it to your own Game folder in the mod so it gets incorporated. I custom named it as I figure then everyone can do the same and there will be no conflicts between mods.

I think if you try to make the communal tool bar in the MyMods/Trapper/Trapper.rsc file, then each mod will try to make it new and it will result in crash errors or nothing in the tool bar. But if you make them all refer to the exact same CustomToolbar.rsc then they will all build the exact same thing? I'm not sure but I think this is why. I don't think it has to be in the game folder, I think it just has to refer to a CustomToolbar.rsc which is identical in all mods using this, in the same way that we refer to the Toolbar.rsc in the Game folder of the Resource folder. I used Game because that is where it is in the original resource with mod kit, same as why I used dialog.

I think the important thing is keeping these toolbar and spritesheet/stringtable files the exact same in different mods, so it needs updating for all with new instances or it needs some fore planning form the modder.

personally, i would be OK with a MOD icon where everyone has an icon toolbar siting on it.
and everyone inside their icon they would put ALL their mods :)

I agree, I would be OK with that. I guess that is the next thing to try. I did try to package this up as a dependency, but couldn't get my Trapper/Trapper.rsc file to read a Toolbar.pkm in the windata folder of the modkit, so not sure if it is possible to make a dependancy.

What we would have to do, is put together a 'ModdersToolbar.rsc' which makes the 'Modders' icon on the main toolbar. Then, each modder makes their own 'CustomToolbar.rsc' which refer in the parent toolbar line of each of our icons refers to the 'ModdersToolbar.rsc:Modders' in the same way that my 'NecoraToolbar.rsc' refers to the 'Resource/Game/Toolbar.rsc'.

Offline Necora

  • Modders
  • Trader
  • *****
  • Posts: 488
Re: Modular Mod Tool Bar Spaces
« Reply #13 on: February 12, 2017, 05:54:47 PM »
@RedKetchup I don't have enough individual mods to try this, but I made .rsc for a custom toolbar.

Could you do me a favour and test it?

Put the CommonToolbar.rsc into the Game folder, and the sprite and string stuff into the Dialog folder of each mod.

Then for one mod, use the RKToolbar.rsc referring to this CommonToolbar.rsc as the space on the main menu.

Then in another mod do the same, but instead of using RKToolbar.rsc make up another one like NecoraToolbar.rsc.

See if you can package up the two mods and see if they both sit in the new Common Toolbar space on the main menu.

Game/CommonToolbar.rsc
Quote
Toolbar base
{
   StringTable _stringTable = "Dialog/CommonToolbarStringTable.rsc";
   SpriteSheet _spriteSheet = "Dialog/CommonToolbarSpriteSheet.rsc";
}

ExternalList resource
{
   External _resources
   [
      "CommonToolbar"
   ]
}

Toolbar CommonToolbar
{
   int _sortPriority = 250;
   SpriteSheet _spriteSheet = "Dialog/CommonToolbarSpriteSheet.rsc";
   String _image = "CommonToolbar";
   StringTable _stringTable = "Dialog/CommonToolbarStringTable.rsc";
   String _toolTip = "CommonToolbarTip";
   Action _action = ShowGroup;
}

Dialog/CommonToolbarSpriteSheet.rsc
Quote
SpriteSheet resource
{
   String _materialName = "CommonToolbarSpriteSheetMaterial.rsc";
   String _imageName = "Build/CommonToolbarSpriteSheet.png";
   int _imageWidth = 256;
   int _imageHeight = 256;
   bool _padForFiltering = true;
   
   Sprite _sprites
   [
      { String _name = "CommonToolbar";      String _source = "Dialog/CommonToolbar.png"; }
   ]
}

Dialog/CommonToolbarSpriteSheetMaterial.rsc
Quote
MaterialInstance resource
{
   Material _material = "Material\UI\uiMaterial.rsc";
   Texture _textures
   [
      {
         String _name = "diffuse";
         ImageBuffer _texture = "Dialog/CommonToolbarSpriteSheetTexture.rsc";
      }
   ]
}
Dialog/CommonToolbarSpriteSheetTexture.rsc
Quote
ImageBuffer resource : "Texture/UITexture.rsc"
{
   String _imageName = "Build/CommonToolbarSpriteSheet.png";
}
Dialog/CommonToolbarStringTable.rsc
Quote
StringTable resource
{
   Entry _strings
   [
      { String _name = "CommonToolbarTip";            String _text = "Mod Collections"; }
   ]
}

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 10995
Re: Modular Mod Tool Bar Spaces
« Reply #14 on: February 12, 2017, 06:26:28 PM »
i ll be able to check that in an hour or so
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .