MultiCAB - Show an extra Combat Action Bar

I've been finding 12 Combat Action Bar buttons isn't quite enough to fit in all the skills I regularly use in combat. So I've made a fight.ash override that adds an extra row of buttons to the CAB.

ChX75nT.png

Now I have easy access to all the skills and items I will require to defeat this terrible foe.

The extra bar shows the contents of the action bar directly below your current bar. If you are using action bar 1, it will show action bar 2, and so on.

Everything works as normal for the extra buttons, you can drop actions there from the skill/item dropdowns, and drag buttons between the bars.

You can install it by entering this line into the CLI:
Code:
svn checkout svn://svn.code.sf.net/p/multicab/code

This script overrides fight.php and it is possible you already have a fight.ash relay override!
If this is the case you will get a warning about overwriting files when you install, and be asked if you want to overwrite the old fight.ash
If you don't get that warning then you can ignore everything below this line.
If you want to keep the function of multiple fight.ash scripts you need to manually edit your copy of fight.ash to contain and call the relevant functions from both scripts.
So you would need to copy the addMultiCAB() function into your fight.ash, and your main function would look something like:
Code:
void main() {
     buffer page = visit_url();
     // Other scripts functions that modify the page can go here.
     page = page.addMultiCAB();
     // Other scripts functions that modify the page can go here too.
     page.write();
}
 

Bale

Minion
The extra bar shows the contents of the action bar directly below your current bar. If you are using action bar 1, it will show action bar 2, and so on.

That's interesting, but not exactly how I would want to use this. Would it be possible to have a single action bar that I use for my second? To explain my logic: I have separate action bars for each class. For instance, bar 1 is my Seal Clubber bar, 2 is Turtle Tamers, and so on. With this set-up there are some skills/items that I want access to regardless of class, such as saucy salve, rock band flyers, book of insults...

My point is that I would like to designate bar 12 as the place I put all my cross-class stuff so it is available for each class, freeing up the space on the other bar. If I do this your way, I'd need to use all 12 bars for 6 classes and need to set up 6 nearly identical secondary bars for each and every class.

Could you help me write a version of multicab.js that fulfills my needs? From looking at it I suspect it might be a simple change, but I'm not sure and I don't want to risk screwing up my CAB.
 
That was an approach I looked at. It would be possible, but it would involve storing arbitrary data in your CAB configuration (specifically the bar id for the second action bar), and it would be a fair bit more complicated. This seems to me the only obvious way to remember the setting for your secondary bar without reloading the page whenever you switch it up/down.

Storing arbitrary data in the CAB is technically a thing that is sort of intended/supported by KoL (Kolproxy apparently uses this to store some serverside data), but I find it kinda icky as a concept (CAB data has a size limit, and there's no obvious way for users to remove cruft from their CAB data without nuking the entire thing) so I went by a simpler route.
 
I don't want to risk screwing up my CAB.

Double-posting to say that the chances of this are relatively high! CAB data is pretty fussy about format, and if it isn't happy then it will just destroy itself and make you start from scratch. I destroyed quite a few of my multi's CAB configurations to get this into a working state :)
 

Bale

Minion
When the CAB came out, there was some discussion about using it's extra data storage to hold KoLmafia settings. The conclusion was that it was dangerous to the CAB if anything went wrong.

Anyway, I'd be happy if I didn't have the ability to change the secondary CAB to anything except for 12. No need to store any info in it, just hardcode that.
 
Anyway, I'd be happy if I didn't have the ability to change the secondary CAB to anything except for 12. No need to store any info in it, just hardcode that.

OK! Here's a hack that makes the second bar always show page 12. In multicab.js change lines 4 and 36 ( the declarations of var modpage ) to:
Code:
  var modpage = ( buttonraw < 13 ) ? top.buttoncache.whichpage : 11; //NEW LINE (SPECIAL BALE PAGE12 HAX)
 

Bale

Minion
Wow! This is amazing! I just put my lovebug skills and some other stuff on the lower bar and it stays there while I switch the upper bar.

