Bale's Relay Overrides

Bale

Minion
Dinseylandfill: svn checkout https://svn.code.sf.net/p/bale/dinsey/code/
  • Tracks your progress towards gaining each of the four keycards and killing Wart Dinsey.
  • Displays maintenance tunnel status for each area.

I rewrote 90% of the script in the process of adding the maintenance tunnel status for each area. I hope it is well received.
 
Last edited:

ereinion

Member
Using the relay-script for the stench airport, all the links from images on that page is offset to the left, by about the width of the assignment kiosk for me. Apart from that, great script!
 

Bale

Minion
I'm not duplicating that issue. Could you post the HTML of your Dinseylandfill.

Edit: Also, please tell me which browser you are using.
 

ereinion

Member
Using FireFox ESR 31.6.0.

Code:
<html><head>
<script language=Javascript>
<!--
if (parent.frames.length == -1) location.href="game.php";
top.charpane.location.href="charpane.php";
//-->
</script>
<script language=Javascript src="//images.kingdomofloathing.com/scripts/keybinds.min.2.js"></script>
<script language=Javascript src="//images.kingdomofloathing.com/scripts/window.20111231.js"></script>
<script language="javascript">function chatFocus(){if(top.chatpane.document.chatform.graf) top.chatpane.document.chatform.graf.focus();}
if (typeof defaultBind != 'undefined') { defaultBind(47, 2, chatFocus); defaultBind(190, 2, chatFocus);defaultBind(191, 2, chatFocus); defaultBind(47, 8, chatFocus);defaultBind(190, 8, chatFocus); defaultBind(191, 8, chatFocus); }</script><script language="javascript">
    function updateParseItem(iid, field, info) {
        var tbl = $('#ic'+iid);
        var data = parseItem(tbl);
        if (!data) return;
        data[field] = info;
        var out = [];
        for (i in data) {
            if (!data.hasOwnProperty(i)) continue;
            out.push(i+'='+data[i]);
        }
        tbl.attr('rel', out.join('&'));
    }
    function parseItem(tbl) {
        tbl = $(tbl);
        var rel = tbl.attr('rel');
        var data = {};
        if (!rel) return data;
        var parts = rel.split('&');
        for (i in parts) {
            if (!parts.hasOwnProperty(i)) continue;
            var kv = parts[i].split('=');
            tbl.data(kv[0], kv[1]);
            data[kv[0]] = kv[1];
        }
        return data;
    }
</script><script language=Javascript src="//images.kingdomofloathing.com/scripts/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="/images/scripts/pop_query.20130705.js"></script>
<script type="text/javascript" src="/images/scripts/ircm.20150220.js"></script>
<script type="text/javascript">
function pop_ircm_contents(i, some) {
    var contents = '',
        shown = 0,
        da = ' <a href="#" rel="?" class="small dojaxy">[some]</a> <a href="#" rel="',
        db = '" class="small dojaxy">[all]</a>',
        dc = '<div style="width:100%; padding-bottom: 3px;" rel="',
        dd = '<a href="#" rel="1" class="small dojaxy">[';
    one = 'one'; ss=some;
if (i.d==1 && i.s>0) { shown++; 
contents += dc + 'sellstuff.php?action=sell&ajax=1&type=quant&whichitem%5B%5D=IID&howmany=NUM&pwd=90e2dc033c19f8020cbc2d5d73c601f0" id="pircm_'+i.id+'"><b>Auto-Sell ('+i.s+' meat):</b> '+dd+one+']</a>';
if (ss) { contents += da + i.n + db;}
contents += '</div>';
}
one = 'one'; ss=some;
if (i.q==0) { shown++; 
contents += dc + 'inventory.php?action=closetpush&ajax=1&whichitem=IID&qty=NUM&pwd=90e2dc033c19f8020cbc2d5d73c601f0" id="pircm_'+i.id+'"><b>Closet:</b> '+dd+one+']</a>';
if (ss) { contents += da + i.n + db;}
contents += '</div>';
}
one = 'one'; ss=some;
if (i.q==0 && i.g==0 && i.t==1) { shown++; 
contents += dc + 'managestore.php?action=additem&qty1=NUM&item1=IID&price1=&limit1=&ajax=1&pwd=90e2dc033c19f8020cbc2d5d73c601f0" id="pircm_'+i.id+'"><b>Stock in Mall:</b> '+dd+one+']</a>';
if (ss) { contents += da + i.n + db;}
contents += '</div>';
}
one = 'one'; ss=some;
if (i.q==0) { shown++; 
contents += dc + 'managecollection.php?action=put&ajax=1&whichitem1=IID&howmany1=NUM&pwd=90e2dc033c19f8020cbc2d5d73c601f0" id="pircm_'+i.id+'"><b>Add to Display Case:</b> '+dd+one+']</a>';
if (ss) { contents += da + i.n + db;}
contents += '</div>';
}
one = 'one'; ss=some;
if (i.q==0 && i.t==1) { shown++; 
contents += dc + 'clan_stash.php?action=addgoodies&ajax=1&item1=IID&qty1=NUM&pwd=90e2dc033c19f8020cbc2d5d73c601f0" id="pircm_'+i.id+'"><b>Contribute to Clan:</b> '+dd+one+']</a>';
if (ss) { contents += da + i.n + db;}
contents += '</div>';
}
one = 'one'; ss=some;
if (i.q==0 && i.p==0 && i.u=="q" && i.d==1 && i.t==1) { shown++; 
contents += dc + 'craft.php?action=pulverize&ajax=1&smashitem=IID&qty=NUM&pwd=90e2dc033c19f8020cbc2d5d73c601f0" id="pircm_'+i.id+'"><b>Pulverize:</b> '+dd+one+']</a>';
if (ss) { contents += da + i.n + db;}
contents += '</div>';
}
one = 'one'; ss=some;
if (i.u && i.u != ".") { shown++; 
contents += dc + 'inv_'+(i.u=="a"?"redir"lab=(i.u=="u"?"use"i.u=="e"?"eat"i.u=="b"?"booze"i.u=="s"?"spleen":"equip"))))))+'.php?ajax=1&whichitem=IID&itemquantity=NUM&quantity=NUM'+(i.u=="q"?"&action=equip":"")+'&pwd=90e2dc033c19f8020cbc2d5d73c601f0" id="pircm_'+i.id+'"><b>'+ucfirst(unescape(i.ou ? i.ou.replace(/\+/g," ") : (lab=="booze"?"drink":lab)))+':</b> '+dd+one+']</a>';
if (ss && i.u != 'q' && !(i.u=='u' && i.m==0)) { contents += da + i.n + db;}
contents += '</div>';
}

    return [contents, shown];
}
var todo = [];
function nextAction() {
    var next_todo = todo.shift();
    if (next_todo) {
        eval(next_todo);
    }
}
function dojax(dourl, afterFunc, hoverCaller, failureFunc, method, params) {
    $.ajax({
        type: method || 'GET', url: dourl, cache: false,
        data: params || null,
        global: false,
        success: function (out) {
            nextAction();
            if (out.match(/no\|/)) {
                var parts = out.split(/\|/);
                if (failureFunc) failureFunc(parts[1]);
                else if (window.dojaxFailure) window.dojaxFailure(parts[1]);
                else if (top.chatpane.handleMessage) top.chatpane.handleMessage({type: 'event', msg: 'Oops!  Sorry, Dave, you appear to be ' + parts[1]});
                else  $('#ChatWindow').append('<font color="green">Oops!  Sorry, Dave, you appear to be ' + parts[1] + '.</font><br />' + "\n");
                return;
            }

            if (hoverCaller)  {
                float_results(hoverCaller, out);
                if (afterFunc) { afterFunc(out); }
                return;
            }
$(top.mainpane.document).find("#effdiv").remove(); if(!window.dontscroll || (window.dontscroll && dontscroll==0)) { window.scroll(0,0);}
            var $eff = $(top.mainpane.document).find('#effdiv');
            if ($eff.length == 0) {
                var d = top.mainpane.document.createElement('DIV');
                d.id = 'effdiv';
                var b = top.mainpane.document.body;
                if ($('#content_').length > 0) {
                    b = $('#content_ div:first')[0];
                }
                b.insertBefore(d, b.firstChild);
                $eff = $(d);
            }
            $eff.find('a[name="effdivtop"]').remove().end()
                .prepend('<a name="effdivtop"></a><center>' + out + '</center>').css('display','block');
            if (!window.dontscroll || (window.dontscroll && dontscroll==0)) {
                top.mainpane.document.location = top.mainpane.document.location + "#effdivtop";
            }
            if (afterFunc) { afterFunc(out); }
        }
    });
}
</script><link rel="stylesheet" type="text/css" href="//images.kingdomofloathing.com/styles.20150113.css">
<style type='text/css'>
.faded {
    zoom: 1;
    filter: alpha(opacity=35);
    opacity: 0.35;
    -khtml-opacity: 0.35; 
    -moz-opacity: 0.35;
}
</style>

<script language="Javascript" src="/basics.js"></script><link rel="stylesheet" href="/basics.1.css" /></head>

<body>
<centeR><table  width=95%  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>Dinseylandfill</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td><center><div id=background style='position:relative;'><img src="/images/otherimages/dinseylandfill_bg.gif" width=500 height=500 border=0><div id=airport3_zone1 style=' position: absolute; top: -3; left: 165; height: 130; width: 160;'><a  href=adventure.php?snarfblat=442><img src="/images/otherimages/1x1trans.gif" width=160 height=130 border=0 alt="Barf Mountain (1)" title="Barf Mountain (1)"></a></div><div id=airport3_zone2 style=' position: absolute; top: 131; left: 295; height: 110; width: 200;'><a  href=adventure.php?snarfblat=443><img src="/images/otherimages/1x1trans.gif" width=200 height=110 border=0 alt="Pirates of the Garbage Barges (1)" title="Pirates of the Garbage Barges (1)"></a></div><div id=airport3_zone3 style=' position: absolute; top: 201; left: 185; height: 90; width: 105;'><a  href=adventure.php?snarfblat=444><img src="/images/otherimages/1x1trans.gif" width=105 height=90 border=0 alt="The Toxic Teacups (1)" title="The Toxic Teacups (1)"></a></div><div id=airport3_zone4 style=' position: absolute; top: 67; left: 8; height: 170; width: 160;'><a  href=adventure.php?snarfblat=445><img src="/images/otherimages/1x1trans.gif" width=160 height=170 border=0 alt="Uncle Gator's Country Fun-Time Liquid Waste Sluice (1)" title="Uncle Gator's Country Fun-Time Liquid Waste Sluice (1)"></a></div><div id=airport3_tunnels style=' position: absolute; top: 324; left: 46; height: 80; width: 85;'><a  href=place.php?whichplace=airport_stench&action=airport3_tunnels><img src="/images/otherimages/1x1trans.gif" width=85 height=80 border=0 alt="Maintenance Tunnels Access" title="Maintenance Tunnels Access"></a></div><div id=airport3_kiosk style=' position: absolute; top: 394; left: 164; height: 100; width: 80;'><a  href=place.php?whichplace=airport_stench&action=airport3_kiosk><img src="/images/otherimages/1x1trans.gif" width=80 height=100 border=0 alt="Employee Assignment Kiosk" title="Employee Assignment Kiosk"></a></div><div id=airport3_shop style=' position: absolute; top: 306; left: 342; height: 90; width: 140;'><a  href=shop.php?whichshop=landfillstore><img src="/images/otherimages/1x1trans.gif" width=140 height=90 border=0 alt="Dinsey Company Store" title="Dinsey Company Store"></a></div><div id=airport3_zone2b style=' position: absolute; top: 100; left: 342; height: 30; width: 110;'><a  href=adventure.php?snarfblat=443><img src="/images/otherimages/1x1trans.gif" width=110 height=30 border=0 alt="Pirates of the Garbage Barges (1)" title="Pirates of the Garbage Barges (1)"></a></div></div><p><A href=place.php?whichplace=airport>Back to Elemental International Airport</a><p><table style='border-spacing: 6px 0px; color:blue'><tr><td>Barf Mountain</td><td>Myst Ride<td style='color:red;'>✗ keycard α (72/100)</td></td></tr><tr><td>Pirates of the Garbage Barges</td><td>Animatronic Pirate Active<td style='color:green;'>✓ keycard β</td></td></tr><tr><td>The Toxic Teacups</td><td><span style='color:red;'><center>✗ 0/30 turns</center></span><td style='color:red;'>✗ keycard γ (0/100)</td></td></tr><tr><td>Uncle Gator's Country Fun-Time</td><td>Stench Damage Disabled & +ML<td style='color:green;'>✓ keycard δ</td></td></tr><tr><td> </td><td> </td><td style='color:red;'><center>✗ Killed Wart Dinsey</center></td></td></tr></table></center></td></tr></table></center></td></tr><tr><td height=4></td></tr></table></center></body><script src="/ircm_extend.js"></script><script src="/onfocus.1.js"></script></html>

