Jump to content

548 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

@carlosmarcelo Adding icons is possible, but I plan to add this as a separate command that allows you to generate a new menu button that will open a submenu. The idea is to drop a png on the exe, and then the program will ask you what the button id of this item should become, and what the parent button id is (so basically automate this flow).

I'm also brainstorming about the possibility to have the program know about your own custom button ids. For example, have it read an ini file which then loads the button ids and adds them as a human-readable option to the list to choose from. That way you don't have to remember all the custom ids.

  • Like 3
  • Thanks 1

Visit www.growifier.com for ploppable residentials

Love playing hearts and other card games? Have a look at www.whisthub.com!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
15 hours ago, smf_16 said:

and then the program will ask you what the button id of this item should become, and what the parent button id is (so basically automate this flow).

Very interesting. Thanks for doing this to us. *:yes:

Let me see I understood when you say "flow": the app could have a menu option to wizard to create a new submenu?

For example, I drag a file or various files to in sc4.exe; then if a person to choice "new submenu", it starts a wizard asking name, button icon, parent and register in .ini file to futures new includes in this new submenu. :ooh:

  • Like 1

"Nenhum sucesso no mundo compensa o fracasso no lar." - "No other success can compensate for failure in the home."
Como fazer da sua família um time de sucesso! - How to make your family a successful team!
 

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
On 8.11.2024 at 12:08 AM, smf_16 said:

If you're running Linux, then you're better off installing it via npm. You have to install Node.js for this, then fire up a terminal somewhere an type npm i -g sc4@next.  This makes the sc4 command globally available. Just run sc4 then in a terminal and it should start the interactive interface.

Running the sc4 command gives me this result. I'm running Ubuntu 24.01.

 

peter@PC-Peter:~/NAS_Dateien/$Peter/Games/SC4$ sc4
node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: node:sea
    at new NodeError (node:internal/errors:405:5)
    at ModuleLoader.builtinStrategy (node:internal/modules/esm/translators:299:11)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14) {
  code: 'ERR_UNKNOWN_BUILTIN_MODULE'
}

Node.js v18.19.1

 

 

 

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

@Rady that's because you need at least Node 20.16 or 22.3. It doesn't work on Node 18. If you want to manage multiple Node versions easily, I suggest using nvm for Linux. By the way, I'm looking at ways to build a binary for Linux as well, I will post here if I manage to do it.

@carlosmarcelo Well, I would actually make two commands. One where you drag a png onto the exe and the it opens a wizard asking you the id, parent menu id, name and description of the submenu. It will then also ask you if this menu should be remembered.

The existing command where you drag multiple lots onto the exe stays the same, but when it asks where the items should go, it will now list the menu that you created before as an option as well. So, if you later want to add new items to it, just drag them on the exe and then choose that menu again.

I'll probably also add another command that reads in an existing submenu file and then adds it to the list of predefined menus to choose from. That way you can easily "import" submenus that other people have made and add your own items to it, without the need to go look for its id.

  • Like 3

Visit www.growifier.com for ploppable residentials

Love playing hearts and other card games? Have a look at www.whisthub.com!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
5 hours ago, smf_16 said:

@Rady that's because you need at least Node 20.16 or 22.3. It doesn't work on Node 18. If you want to manage multiple Node versions easily, I suggest using nvm for Linux. By the way, I'm looking at ways to build a binary for Linux as well, I will post here if I manage to do it.

Well, I just downloaded nodejs .. I assumed it would be the most recent version. Needed to additionaly install nvm and actively install version 22, now sc4 is running :-)

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

@Rady It could be then that you're running a Linux version that is not supported by Node 20 or up. There might be a way to get the module working on Node 18 as well, but I'd have to look into it.


Visit www.growifier.com for ploppable residentials

Love playing hearts and other card games? Have a look at www.whisthub.com!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
31 minutes ago, smf_16 said:

@Rady It could be then that you're running a Linux version that is not supported by Node 20 or up. There might be a way to get the module working on Node 18 as well, but I'd have to look into it.

I already have version 22 installed, and sc4 ist starting. However I'm encountering this error when trying to create a submenu patch:

 

peter@PC-Peter:~$ sc4
✔ What do you want to do? Create a submenu patch

