Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95a is out! (03/26/21); Blog post: Skill Changes, Part 2 (07/15/21)

Pages: [1] 2 3 4

Author Topic: [0.95a] SafariJohn's Rules Tool (v2.3.0)  (Read 16651 times)

SafariJohn

  • Admiral
  • *****
  • Posts: 2061
    • View Profile
[0.95a] SafariJohn's Rules Tool (v2.3.0)
« on: November 20, 2018, 07:48:05 PM »

SafariJohn's Rules Tool
version 2.3.0
Download
Source Code

Ever took a glance in rules.csv and NOPED right back out? Well no more! With this tool you can easily view, create, and edit rules to your heart's content. Consult the readme's Getting Started section if you have any trouble figuring things out.

Please report any bugs you find either here or on the Unofficial Starsector Discord (mention me @SafariJohn#5061).

This program does not officially support Mac. However, it should work correctly if run from the command line - see the readme's Installation section.

Spoiler
[close]

What people have said about SRT:
Okay so I already can't work on rules without this tool, so thanks for that! -Tartiflette

This is really good. rules.csv is a real pain to navigate using normal spreadsheet editors and I look forward to being able to work with it using a more user-friendly tool. -Inventor Raccoon

When Rules were introduced, I remember having to code around that.
This is a big improvement, merely being able to parse through Rules without too much mess and being able to see the relationships clearly.
-xenoargh

Great work, very intuitive.
Able to refactor and reorganise very quickly, maybe won't be chugging milk through my nostrils before 40.
-Armithaig

HOLY ***
never letting John's editor go, ever
I just saw my whole modding life improving drastically
-joaonunes


Changelog:
Version 2.3.0
 New Stuff:
 - Vanilla rules updated to 0.95a!
 - Added Command support!
   - Let's you define the inputs to your commands so you don't have to try to remember them.
 - Automatically detected triggers and variables are now discarded when you save if they are unused.
 - Increased refresh speed for rules tree and data tabs.
 
 Changes:
 - The shortcut for Close Ruleset is now Ctrl-W.
 - Hopefully clarified the error message when rules.csv file has the wrong number of columns.
 
 Bug Fixes:
 - Massively reduced RAM usage:
   - Patched a memory leak in the spellchecker.
   - Optimized VM options.
 - Fixed freezes when selecting a text field.
 - Replaced error logging when logger failed to initialize (lol) with error popup.
 - Fixed OutOfBounds error when replacing multiple search results with a smaller string.
 - Fixed overwrite prompt appearing every time you saved.
 - Fixed copying rules with drag and drop not updating id overlap highlights.
 - Fixed searching so it detects slightly offset repeating patterns.

Spoiler
Version 2.2.0
 New Stuff:
 - Changed the new rule and new directory buttons to work by a single click (and they are now keyboad-friendly). The new rule/directory is added to the active directory or the directory of the active rule.
 - SRT's icon now shows up in the task bar, etc. instead of Java's icon.
 - Ruleset root directories now show the expand/collapse icon.
 
 Bug Fixes:
 - Reduced RAM usage.
 - Fixed bug with backing up directories that could invalidate the tree structure.
 - Fixed bug with Ctrl-Z when only the rules tree had been modified.
 - Fixed bug that prevented clearing fields in the Summary tab.
 - Fixed text replacement only working for the script field.
 - Fixed text replace garbling when replacement was longer than original.
 - Fixed tree selection changing from a directory to its parent under certain circumstances when collapsing it with the arrow keys.
 - Fixed bugs when loading CSVs while Safe Mode is enabled.
 - Fixed overwrite dialog appearing on every startup in certain cases.
 - Fixed bug when overwriting a loaded ruleset.
 - Reduced slowdown when rapidly changing the tree selection or expanding/collapsing folders.
 - Fixed freezing when typing into text fields, such as holding down a key.
 - Fixed a silent crash; the spellchecker library was compiled in Java 8 instead of 7.


Version 2.1.1
 Bug Fixes:
 - Fixed a save bug with newlines inside quotation marks.


Version 2.1.0
 New Stuff:
 - Added logging.
 
 Bug Fixes:
 - Fixed a minor settings failure when the active spellchecking language's dictionary can't be found.
 - Fixed rulesets duplicating vanilla triggers/commands/variables.

 
Version 2.0.1
 Bug Fixes:
 - Fixed trigger/command/variable duplication on load.
 - Fixed silent failure when trying to open a SRT-generated rules.csv file without a corresponding rulesets/NAME.json file.


Version 2.0.0
 New Stuff:
 - Simplified loading/saving. SRT now saves your changes directly to your rules.csv!
   - Use the Convert option in the File menu to convert your pre-2.0 data.
 - Added find & replace!
 - Added spellchecking!
 - You can now edit the included vanilla rules.
 - Editing has been enabled on the Summary tab.
 - Added Safe Mode, which protects your original rules.csv from in-progress changes.
 - Lowered minimum supported resolution from 1024x768 to 800x600.
 - Selecting a rule to edit is once again a single click.
 - SRT-generated CSV files now have #END lines marking the end of folders.
 
 Bug Fixes:
 - Added a confirmation dialog if you try to save a ruleset with the same name as another.
 - Fixed a save bug when a folder has a comma in its name.
 - The rules tree now focuses on the selected rule when changed from elsewhere.
 - Old files left when a ruleset is renamed are now cleaned up automatically.


Version 1.1.0
 New Stuff:
 - Updated vanilla rules to 0.9.1a.
 - The enter key can now be used in the rules tree to select a rule/folder for editing.
 
 Bug Fixes:
 - Copy/Paste now works in Dialog Options text box.
 - Collapsing a rules tree folder that contains the active rule/folder using the arrow keys sets it as the active rule/folder.
 - Fixed an infinite loop when trying to save to a non-existent directory.
 
 
Version 1.0.1
 New Stuff:
 - Can now cancel when exiting the program or closing a rule set.
 
 Bug Fixes:
 - Undo/Redo now works for the root folder of rule sets.
 - Now remembers a rule set between sessions if you change its name but don't save the change.
 - The Exit button in the File menu now exits correctly.


Version 1.0.0
 New Stuff:
 - To change which rule you are editing, you must now double-click the rule you want to edit.
 - Forcing/Blocking linked rules can now be done from the main interface. Drag rules from the rules tree to force them; select rules on the right and hit delete to block them.
 - Minor improvements to linked rules detection.
 - Close [Rule Set] menu button now has a shortcut: ctrl-b.

 Bug Fixes:
 - Fixed potential bug in trigger/command/variable drag-and-drop code.
 - Fixed typo - triggers now load correctly.
 - Moved vanilla "Remnant battlestation", "SALVAGE", and "CARGO PODS" folders out of "Smuggling investigation inspector" folder.
 - Double clicking a linked rule now changes the selection in the rules tree, as you would expect.


Version 0.3.0
 New Stuff:
 - Now officially supports Linux!

 Bug Fixes:
 - Opening rule sets in Linux now properly respects file order. (Thanks, Armithaig!)
 - Opening/saving/importing/exporting consistently use UTF-8 now. For example, Chinese will work correctly.


Version 0.2.0
 - Initial release for 0.9a.
[close]
« Last Edit: June 01, 2021, 06:17:13 PM by SafariJohn »
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 2061
    • View Profile
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #1 on: November 20, 2018, 07:48:18 PM »

If anyone is familiar with distributing Java programs like this to Mac and/or Linux, could you please give me some pointers? I only have Windows, which makes it difficult to figure out.
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 393
    • View Profile
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #2 on: November 21, 2018, 02:22:02 PM »

This is really good. rules.csv is a real pain to navigate using normal spreadsheet editors and I look forward to being able to work with it using a more user-friendly tool.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 1876
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #3 on: November 22, 2018, 11:57:37 AM »

Thank you for this!

I am going to try this out tonight but it will make my life a lot easier :)

