BatMan Relay -- more info, less clicking

zarqon

Well-known member
1.6 Updates!

After making the last update, I got some more ideas. They are ideas of goodness which you will like. I shall present them in order, from least mindbogglingly terrific to most mindbogglingly terrific.

First, coming in at "well ok then" on the scale of terrificness, BatMan RE now knows that unknown monsters have raw stats of -1. It will only give you the handy form for editing unknown_ml in the event that any of the monster's stats are actually unknown.

Secondly -- and quite terrifically as well! -- the Actions Table looks nicer! Faint odd/even row differentiation, slightly reduced font and row size, a few other tweaks -- all of this should mean more information available more clearly.

Third, in a move critics are calling "so mindbogglingly terrific it boggles the mind!", BatMan has joined forces with Monster Manuel to create a Dynamic Duo of Monster Biffing! BatMan now enhances Monster Manuel's information with his own seemingly-incidental profferings of knowledge! These two pseudo-omniscient fonts of trivia working in tandem provide enough information between them to choke a camel!

The sweet deets: all Manuel's stats are displayed as usual, although mousing over the related icon now gives extra information. Additionally, the stat itself is displayed in a red-green gradient. For attack/defense, that gradient is hitchance, where green = good, and red = bad. For monster HP, it functions like you'd expect in any video game, green at full health and red at low health. A fourth stat is also displayed: monster value. Mousing over the meat icon will give a partial breakdown of the number.

In a move critics are hailing "the beginning of Manuel's dégringolade", Manuel has also granted his new partner BatMan permission to display this table even for users who only have half of the duo (the better half, it could be argued; certainly the batter half), but the stats used will be generally less accurate (though still pretty smart).

In a move critics are calling "The moment we've all been waiting for", this update post is now ending.

Enjoy!

@Veracity: Hmmm. I think things the way they are is fine; extract_items() parsing the "Found in this fight" message and not the KoL-supplied messages would be pretty difficult to account for since the Found items message doesn't always show. If it did always show, though, even during combat -- that might be something. For now I've already got BatBrain ignoring the Found items message, which ought to serve nicely.
 

Bale

Minion
Please step away from the camel! Camel's aren't generally the best tempered of animals, but I cannot approve of harming one.
 

livercat

Member
If a monster has 0 hp (Ninja Snowman Assassin, for example), you get "Division by zero (BatMan_RE.ash, line 323)".
A quick fix would be to change line 323 of BatMan_RE.ash from:
PHP:
to_htmlcolor(monster_stat("hp")/to_float(monster_hp(m)))+";'>"+rnum(monster_stat("hp"))+"</span></b></td></tr>");
to
PHP:
to_htmlcolor(monster_stat("hp")/to_float(max(monster_hp(m),1)))+";'>"+rnum(monster_stat("hp"))+"</span></b></td></tr>");
 
Last edited:

zarqon

Well-known member
1.7 Update

  • Monster damage is now a spread rather than a float.
  • Don't divide by 0.
  • Add Siphon Spirits to Quick Menu!!!!!!11!!!1!!!!11!!!!1111! If the skill is available, an item now appears in the menu with information about the drink you would siphon (like adventure/stat gain, level requirement warning if applicable, effect granted, etc.) and a quick link to Wiki the drink if you want more information than that provided. Clicking the drink will actually siphon the spirit.

Quick link to Wiki the drink. Click the quick link to Wiki the drink.

"Quick, Dick! Click the quick link to Wiki the drink!"

How many quick links to Wiki the drink could Quick Dick click, if Quick Dick could click quick links to Wiki the drink?
 

zarqon

Well-known member
I'm working on a pretty major update to this script, doing something I've always wanted to do (fixed table under the page, KoL default forms moved to another tab, action blacklist tab, yeah get excited), but in the process I've discovered how to duplicate the two-adventures bug. I encountered this issue for the very first time and wondered what I'd changed, since I tend to have a pretty static setup these days.

It turns out it's the "Run betweenBattleScript before manual adventures" option in preferences. If that is enabled, mafia will auto-adventure once before loading the next combat into the browser. If it's disabled, the script will function regularly.

At present I have no idea how to fix this or possibly whose ear I need to stick a bee in, but I can tell you that if you are having the double-adventure problem and don't mind forgoing your betweenBattleScript during relay play, you can avoid the issue.
 

zarqon

Well-known member
BatMan RE 2.0 is Here!

I am extremely pleased to announce a new version of BatMan RE. It has so many new features and refinements I decided to bump it all the way up from 1.7 to 2.0. Once you start using this, I find it highly doubtful that you'll ever want to fight in the relay browser without it.