ERROR Error: ENOENT: no such file or directory, stat '/home/peter/.steampath'
    at Object.statSync (node:fs:1658:25)
    at file:///usr/local/lib/node_modules/sc4/node_modules/inquirer-file-selector/dist/index.js:1:643
    at Array.map (<anonymous>)
    at M (file:///usr/local/lib/node_modules/sc4/node_modules/inquirer-file-selector/dist/index.js:1:613)
    at file:///usr/local/lib/node_modules/sc4/node_modules/inquirer-file-selector/dist/index.js:1:1656
    at file:///usr/local/lib/node_modules/sc4/node_modules/@inquirer/core/dist/esm/lib/use-memo.js:8:27
    at withPointer (file:///usr/local/lib/node_modules/sc4/node_modules/@inquirer/core/dist/esm/lib/hook-engine.js:71:25)
    at useMemo (file:///usr/local/lib/node_modules/sc4/node_modules/@inquirer/core/dist/esm/lib/use-memo.js:3:12)
    at file:///usr/local/lib/node_modules/sc4/node_modules/inquirer-file-selector/dist/index.js:1:1643
    at file:///usr/local/lib/node_modules/sc4/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js:54:38 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: '/home/peter/.steampath'
}

 

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Can you try running the command again, but in a different working directory? I suggest running it in a folder you created somewhere. It seems like the file selector wants to open `/home/peter/.steampath`, but it likes like that's not a real directory.


Visit www.growifier.com for ploppable residentials

Love playing hearts and other card games? Have a look at www.whisthub.com!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

For those running Linux: I've released a Linux binary as well here. I don't have the ability to test this myself, so it's not guaranteed to work.

  • Like 2

Visit www.growifier.com for ploppable residentials

Love playing hearts and other card games? Have a look at www.whisthub.com!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
3 hours ago, smf_16 said:

Can you try running the command again, but in a different working directory? I suggest running it in a folder you created somewhere. It seems like the file selector wants to open `/home/peter/.steampath`, but it likes like that's not a real directory.

I changed to the plugins directory, and finally, it is working - yeah!!

 

I however do have one more question: I have al lot of ploppable buildings that are not contained in a dat file, but consist of files of the type SC4model, SC4lot, SC4Desc. These are not included in the exemplar patch. Is there a way to also get them included?

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

They normally should be included as well. Can you verify the output when you run the tool? It shows you a log of what files were scanned and what lots from those files were used.


Visit www.growifier.com for ploppable residentials

Love playing hearts and other card games? Have a look at www.whisthub.com!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

If I'm not mistaken, it's actually the .sc4desc file that contains the building exemplar, not the .sc4lot. My tool just reads those too in case someone has stored the building exemplar there. Also make sure that you have the latest version (npm install sc4@next) because there was a bug with the tool sometimes not recognizing a file as a building exemplar because it doesn't read parent cohorts.


Visit www.growifier.com for ploppable residentials

Love playing hearts and other card games? Have a look at www.whisthub.com!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

I started the @next command, but received errors. However I'm pretty sure I have installed the latest version.

 

peter@PC-Peter:~/NAS_Dateien/$Peter/Games/SC4/Plugins by content$ npm install sc4@next
npm error code EEXIST
npm error syscall symlink
npm error path ../glob/dist/esm/bin.mjs
npm error dest /home/peter/NAS_Dateien/$Peter/Games/SC4/Plugins by content/node_modules/.bin/glob
npm error errno -17
npm error EEXIST: file already exists, symlink '../glob/dist/esm/bin.mjs' -> '/home/peter/NAS_Dateien/$Peter/Games/SC4/Plugins by content/node_modules/.bin/glob'
npm error File exists: /home/peter/NAS_Dateien/$Peter/Games/SC4/Plugins by content/node_modules/.bin/glob
npm error Remove the existing file and try again, or run npm
npm error with --force to overwrite files recklessly.
npm error A complete log of this run can be found in: /home/peter/.npm/_logs/2024-11-10T21_03_33_373Z-debug-0.log

 

2024-11-10T21_05_11_674Z-debug-0.log

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Can you try again with npm install -g sc4@next? I forgot to mention the -g flag, which installs the module globally. Otherwise it's installed in the current working directory (Plugins in your case) and looks like this doesn't work with the permissions. I also suggest to delete the node_modules folder from your Plugins, otherwise SimCity 4 will try to load a lot of unnecessary files, which could slow down the startup time.

I also suggest that you try the Linux binary that I released here, that way you (hopefully) don't have to mess around with Node.js anymore.


Visit www.growifier.com for ploppable residentials

Love playing hearts and other card games? Have a look at www.whisthub.com!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Ok, did the @next sucessfully. Downloaded the sc4 linux binary and started it with ./sc4. Result remains the same ("WARNING No lots found to put in a submenu").

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Can you send me all the lots that you're trying to read in a PM? I'll have a look then at why it might not be reading them. Have you verified that the log indicates that the files you want to read are indeed read? Otherwise it's possible that you have not specified them to be read correctly.


Visit www.growifier.com for ploppable residentials

Love playing hearts and other card games? Have a look at www.whisthub.com!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

I can finally call this case closed :-) Thank you very much, now working as intended. This is such a tremendous improvement, thanks for investing your time into that tool.

However, as one moves forward, more questions arise. Regarding additional submenu buttons - is there a list (excel or some sort) of already existing occupant groups? As I understand, personal submenus can be created, but one must not use an existing occupant group.

  • Like 1

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

I've released a new version that adds two additional commands:

  • It's now possible to create a new submenu button. The command will ask you the name, description, item order, parent menu and icon. The parent menu can be selected from the list of standard menus (which has been reworked a little), or you can choose a custom id as parent. Any menu that is created will be remembered for future usage when adding lots to a submenu. You can also drop the png icon to use on the binary so that you don't have to select it.
  • I've added another command that scans your entire plugins folder - well, actually only .dat files - for any non-standard menus, and then stores them in a config file so you can use them when adding lots to a submenu.

These two commands should make creating your own menus a lot easier because you don't have to look up the button ids anymore, you can simply look up the menu in the ui - which now mirrors the structure of the menu in game.

There's one more thing I still plan on doing the coming days, and that's integrating an icon editor somehow. Currently you need to make sure that the icon you use for the submenu is properly formatted according to this icon template which is still a bit annoying to do by hand, so I plan on automating this so that you just have to upload an image, and then the icon template will be applied automatically. I even plan on accepting urls this way as well, which would allow you to just paste the url of your favorite modder's avatar to have it appear in game as a submenu button. I'd say: stay tuned!

@memo while working on this, I've noticed that it's not possible for example to add a custom submenu to the 
RCI residential menu by giving it a parent id of 0x29920899. It only works when adding it to R$ explicitly via parent id 0x93DADFE9. Is this intentional, or am I missing something?

  • Like 6

Visit www.growifier.com for ploppable residentials

Love playing hearts and other card games? Have a look at www.whisthub.com!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
19 hours ago, smf_16 said:

I've released a new version

I downloaded it, but starting gives this:

 

peter@PC-Peter:~/NAS_Dateien/$Peter/Games/SC4/Plugins by content$ ./sc4
node:internal/errors:540
      throw error;
      ^

TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received undefined
    at Object.resolve (node:path:1168:7)
    at dist/sc4.js:218:19369
    at embedderRunCjs (node:internal/main/embedding:87:10) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v22.10.0

 

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

A new day, a new version. As mentioned above, I've reworked the way you can specify an icon for a submenu. It will now open your browser, which allows the icon template to be automatically applied (see the image below). You can also drag & drop an image, or paste an image url (as I've done with mattb's avatar from Simtropolis). If you don't want the standard icon template to be applied, you can also uncheck it. Subsequently press the "Use as icon" button, which will close the browser window again and allow you to continue in the command line interface.

image.png.34261522f5b0cfbdc0468359bb020107.png

In the wake of this, I've also added another action to change an existing menu icon, which uses the same flow. This works for the generated submenus, but also for any other item that appears somewhere in the menu.

With this new addition, I think the program offers most of the tools you need to create some structure in your menus yourself as long as most content hasn't been made compatible. It took me only a few minutes to group aircraft lots per aircraft type, and it is already a massive improvement. Hopefully it helps in making it easier to make existing content submenu-compatible!

 

  • Like 6

Visit www.growifier.com for ploppable residentials

Love playing hearts and other card games? Have a look at www.whisthub.com!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Great addition, one more question: which value should be entered for the "item order"?

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    @smf_16 Your tool looks fantastic. Thanks for creating it. It's going to be very useful.

    On 11/11/2024 at 11:52 PM, smf_16 said:

    @memo while working on this, I've noticed that it's not possible for example to add a custom submenu to the 
    RCI residential menu by giving it a parent id of 0x29920899. It only works when adding it to R$ explicitly via parent id 0x93DADFE9. Is this intentional, or am I missing something?

    There's nothing special about the zoning menu. I've just tested it again, and adding submenus to the top-level zoning menus works the same as for the other menus. The ID is correct as well. Make sure your submenu is not empty though, as it would be hidden otherwise.

    • Like 3

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    On 13.11.2024 at 7:19 PM, smf_16 said:

    It will be set as the Item Order property in Exemplar files, which controls where the item appears in your menu. Higher values appear more towards the bottom of the menu.

    Understood that, but how can I determine the proper value? Like, I want a submenue to show up as the second menu button .. how do I determne the "order number" of the existing menu buttons? Plus, would I need to enter that number in normal number? Hex value?

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    You'd have to find the other values with the reader, looking for the item order property. It's the relative number between the various menu items that matters.

    You can enter the number both in decimal, or in hexadecimal, provided that you prefix your hexadecimal numbers with 0x. In fact, it accepts any valid JavaScript number format, so even binary (e.g. 0b100101011) or octal are possible (e.g. 0o1746) if you want to go crazy for some reason. Hexadecimal is simply convenient in a lot of cases.

    • Like 2

    Visit www.growifier.com for ploppable residentials

    Love playing hearts and other card games? Have a look at www.whisthub.com!

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Was wondering if there is a way to use your program to add lots to patches already created? Currently I have to make the patch, open it in the reader and copy the G/Is then open the original patch and paste them into it.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    No, this is not possible and I would say it is not needed. The way the exemplar patching works makes that it doesn't matter how many patches you have. You can even have one patch per lot.

    My advise is to create individual patches for lots that you always want to group together (for example a modular plaza set). If you do this, moving the set of lots to a different submenu later is easy as you can just delete the patch and create a new one. If you group all items of a submenu in a single patch, then it's going to be difficult to separate them again later on.


    Visit www.growifier.com for ploppable residentials

    Love playing hearts and other card games? Have a look at www.whisthub.com!

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account


    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections