Author Topic: Might And Fealty - Greasemonkey Script  (Read 965 times)

Cipheron

  • Full Member
  • ***
  • Posts: 151
  • Karma: +7/-4
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #15 on: March 22, 2017, 12:47:58 AM »
ok I just uploaded new fixes since bugs crept in with the new stuff. I'll probably be fixing little things for the new week or so as I play. Here's a list of the changes:

- all controls are replicated in the top bar now. The bottom controls get hidden. The top controls have more error checking on them however, so they're safer to use.
- Bury Dead option (caps out at selecting 96 dead soldiers)
- Resupply option (caps out at selecting 96 soldiers)
- changed hunger drop-down to "status". it's a multi-select now, and it checks hunger status and wounded status separately.
- all drop-downs now toggle between "everything" and the top two options:
  - status toggles to "not hungry / not wounded"
  - weapons toggers to axes + spears
  - armor toggers to cloth + leather
  - equipment toggles to shields + javelins.
- put some smarter code in the Apply Orders button:
  - it now scans the form, de-activates anything that shouldn't be active, just in case
  - It also de-activates anything over 96 soldier orders, in case you try and send too many orders
  - it cancels the page load if there is nothing to send. So no more accidentally hitting Apply Orders.

here are some basic things I want to add:

 - status option for knight's offers, e.g. "available" vs "in offer". So you can avoid accidentally picking up knight's offer troops.
 - when you click retrain, it copies the available equipment to the top of the screen near where the retrain options are shown, so you don't have to scroll down.
 - better ways to specify XP, e.g. ranges, presets etc.
 - selection by town of origin.

And here are some more involved ones that could be cool later:

 - reworking the group creation system, one that works the same for either settlements or your army.
 -  e.g. custom names for groups instead of the letters, and custom system for assignment.
 - get the script working on the knight's offer page ! So you can create knight's offers more easily.
 - add some sort of things for the entourage page as well, e.g. tally the total of each type and able to apply orders for multiple ones.
 - while we're at it, perhaps the in-training system could be revamped? It's not very handy if you want to cancel a lot of training orders.
 - characters screen. custom names for groups, hide dead option
« Last Edit: March 22, 2017, 01:20:21 AM by Cipheron »

Cipheron

  • Full Member
  • ***
  • Posts: 151
  • Karma: +7/-4
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #16 on: March 22, 2017, 06:34:42 AM »
Slighty bump - but big improvement. Script now tracks what groups soldiers start in, and when the form is submitted, it aggressively deletes any group selection boxes that weren't actually changed. That accounts for half the variables that are being sent. The script also checks whether the retraining and assign boxes exist but haven't had any selection made, then deletes them too.

The upshot is that you can now easily mobilize 199 soldiers per click instead of 90, and the script ensures that the exact maximum that can be sent is sent, even if you tag too many. As a result, I've now set 200 as the default selection amount.

De-Legro

  • M&F Dev Team
  • Sr. Member
  • *****
  • Posts: 3050
  • Karma: +105/-54
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #17 on: March 22, 2017, 10:46:18 PM »
ok I just uploaded new fixes since bugs crept in with the new stuff. I'll probably be fixing little things for the new week or so as I play. Here's a list of the changes:

- all controls are replicated in the top bar now. The bottom controls get hidden. The top controls have more error checking on them however, so they're safer to use.
- Bury Dead option (caps out at selecting 96 dead soldiers)
- Resupply option (caps out at selecting 96 soldiers)
- changed hunger drop-down to "status". it's a multi-select now, and it checks hunger status and wounded status separately.
- all drop-downs now toggle between "everything" and the top two options:
  - status toggles to "not hungry / not wounded"
  - weapons toggers to axes + spears
  - armor toggers to cloth + leather
  - equipment toggles to shields + javelins.
- put some smarter code in the Apply Orders button:
  - it now scans the form, de-activates anything that shouldn't be active, just in case
  - It also de-activates anything over 96 soldier orders, in case you try and send too many orders
  - it cancels the page load if there is nothing to send. So no more accidentally hitting Apply Orders.