The first major change you'll notice is that things have moved around. The Actions Table which used to be inserted in the page directly above the KoL combat forms, making the page uncomfortably long, is now fixed to the bottom of the page, and where did all the KoL forms go? Hey, are these tabs? Cool!

Let's discuss the new tabs, shall we? There are four of them.

  1. Actions
    This should look quite familiar to previous BatMan RE users. This is the table containing all your possible actions that BatBrain knows about, sortable by a wide range of criteria and full of very useful information. Now that it's fixed to the bottom of the page, you should basically never need to scroll down unless you won the combat after submitting a long macro. You'll also notice a new column on the far right: Send to Blacklist. Clicking the right arrow will shoot the action onto your blacklist (with the default value of 0 for a total blacklist) and remove it from the Actions Table.
  2. KoL
    The second tab is where you'll find the vanilla KoL combat forms. Moving them into a tab serves the dual purpose of de-cluttering the fight page and also discouraging users from performing non-macro'd actions, since all non-macro actions cannot be tracked by BatBrain. Using the vanilla forms is sometimes necessary however, to throw an item BatBrain doesn't handle (i.e. runaways or Frosty's whatever), or to verify that a certain skill or item is actually available/unavailable.
  3. Blacklist
    This tab displays your character's action blacklist, and allows you to edit it as well. You can click the left arrow to remove the item from your blacklist and shoot the action back into the Actions Table (although presently it won't display until you refresh the page). Actions that don't have a left arrow are not actually present in your blacklist -- they were added automatically by BatBrain and thus cannot be removed. You can also click the "new entry" link at the top to add a new entry directly. Last, you can edit existing entries by clicking the number in the Amount column. Clicking the action's name will attempt to perform that action. So you can use your blacklist as a way to reserve items you want to control yourself.
  4. Wiki
    This tab is not strictly necessary, as you can easily Wiki a monster in a variety of ways, but it's just one more way to have all the information easily accessible in one place. Since mafia doesn't follow redirects from within a relay browser, the script can't always find the right Wiki page, but when it fails, it provides a CLI link to wiki the monster using mafia's "wiki" command, which ought to open up a new tab in that selfsame browser (very nearly equally as convenient).

Besides this overhaul of the in-combat experience, there have also been quite a lot of improvements to the Adventure Again menu, which appears when combat is over. "What improvements?!" you clamor. "What? I didn't clamor!!" you protest. The list of improvements is not small:

  • BatMan RE now displays the combat-queue adjusted appearance rates of all monsters in the zone, as well as noncombats, sorted by likelihood. Clicking any of these will open up the relevant Wiki page. You'll probably notice that nearly all of these monsters appear as question marks (or Possibility Giants to the observant) because presently most monsters do not have image information in their image proxy record field. But as this information is added, those question marks will change into actual monster images. Except for the Possibility Giant. That will stay the same.
  • If the location has a clover adventure, it will display the results of the clover adventure, as well as the number of clovers you have. If that number is greater than 0, the clover picture will also be a link to assemble a clover before continuing (or a link to disassemble the clover should you change your mind). Displaying this information will no doubt surprise some new and/or casual players who never use clovers, and also serve as a handy reminder of some places they could speed up their runs with clovers. It also reduces the amount of Wiki double-checking a person needs to do. Adventuring in the Giant's Basement? Suddenly the letters W, A, N, D, and G show up with a clover underneath them and you realize, hey, I could get my entire wand in one turn if I used a clover here! And I have 8 clovers! Sweet, I'ma do it. *click*
  • Using mafia's property, display the hauntedness remaining in A-Boo peak.
  • Using mafia's property, display the pressure remaining in A-Boo peak (and the number of slicks that represents).
  • Using mafia's property, display the remaining planks needed from the Smut Orc Logging Camp.
  • Link to use sonars in Guano Junction.
  • Link to use hedge trimmers in Twin Peak.
  • In the Hole in the Sky, display a small table showing possibly desired star items which you lack (just the key, hat, sword, and crossbow), the number of stars/lines required, and the amount you have of the ingredients. If you have enough to create one of them, the item image changes to a link to craft the item. Thanks to the alias thread for the idea.
  • As we did with Boriscore, display monsters banished by the Cheesestaff.
  • One further nifty touch for Jarlsberg's pan owners: display a table of use links and results for the various celestial potions you can make using Cosmic Calories. The table (and first option) only shows up when you have 20.
  • If you olfacted your last monster, and that monster is not in your ftf_olfact setting, provide a handy link to add that monster to your ftf_olfact setting directly.