Sample of displacement:

 

ereinion

Member
Great! Another slight issue, though I figure that may be a mafia or kol issue instead of with the script, is that I get the keycards on turn 102 instead of on turn 100. I'm guessing that this has to do with the introductory adventure and control room unlocking not counting towards unlocking the keycard. Dunno if it is something anyone cares all that much about, since it's always the same anyway, but I figure you may be interested in knowing about it at least :)
 

Bale

Minion
It's not the intro adventure or control room unlock. I've found that the exact number varies instead of always being 100 or 102, but I'm pretty sure it is that KoLmafia is counting battles you start, while KoL is only counting battles you win. Your 102 turns indicates that you lost 2 fights.
 
wikiLinks.ash doesn't need to add effect descriptions to effect-granting items anymore, since that's a vanilla kol thing now.

(Good thing I checked my relay scripts before posting this in bug reports!)
 

Bale

Minion
Yeah, I noticed that and fixed it locally. Unfortunately it'll be a number of hours until I have an environment where I can commit that.
 

Erich

Member
Hey Bale. I've been tweaking your topmenu script to fit my personal needs for a while, and also to slowly get me used to reading code. I added this right by the chateau:

Code:
	// Snojo
	if(get_property("snojoAvailable") == "true")
		camp += ' <a target=mainpane href="place.php?whichplace=snojo">snojo</a>';

and it works fine, but I was wondering if that was the "proper" way to add it, because they both are appended to the same place after 'camp'. I'm from the "copy and paste, change a few things, hope it works" school of getting my feet wet :)

PS, I love this script, thanks again.
 

Bale

Minion
I'm not sure that there is a "proper" way or place to add it. You could put it anywhere you want. If there's some other place you'd like to put it, I'll give you a pointer on how to do so.

I had thought about whether I should add it. Unlike the chateau I only use it once a day (for 10 turns) and then I'm done, so I decided not to do so.


PS, I love this script, thanks again.

I'm relieved to hear that since your feedback was extensively referenced in the script's creation.
 
So I pulled in the topmenu override primarily for the simple clan switching, and it has been awesome for the Dread series. However, I'd like to request an addition: could the current clan be displayed to the left or top of the drop down in some manner? Or even possibly just have it display the current clan in the box, rather than 'clan switch'. I forget where I am quite a lot, and have heard from at least one other member who's accidentally spent turns in the wrong instance from forgetting where they were. I'm sure this has uses beyond clanhopping for raids, too.
 

Bale

Minion
I considered that, but it would have to change the top menu to suit the new clan when you make the change. My javascript skills aren't quite up for the challenge. If someone would like to volunteer some assistance then I would contemplate their solution.
 
Does it only build the top menu at the beginning of the session? I looked at the script, but my knowledge of Javascript doesn't exist, so the best I could figure out was that I haven't been in any of the situations where it would change any of the icons that I hadn't already removed.

I noticed that the 're' button refreshes both the scripts listed and clans whitelisted, would automatically calling that not be enough to refresh a variable containing the current clan? Or is it not callable, being a part of Mafia and not your override?
 

Bale

Minion
It builds the top menu when the frame is loaded. I suppose I could trigger a reload when the clan is changed. It is an extra page load and that doesn't seem worthwhile considering what little is added.
 
Hmm. I'm guessing that having some sort of hovertext on the dropdown would have the same issue, then? Or would it always grab the current value of the variable?
 
Top