here are some basic things I want to add:

 - status option for knight's offers, e.g. "available" vs "in offer". So you can avoid accidentally picking up knight's offer troops.
 - when you click retrain, it copies the available equipment to the top of the screen near where the retrain options are shown, so you don't have to scroll down.
 - better ways to specify XP, e.g. ranges, presets etc.
 - selection by town of origin.

And here are some more involved ones that could be cool later:

 - reworking the group creation system, one that works the same for either settlements or your army.
 -  e.g. custom names for groups instead of the letters, and custom system for assignment.
 - get the script working on the knight's offer page ! So you can create knight's offers more easily.
 - add some sort of things for the entourage page as well, e.g. tally the total of each type and able to apply orders for multiple ones.
 - while we're at it, perhaps the in-training system could be revamped? It's not very handy if you want to cancel a lot of training orders.
 - characters screen. custom names for groups, hide dead option

Would like to see some details of your thoughts here, since I am working at cleaning up some of these pages for the system at the moment. Just small things like making group selection available on the Knights Offer page
He who was once known as Blackfyre

Cipheron

  • Full Member
  • ***
  • Posts: 151
  • Karma: +7/-4
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #18 on: March 23, 2017, 03:03:34 AM »
Well i don't look at the knight's offer screen that often so I can't really say much specific about it. Once I try and customize the script to also recognize that page I'd have more to say. As you can see most of the remaining things I can think of for the soldier's screen are pretty low priority. I got preset XP ranges last night, including green (0-29), trained (30-99) and veteran (100+), but you still get the greater-than/less than option for fine-tuning.

as a rule of thumb, it would be a good idea to regularize the layout of all troop sections. e.g. the in-training troops could in fact be made part of the main form:

- lay the in-training troops out using the same PHP code used to display the normal troops
- add on a couple of fields for "days left" and "cancel" button
- put them in the same form, separate table
- in their "actions" field, have only "" and "cancel" as the selectable options

With those changes, then in-training troops could be sorted, filtered and batch-ordered in the same ways as normal soldiers without the need for extra systems to deal with it.
« Last Edit: March 23, 2017, 03:19:47 AM by Cipheron »

De-Legro

  • M&F Dev Team
  • Sr. Member
  • *****
  • Posts: 3050
  • Karma: +105/-54
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #19 on: March 23, 2017, 03:17:39 AM »
Well i don't look at the knight's offer screen that often so I can't really say much specific about it. Once I try and customize the script to also recognize that page I'd have more to say. But as a rule of thumb, it would be a good idea to regularize the layout of all troop sections. e.g. the in-training troops could be laid out as a table the same as the non-training troops, but with an extra "days left" field on the end, and a cancel option in their drop-down. You could in fact combine them into a single form, but have a visible separator for the two sections.

As you can see most of the remaining things I can think of for the soldier's screen are pretty low priority. I got preset XP ranges last night, including green (0-29), trained (30-99) and veteran (100+), but you still get the greater-than/less than option for fine-tuning.

As far as control goes, a really nice thing would be a parameter on the page you submit the troop orders to that returns you just the current troop data in a table instead of the action page itself. Then we could do an ajax call from the soldier's page and just rebuild the tables on the client side instead of loading a whole page. It would speed things up and reduce bandwidth.

My long term plan is to reduce the number of pages, generally by consolidating them. Things like militia/training/knights offer are a good example of something that with a bit of thought and layout could be handled on a single page.
He who was once known as Blackfyre

Cipheron

  • Full Member
  • ***
  • Posts: 151
  • Karma: +7/-4
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #20 on: March 23, 2017, 09:52:48 AM »
I think it would be good to shift a few of the things my script is doing over to the main code itself.

A good place to start is my current "submit" code. It deletes all fields that aren't being used (you need to keep track of what groups soldiers started as however in case their groups are changed), also deletes any extra fields once it hits 200, then calls the game's submit code, which does it's own culling. If you replicate the smarts from my script in the game's submit function then we can delete that part of the script and work from there, and all players will benefit.

And probably do something similar for the entourage screen. I'd say these two things are highest priority, because they'll fairly trivial code-wise and would squash the php_vars bugs forever.
« Last Edit: March 23, 2017, 09:56:34 AM by Cipheron »