All of this extra info goes quite a long way towards having all the most needed info available in one place.

A couple other tiny fixes: Strange monsters are now weird. Or weird monsters are strange. Whatever. Secondly, if the BatMan enhancements don't load for whatever reason, you can click the Bat-Computer to twiddle your fingers and force a reload.

To do: The Monster Manuel enhancement from earlier still replaces the vanilla Manuel table with the BatMan-enhanced version, but the BatMan version doesn't have the right column of information. It probably needs to be refactored to individually replace each cell on the left, which was a chore I didn't feel up to prior to this update. Also, when you remove actions from the blacklist, they don't immediately reappear in the Actions Table, which could be confusing as the action seems to disappear into the void. Need to find a way to trigger an Actions Table reload without reloading the page.

If you're wondering why I haven't been updating my other scripts as much lately, this is why.

Please enjoy this. If you don't enjoy this you are probably dumb though. So if you don't enjoy it, best keep it to yourself.
 
Last edited:

Theraze

Active member
Sadly, with my IE10, the new BatMan shows... nothing. No commands at all. No tabs. Just the recently used buttons at the top of the combat window. The combat text is still there, but... I've had to remove fight.ash and adventure.ash to at least give me basic fight capabilities. :(
 

zarqon

Well-known member
I tested this in both Opera and IE before releasing, but did not test with the CAB enabled. Try disabling those buttons and see if it works. In the meantime, when I get home I'll try enabling them and see if it breaks.

Any errors in your Java console?
 

Theraze

Active member
HTML1527: DOCTYPE expected. The shortest valid doctype is "<!DOCTYPE html>".
game.php, line 1 character 1
HTML1506: Unexpected token.
game.php, line 1 character 276
HTML1506: Unexpected token.
game.php, line 1 character 358
HTML1506: Unexpected token.
game.php, line 1 character 402
HTML1506: Unexpected token.
game.php, line 1 character 474
And just to clarify, my CAB is off.
 
Last edited:

zarqon

Well-known member
Those look like KoL errors, as they're about game.php and not fight.php.

I'm talking about the recently used buttons you mentioned. That's a mafia enhancement which this script was not tested with. I don't use either KoL's CAB or mafia's buttons so perhaps I mixed up the terminology.

I haven't been home yet but will test when I am.

ETA: Arrived home, tested both CAB and mafia's custom combat buttons in IE 9 -- both load everything, although the Actions table is strangely unclickable with the CAB enabled. Installed IE 10 and got the same result. As long as the CAB was not enabled, everything worked fine. Not sure what's going on with your machine, but I am unable to duplicate.
 
Last edited:

Theraze

Active member
Sadness, because until BMR2, everything worked great. Oh well, guess I just need to get used to not knowing what stuff does anymore. Not because I hate it and therefor suck, but because my computer apparently hates progress. :(
 

zarqon

Well-known member
Just to be sure, what are the "recently used buttons"? I'm fairly sure they're the difference between your setup and mine. Are you talking about the buttons controlled by relayAddsCustomCombat? That's what I assumed you meant, and I tested it completely working in IE 10. If you mean something else, it may well be the culprit.

Some other ideas: BMRE's files are the only ones by that name in your mafia directory? What does the page source look like? Is it being edited at all? There aren't any errors in your CLI right? You haven't disabled Javascript?
 
Last edited:

O_3_141592

New member
I use FF 17.0.5 and also observed Theraze's problem: There was space reserved at the bottom of the page but no BMRE tabs. I also had the relayAddsCustomCombat-Buttons but no CAB.

Activating the CAB made BMRE appear in combat, but I do not get BMRE after combat. (The latter also happened with 1.7 sometimes - I never tried to find a pattern, as I did not use the functionality.)
 

heeheehee

Developer
Staff member
I'm also seeing this with the CAB disabled.

Might it be related to <body onkeyup="handleCombatHotkey(event,false);" onkeydown="handleCombatHotkey(event,true);">
instead of <body>? I see that's how you seem to be inserting your stuff.

One option would be to use a regex that looks something like "<body[^>]*?>". With that done, it's displaying rather poorly under Firefox (the headers aren't aligned with the actual table, but it _is_ displaying, for one). I'll look into it when I have more time.

With said modification to make it show up, it looks great under Chrome, though, which is promising.
 

zarqon