I just have one criticism and I think that it is valid for your intended usage as well. When I click on the buttons for items or skills, it covers up a portion of the lower bar. That means I cannot easily add new stuff to the right or left slots on the bar if it is a new skill or item, respectively. Have you thought about moving the script, skills and items buttons down a level so that their drop-downs do not cover anything?
 

Bale

Minion
Better! Thanks.

Could you move the "script" button down a line also, just to protect the aesthetics of the CAB? Or is that another issue altogether?
 
I don't want to move the script button, because its position should be consistent with the other places that the script button appears ( such as noncombats ).
 

ungawa

Member
Thanks, DCLS. Looks great. I just screencapped my action bars, installed it, and it didn't wipe anything out, so best of all worlds.
 

Bale

Minion
KoL broke this script! To fix it (and future-proof it against similar KoL-side changes in the future) I made the following change to my version:

PHP:
buffer addMultiCAB( buffer result ) {
	matcher m = create_matcher( "actionbar\\.\\d+\\.js.*?</script>" , result );
	if(m.find())
		result.insert( m.end() , "<script src='MultiCAB.js'></script>" );
	return result;
}
 

Bale

Minion
Oh! Oh sorry.

I forgot I don't have it on SVN and didn't think to check to see if you updated it! I'm so used to my script auto-updating that I forgot this one was different.

(Because of my complicated fight.ash situation I just didn't want to deal with svn on this script.)

Sorry.
 
No worries. Your regex also handles future changes to the GET request section, so I'll probably merge that. And yeah, the problems inherent in dealing with multiple overrides for things like fight and choice are... problematic.
 

Lxndr

Member
I've found a particular script called Batman_RE. Which looks useful and nifty. But I tried copying the addMultiCAB() function into the fight.ash that it creates:

Code:
buffer addMultiCAB( buffer result ) {
  matcher m = create_matcher( "actionbar\\.\\d+\\.js.+?<\\/script>" , result );
  if ( !m.find() ) return result;
  result.insert( m.end() , "<script src='MultiCAB.js'></script>" );
  return result;
}

And apparently, it's also expected that I modify the main function, as per the original post. Here's the batman_RE fight.ash main:

Code:
void main() {
   handle_post();
  // 100% run enforcement
   if (to_familiar(vars["is_100_run"]) != $familiar[none] && my_familiar() != to_familiar(vars["is_100_run"]))
      use_familiar(to_familiar(vars["is_100_run"]));
  // load the KoL page
   if (post contains "runcombat" && post["runcombat"] == "heckyes") results.append(run_combat());
    else results.append(visit_url());
  // enhance it
   add_features();
  // write it
   results.write();
}

here's my attempts to make it look like what (I think) you say the main should look like:

Code:
void main() {
   buffer page = visit_url();
   handle_post();
   page = page.addMultiCAB();
  // 100% run enforcement
   if (to_familiar(vars["is_100_run"]) != $familiar[none] && my_familiar() != to_familiar(vars["is_100_run"]))
      use_familiar(to_familiar(vars["is_100_run"]));
  // load the KoL page
   if (post contains "runcombat" && post["runcombat"] == "heckyes") results.append(run_combat());
    else results.append(visit_url());

  // enhance it
   add_features();  
  // write it
   results.write();
 page.write();
}

apparently I broke something as this is what I get:

http://prntscr.com/aoq18y

So, obviously I'm doing something wrong. What can I do to the batman_RE fight.ash script to make multicab work, or is this a losing battle?
 

Bale

Minion
I don't use Batman_RE and I haven't looked at the code to see how it actually handles things, but results is probably a global variable containing the page's html data, so I'd try this...

Code:
void main() {
   handle_post();
  // 100% run enforcement
   if (to_familiar(vars["is_100_run"]) != $familiar[none] && my_familiar() != to_familiar(vars["is_100_run"]))
      use_familiar(to_familiar(vars["is_100_run"]));
  // load the KoL page
   if (post contains "runcombat" && post["runcombat"] == "heckyes") results.append(run_combat());
    else results.append(visit_url());
  // enhance it
   add_features();
  // MuiltiCAB
   results = addMultiCAB(results);
  // write it
   results.write();
}
 
Top