New Content - Implemented New Area Unlocked: Please Linkify!

Bale

Minion
PNgCtWs.png


Whenever a new area is unlocked in KoL we get a little announcement of that fact. However, the announcement only links to the container zone, even though it looks like there is an adventurable location link. I sometimes reflexively click on the image to adventure in the area and feel chagrined when it does nothing. Instead I need to click on "The Sea Floor" and then click again in the correct location on the map. It would be more convenient and natural if clicking on the words, "The Coral Corral" or the image would take me to the adventuring location.

I know someone might be thinking, "Idiot. Can't he just make a relay override for this?" Actually, there's a good reason why it is troublesome. New areas unlock from council.php, monkeycastle.php, place.php or even when you encounter Mr. Alarm while adventuring at the Knob Laboratory. Heck, they can occur anywhere! This seems like something that would be better handled by KoLmafia.

Now that KoLmafia's location names match KoL's location names, this feature shouldn't be terribly difficult! Hooray for making use of all lost's hard work. Here's the block of html to help with the implementation:

HTML:
<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/scripts/keybinds.min.2.js"></script>
<script language=Javascript src="/images/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 src="/images/scripts/jquery-1.3.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://images.kingdomofloathing.com/styles.20120512.css">

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

<body>
<centeR><table  width=95%  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>Results:</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td>"What? Aw, dangit, you went and distracted me! I was remembering one of my favorite radio stories, and now I went and lost my place. I'll have to start over at the commercial, and now I'll have that stupid cigarette jingle stuck in my head all day! What do you want?<p>Currants? Them little raisin things that look like mouse turds? What d'you want to know about them for? What d'you think I know about that? Don't give me that look, of course I know what a mouse is! I may be aquatic, but I've read a book or two in my life, not like you kids these days with your moving pictures and text-phones where you can't use all the letters.<p>Oh, <i>currents</i>. Well you might have said so in the first place, instead of mumbling and talking to your shoes all the time! When I was a lad I knew how to look a fella in the eye when I talked to him! Anyway, yeah, we've got currents around here. Good strong ones too, not the little breezes you get most places these days. Johnny Two-Fingers got caught in one'a them once, carried him clear to Timbuktu and he had to hop a freight to get back. That's what he told us anyhow, but I was always suspicious of that on account of he was back before dinnertime. Johnny Two-Fingers was always makin' up fibs anyway. Told me once he taught a clam to whistle the national anthem, but he wouldn't show it to me on account of it havin' stage fright. Pfft! How's a clam whistle without lips anyway?<p>But yeah, them currents. Can't swim 'em, not less you wanna end up in Timbuktu. Legs ain't strong enough, certainly not a landlubber's legs like them things you got. Gonna need one of them seahorses like they keep at the Coral Corral. Lemme see that mess you call a map. Yeah, there's where it is, right there.<p>Now stop pestering me with all this nonsense about mouse turds so I can get back to my stories! 'Cancerfield cigarettes keep your T-zone smelling great! Soothe your throat and lungs with that fine sweetened menth - o - late!'"<P><center><table  width=400  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>New Area Unlocked</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td><center><table><tr><td valign=center><img src="http://images.kingdomofloathing.com/adventureimages/../otherimages/ocean/corrala.gif"></td><td valign=center class=small><b>The Coral Corral</b>, on <a class=nounder href=seafloor.php><b>The Sea Floor</b></a>.</td></tr></table></center></td></tr></table></center></td></tr><tr><td height=4></td></tr></table></center><p></td></tr></table></center></td></tr><tr><td height=4></td></tr></table><table  width=95%  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>Grandpa</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td><center><img src="http://images.kingdomofloathing.com/adventureimages/sm_grandpawindow.gif" width=100 height=100><form name=grandpastories action=monkeycastle.php method=post><input type=hidden name=action value=grandpastory>"Eh?  What do you want?"<p>Ask Grandpa about <input type=text class=text size=10 name=topic> <input class=button type=submit value=Ask!></form></center></td></tr></table></center></td></tr><tr><td height=4></td></tr></table><table  width=95%  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>The Sea Monkee Castle</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td><img src=http://images.kingdomofloathing.com/otherimages/monkeycastle/castlegfolks.gif usemap="#gfolks" border=0><map name="gfolks"><area shape="rect" coords="195,279,294,378" href="shop.php?whichshop=grandma"><area shape="rect" coords="54,397,153,496" href="monkeycastle.php?who=1"><area shape="rect" coords="231,397,330,496" href="monkeycastle.php?who=2"><area shape="rect" coords="95,279,194,378" href="monkeycastle.php?who=3"></map><p><center><a href="seafloor.php">Back to the Sea Floor</a></center></td></tr></table></center></td></tr><tr><td height=4></td></tr></table></center></body><script src="/onfocus.js"></script></html>
 
Last edited:

Winterbay

Active member
I wholeheartedly support this request. I have myself done the clicking motion several times. I wonder if it could be requested that KoL itself adds this since it appears to be a relatively logical thing to have...
 

Veracity

Developer
Staff member
I also have had to train myself not to click on the image.

Here is the piece of the HTML of interest:

HTML:
<table  width=400  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue>f<b>New Area Unlocked</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td><center><table><tr><td valign=center><img src="http://images.kingdomofloathing.com/adventureimages/../otherimages/ocean/corrala.gif"></td><td valign=center class=small><b>The Coral Corral</b>, on <a class=nounder href=seafloor.php><b>The Sea Floor</b></a>.</td></tr></table></center></td></tr></table>
Notice how the bold texted "The Sea Floor" is wrapped in a link to the container.

It wouldn't hurt if both "The Coral Corral" and the image were wrapped in (the same) link to the zone itself.
 
Last edited:

lostcalpolydude

Developer
Staff member
Code:
String test = "New Area Unlocked";
int index = buffer.indexOf( test );

if ( index == -1 )
{
	return;
}

int startIndex = buffer.indexOf( "<b>", index ) + 3;
int endIndex = buffer.indexOf( "</b>", startIndex );

String locationName = buffer.substring( startIndex, endIndex );
That does a nice job of getting the location name, I expect. I have no idea how to get the URL from the name though.
 

Veracity

Developer
Staff member
I'm working on this. I'll be in The Sea again on Friday and will certainly enjoy it.
 

Veracity

Developer
Staff member
Already past Mr. Alarm. I'm in a BIG ascension on Day 2 and I've already started the war on the Island - which is triggered by getting something to do with the Palindome (since you need the pirates to make the Talisman o' Nam). I've noticed that making the Talisman is not enough by itself for the Council to tell you to start the War, but once I've gone through the Palindome, even without defeating Dr. Awkward, the Council does tell you. Since I wanted to start the war, I went all the way through to Dr. Awkward.

No problem. Your page HTML combined with the "test" command - which lets me load page HTML and call functions to operate on it - will let me get this working.
 
Last edited:

Bale

Minion
Ah. I figured since you said that you'd be at the Sea on Friday, I though you had to ascend first.

I've already started the war on the Island - which is triggered by getting something to do with the Palindome (since you need the pirates to make the Talisman o'). I've noticed that making the Talisman is not enough by itself for the Council to tell you to start the War, but once I've gone through it, even without defeating Dr. Awkward, the Council does tell you.

The trigger is to spend one adventure (either combat or non-combat) in the Palindome.


I did not know about that function. Looking at the function, the conversion is indirect enough that I would have taken a long time to find it without seeing that.

I'm glad you got it now. I originally wanted to make this request months ago, but I figured it would be way too troublesome to convert KoL's name for the location into KoLmafia's name. So I held off until now. Thank goodness for the Florist Friars encouraging the KoLmafia name change.
 
Last edited:

lostcalpolydude

Developer
Staff member
I've noticed that making the Talisman is not enough by itself for the Council to tell you to start the War, but once I've gone through the Palindome, even without defeating Dr. Awkward, the Council does tell you.

There was a time when looking at the Plains with the Palindome visible was enough to unlock starting the war quest, but at some point it changed to requiring 1 turn spent in the Palindome.
 

Veracity

Developer
Staff member
Ah. I figured since you said that you'd be at the Sea on Friday, I though you had to ascend first.
I'm slow. Although I am in a "speed" clan, they did not accept me because of my speed. They took me because of my community service and my innate spade-iness. :)

I got off to a slow start in BIG, since I had just finished a long series of Zombie runs (so I can start that path with all the Zombie skills) followed by a long series of Jarlsberg runs (so I can start that path with all Jarlsberg skills). As a result, I had to re-learn how to use normal skills, familiars, bookshelf summons, faxes, and so on. So, it takes me 4 days to finish a Hardcore BIG run. If I am fast, I finish on the 4th day without having consumed anything, so I can eat, drink, and spleen and get enough turns - including Fishy, from sushi - to finish The Sea on the 4th day. If I am slow, I do it on the 5th day.

In any case, if I had to ascend today - Wednesday - there is no way I would be in the Sea on Friday. Since I ascended yesterday and things are going fast, I will be there.

Which is really neither here nor there.

Revision 12271 supposedly turns the image and the zone name into links that send you to adventure in the zone.

I'll try it for myself on Friday, with the Wreck of the Edgar Fitzgerald, the Mer-kin Outpost, the Coral Corral. :)
 

lostcalpolydude

Developer
Staff member
I don't think it's worth handling cases where KoL tells you that you can go somewhere but then doesn't actually let you go there.
 

heeheehee

Developer
Staff member
I don't think it's worth handling cases where KoL tells you that you can go somewhere but then doesn't actually let you go there.

Perhaps a link to the appropriate zone when you equip the item? (also, this would be nice for the Talisman o' Nam / Palindome) I guess this would be a separate freq.

Yeah. Do you think it would be good if KoLmafia automatically equipped it for you?

Not really, since it's an accessory (which one would you replace?).
 

Veracity

Developer
Staff member
It just gave me a link to the Degrassi Knoll adventure zone - even though Inside the Knoll is available to me - which it knew, since it also gave me a link to Innabox. :)

I did like this a lot when I did The Sea before I ascended.

Well, if we want to customize some of the links depending on conditions, that wouldn't be difficult; the code to add these links is isolated in its own (new) method.
 
Last edited:

Veracity

Developer
Staff member
Oooh - and I just visited the Trapper and got this:

New Area Unlocked - The Goatlet
New Area Unlocked - Itznotyerzitz Mine

Only the first one got linkified.
 
Top