Well-known member
So far I'm not at all sure what exactly you're experiencing, so it's quite difficult to debug. At what point is the script failing for you? Does fight.ash succeed in sending the page to the browser without errors in the CLI? If so, does the jQuery load and run without errors in your browser's Java console? So far I haven't seen a single CLI or Java error -- if they exist, those would be the biggest clues. In fact, some CLI output for a failed page load might be helpful even without an error so I can at least have some landmarks for how far it made it.

Are you running other relay overrides which may be interfering somehow? Do you have the preference set to run an afterBattleScript? If so, does toggling that off make a difference? Do you have your betweenBattleScript set to fire during manual adventuring?

I'm having a hard time debugging this with the information given so far. If I could duplicate it, I could fix it, but so far no luck.

ETA: Ninja'd by heeheehee. That's almost certainly the source of the problem. What adds those key handlers? I obviously didn't have them in all three cases, because the content existed with no enhancements, with the CAB, and with relayAddsCustomCombat.
 
Last edited:

heeheehee

Developer
Staff member
For me, anyhow, BatMan wasn't inserting #battab because it couldn't find <body> anywhere in the HTML (since it looked like what I posted above). No errors anywhere. (nitpick: Java != JavaScript, despite the confusing naming)

After I fixed that, I was encountering a purely cosmetic issue, where the header rows didn't line up with the table rows for the Actions tab.

edit: I think
Code:
.dataTables_scroll div {
    float: left;
}
fixes the cosmetic issue, though.
 
Last edited:

Theraze

Active member
Correct, I haven't changed mafia's relay settings from the default:
> pref customcombat

relayAddsCustomCombat (global, now 'true', default true)
customCombatScript (user, now 'default', default default)
serverAddsCustomCombat (user, now 'false', default false)
I've looked at the CAB, but didn't really like it, so left default combat active.

Edit: And yes, I do have:
PHP:
<body onkeyup="handleCombatHotkey(event,false);" onkeydown="handleCombatHotkey(event,true);" ><div id="mafiabuttons"><center>
as my <body> line.
 
Last edited:

heeheehee

Developer
Staff member
Theraze: my fix for that was to replace line 198ish with
Code:
   matcher m = create_matcher("<body[^>]*?>", results);
   string s = m.replace_first(contains_text(results,"<center><table><a name=\"end\">")
		       ? "$0\n<div id='battab'><ul><li><a href='#bat-enhance'>Actions</a>"+
		       "</li><li><a href='#kolformbox' title='Note: non-macro actions are not tracked!'>KoL</a></li><li><a href='#blacklist' class='blacktrigger'>Blacklist</a></li>"+
		       "<li><a href='#wikibox' class='wickytrigger'>Wiki</a></li></ul>"+
		       "<div id='bat-enhance' class='panel'><a href='fight.php' border=0><img id='compimg' src='images/adventureimages/3machines.gif'></a><p>Bat-Computer "+
		       "calculating...</div><div id='kolformbox' class='panel'><center>KoL forms here</center></div><div id='blacklist' class='panel'><p>The "+
		       "blacklist goes here.</div><div id='wikibox' class='panel'><p><img src='images/itemimages/book5.gif'><p>Consulting the Bat-Monstercyclopedia...</div></div>\n"
		       : "$0\n<div id='bat-enhance'></div>");
  results.set_length(0);
  results.append(s);

(discussion that may be relevant as to why the code's so awkward)
 

O_3_141592

New member
Ok, played around some more and found a pattern.

First, I'm not running any afterAdventureScript or betweenBattleScript and the option for betweenBattle on manual adv is not set.

Concerning BMRE at the end of the battle:

- If I finish the combat by using the CCS-Button in the CAB, I get no BMRE on the following screen.

- If I finish the combat by using the "hand over to Mafia-CCS"-Button of BMRE, I get the headings of the BMRE-tabs and the buttons near the top, but the combat results are displayed over the complete height, including the area that should be reserved for the BMRE-tabs. Scrolling does scroll the combat results and leaves the BMRE-headers fixed on the screen.

- If I finish the combat through a single action everything looks as expected, independent of the way I select the action (BMRE or CAB). For finishing with a CAB-action I have observed that the scrolling respects the BMRE-tabs area, for BMRE-actions I only got results that didn't need scrolling.


Other things:

- The computaion of occurance frequencies apparently does not take olfaction into account.

- Nothing in the BMRE-tabs is clickable for me, neither the tab-selection, nor any action. Not even the scrollbar reacts in any way. The cursor does not change into the "above a link"-cursor and clicking has no effect whatsoever. The buttons near the top however do work.
 
Top