I use Rules very heavily in my TC.

Question: does it support bulk rule creation/cloning of similar type? (So I can clone a bunch of rules and then add single parameter checks for things like reputation, personality or faction)

It would be beyond helpful if it could scope into a library of accepted commands too. I usually have to reverse-engineer existing rules and carefully examine local memory dumps to create the in-game behaviors I need to.


For instance: Getting fleets to back down universally in every situation is a real pain. A lot of entity behaviors override the nonHostile boolean so you have to explicitly disable every single one for my ceaseFire script. I still haven't run into them all, I'm sure. The only way to catch it is to have the script fail, then check the memory to find out why when I recreate it. :P
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 362
  • Dancing like a boss.
    • View Profile
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #4 on: November 22, 2018, 06:51:58 PM »

Can it just edit the existing file? It's somewhat troublesome to import and export.
And, the editor seems not support Chinese characters well(some become ??), can it be fixed?
Logged
My mods


SafariJohn

  • Admiral
  • *****
  • Posts: 2061
    • View Profile
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #5 on: November 23, 2018, 06:31:52 AM »

Question: does it support bulk rule creation/cloning of similar type? (So I can clone a bunch of rules and then add single parameter checks for things like reputation, personality or faction)

You can copy rules by holding control when you drag and drop them on the left side. I probably can't fit more advanced manipulations into the UI, but the rules are stored as a hierarchy of .jsons in the "rules" folder so you can use a batch file or whatever you like there.

It would be beyond helpful if it could scope into a library of accepted commands too. I usually have to reverse-engineer existing rules and carefully examine local memory dumps to create the in-game behaviors I need to.

For instance: Getting fleets to back down universally in every situation is a real pain. A lot of entity behaviors override the nonHostile boolean so you have to explicitly disable every single one for my ceaseFire script. I still haven't run into them all, I'm sure. The only way to catch it is to have the script fail, then check the memory to find out why when I recreate it. :P

I'm not sure what you're asking for here.


Can it just edit the existing file? It's somewhat troublesome to import and export.

Exporting is exactly like direct-edit saving would be, and you should only have to import once per mod. What exactly is causing you trouble?