De-Legro

  • M&F Dev Team
  • Sr. Member
  • *****
  • Posts: 3050
  • Karma: +105/-54
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #21 on: March 23, 2017, 10:13:36 AM »
I think it would be good to shift a few of the things my script is doing over to the main code itself.

A good place to start is my current "submit" code. It deletes all fields that aren't being used (you need to keep track of what groups soldiers started as however in case their groups are changed), also deletes any extra fields once it hits 200, then calls the game's submit code, which does it's own culling. If you replicate the smarts from my script in the game's submit function then we can delete that part of the script and work from there, and all players will benefit.

And probably do something similar for the entourage screen. I'd say these two things are highest priority, because they'll fairly trivial code-wise and would squash the php_vars bugs forever.

There is already a version of the code that accomplishes this using Jquery similar to the preexisting code that removes completely unused rows. I put it together when I patched the entourage page. I am currently testing moving the entire submit to a JSON document. When the server might be updated with the changes though is not something I know.
He who was once known as Blackfyre

Cipheron

  • Full Member
  • ***
  • Posts: 151
  • Karma: +7/-4
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #22 on: March 25, 2017, 06:43:15 AM »
btw updated the script again with a bugfix and improvement:

- the script didn't know about warhorses, that was an oversight of mine, fixed now.
- the script now checks towns and adds them as an alternate filter under groups, so you can filter troops from specific towns and/or groups.
- move the resupply information up to the top since all the controls are now near the top and it's a pain to scroll back and forth past 500 troops.
- EDIT: additional minor fix involving glitch with dead soldiers
 
Good news: I'm kind of running out of possible things to add into the filter now, and because of the multi-select system I didn't have a blowout in the number of selection controls either.
« Last Edit: March 26, 2017, 01:07:33 AM by Cipheron »

Cipheron

  • Full Member
  • ***
  • Posts: 151
  • Karma: +7/-4
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #23 on: March 31, 2017, 07:55:21 AM »
Small addition made for the character's screen. Now there's an option to cull all dead characters from appearing. It's off by default, but you can turn it on by setting:

var cull_dead = true;

Near the top of the script.

Another thing, you can now edit the group names in the character list. This also requires some editing of the script. There is a section at the top that looks like this:

Code: [Select]
var replace_group_headings =
[
//  "Main Characters",            "New Group Name 01",
//  "Secondary Characters",       "New Group Name 02",
//  "Roleplaying Characters",     "New Group Name 03",
//  "Less Important Characters",  "New Group Name 04",
//  "Main Family",                "New Group Name 05",
//  "Secondary Family",           "New Group Name 06",
//  "Other Families",             "New Group Name 07",
//  "Without Family",             "New Group Name 08",
//  "Leaders",                    "New Group Name 09",
//  "Generals",                   "New Group Name 10",
//  "Knights",                    "New Group Name 11",
//  "Diplomats",                  "New Group Name 12",
//  "Spies & Scouts",         "New Group Name 13",
//  "Explorers",                  "New Group Name 14",
//  "Troublemakers",              "New Group Name 15",
//  "Assorted Characters",        "New Group Name 16",

    "" // leave this line here
]

Basically you need to remove the // from the start of the line for the heading you want to change, and change the insides of the corresponding right-hand-side string to be the heading you want. Custom group headings. If you don't edit the script you retain normal headings. Put the // back at the start of any line to disable it.
« Last Edit: March 31, 2017, 08:20:48 AM by Cipheron »

Steele

  • Jr. Member
  • **
  • Posts: 17
  • Karma: +1/-0
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #24 on: June 02, 2017, 06:43:41 AM »
Can you do the same type of thing for entourage?  Managing so many camp followers is tedious.

New Player 123

  • Jr. Member
  • **
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #25 on: August 16, 2017, 06:58:19 PM »
Can't thank you enough for this script. Any chance we can get an Entourage version?

De-Legro

  • M&F Dev Team
  • Sr. Member
  • *****
  • Posts: 3050
  • Karma: +105/-54
    • View Profile
Re: Might And Fealty - Greasemonkey Script
« Reply #26 on: August 17, 2017, 01:08:15 AM »
So far as I know, the author of the script no longer plays
He who was once known as Blackfyre