And, the editor seems not support Chinese characters well(some become ??), can it be fixed?

I think it can be fixed, but I'm not sure. I will look into it.
Logged

MShadowy

  • Admiral
  • *****
  • Posts: 902
    • View Profile
    • Email
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #6 on: November 24, 2018, 10:55:26 AM »

A, this is neat. B, holy crap this is slow as hell. The program starts to lag real fast. Still very handy, but only usable over short periods. Maybe it's a linux/open jdk thing.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 2061
    • View Profile
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #7 on: November 24, 2018, 11:21:11 AM »

A, this is neat. B, holy crap this is slow as hell. The program starts to lag real fast. Still very handy, but only usable over short periods. Maybe it's a linux/open jdk thing.

Weird, it should run pretty lightly. I take it it's eating up memory? Hopefully it's just a memory leak I can run down and not, as you say, a "linux/open jdk thing".
Logged

MShadowy

  • Admiral
  • *****
  • Posts: 902
    • View Profile
    • Email
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #8 on: November 24, 2018, 11:58:04 AM »

According the process log, it's only using about 244 MiB, so it is pretty lightweight.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 2061
    • View Profile
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #9 on: November 24, 2018, 06:05:10 PM »

According the process log, it's only using about 244 MiB, so it is pretty lightweight.

That memory usage is 50% higher than I can max it out at on Windows while having vanilla loaded twice + some mods' rules sets. (No sign of a memory leak, thank goodness.)

I suspect the JDK may be your problem. I've seen a lot of advice that says don't run programs with a JDK. Please try running it with a JRE and see if you still have slowdown.
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3293
  • Toss a coin to your Modder, O' valley of plenty
    • View Profile
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #10 on: November 25, 2018, 04:00:34 AM »

Okay so I already can't work on rules without this tool, so thanks for that! But I may have a pair of requests:
Would it be possible to copy whole sections of rules from vanilla (or mods) to another mod? Like the whole default "getting a faction commision" section of vanilla.

Can we have a "reload" button to get edits to the rules.csv done by hand? For example after copy-pasting the mentioned rules from vanilla I have to close the rules AND delete the whole folder from your tool then reload it to get the changes. Not really practical.
« Last Edit: November 25, 2018, 04:08:57 AM by Tartiflette »
Logged
 

SafariJohn

  • Admiral
  • *****
  • Posts: 2061
    • View Profile
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #11 on: November 25, 2018, 09:28:50 AM »

Okay so I already can't work on rules without this tool, so thanks for that!

That's high praise, thank you.

Would it be possible to copy whole sections of rules from vanilla (or mods) to another mod? Like the whole default "getting a faction commision" section of vanilla.

Select all the rules/folders you want on the left (can include vanilla rules), pick them up, and hold control when you drop them (the mouse will show a little + sign). It will copy them to the given spot.

Can we have a "reload" button to get edits to the rules.csv done by hand? For example after copy-pasting the mentioned rules from vanilla I have to close the rules AND delete the whole folder from your tool then reload it to get the changes. Not really practical.

I thought about doing that and decided not to, but I'll reconsider. Hopefully you don't need it now, given the above answer.
Logged

Armithaig

  • Lieutenant
  • **
  • Posts: 54
    • View Profile
    • Amaranth
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #12 on: November 27, 2018, 10:32:21 AM »

Great work, very intuitive.
Able to refactor and reorganise very quickly, maybe won't be chugging milk through my nostrils before 40.

However, does not seem to preserve order of files when reloading. Screenshot.
This is for every file, not just the top directory. Little heartbreak after happily shuffling my rules in order.

Linux specific issue perhaps, someone else can confirm.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 2061
    • View Profile
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #13 on: November 27, 2018, 10:50:11 AM »

I'm sorry you're having some trouble. To be sure: did you manually save after reordering your rules? If you didn't it should have asked you if you wanted to save when you exited; did you make sure your rule set was checked and that you clicked Save and Exit?

SRT clearly has write permission on your system, so that's not the problem. It should have given you an error message if it failed to overwrite/delete files; you didn't see anything like that?


Worst case: you can reorder the folders and files manually until I figure out what is causing the problem and release a fixed version.


Edit: Not related to the above I think, just curiosity, are you using WINE or running SRT natively on Linux?
« Last Edit: November 27, 2018, 10:55:48 AM by SafariJohn »
Logged

Armithaig

  • Lieutenant
  • **
  • Posts: 54
    • View Profile
    • Amaranth
Re: [0.9a] SafariJohn's Rules Tool (v0.2.0)
« Reply #14 on: November 27, 2018, 11:27:48 AM »

Added to openFolder(), openFolderRecursive().
Code
files.addAll(Arrays.asList(rootDirectory.listFiles()));
Collections.sort(files); // Sort file collection.

Do not believe listFiles() guarantees any order so have to be sorted somehow, handling files is always weird between OS', Windows gave you in order I suppose.
Works now.

Running it natively, just added SRT.sh with this to folder.
Code
java -jar ./bin/SRT.jar

But really doesn't save much typing.
Logged
Pages: [1] 2 3 4