ocean.ash Virgin Booty Slapper (spoil sea locations)

Let me preface this by stating the obvious: I am new to ash scripting, and this is being held together by a combination of nails that were hammered in using screwdrivers because I didn't know what kind of hammer to use or where the hammers are. Also, the nails were screwdrivers, 'cause my school never taught me how to use nails. The output of the script right now is really ugly. The input is also, probably, really ugly. There's probably things done wrong in this (the reason why I'm even posting this is because I figure it's the best way to have people say, "dude, you missed out this really obvious and eloquent way to do this!"), and if anyone wants to use this as a role model, you're better off jumping off a bridge. You've been warned.

This relay override script plops out a table of information shamelessly stolen from the KoLWiki when you front the meat to set an Open Course for the Virgin Booty. That way, I can keep being lazy and not bothering to look up what my stat zones are while adventuring in the relay browser. It has been tested on Chrome in Mac OS 10.6 and basically nowhere else. The original idea was to plop out a dropdown menu, and selecting items in the dropdown would automatically populate the coordinate field boxes to your destination. I think that's more of a Greasemonkey thing, but even if it can be done in Mafia, it's been a few years since I was last doing Javascript and it sounded too big for a first timer thing.

EDIT: MOST RECENT VERSION IS HERE.

<old>Without further ado, screenshot of current thingy:
Screen shot 2012-03-22 at 9.20.39 PM.png</old>

Screenshots of what things look like:
Screen shot 2012-03-29 at 11.12.19 PM.png
Screen shot 2012-04-11 at 12.24.39 AM.png


Ash file attached at end, too.

Usage for anyone doing this for the first time: Make sure "Enable user-scripted relay browser overrides" is checked in your KoLMafia Relay Browser Preferences, then drop the file into the "relay" folder. (Located in Application Support/KoLMafia on MacOS.)
 

Attachments

  • ocean.ash
    3.1 KB · Views: 85
Last edited:

roippi

Developer
Haha. My first ash script was similarly cobbled-together, and I posted it with equal trepidation. Cheers :)
 

Ethelred

Member
Actually, something already does this for me. I thought it was mafia, but maybe it's Mr. Script. If it is Mr. Script, you might want to take a look at that to see how someone else did it.
 

Theraze

Active member
Well, Mr. Script is GreaseMonkey which makes it less useful for ASH scripting how-to research... but I suppose you can use it for the... what, raw data? :)
 
Ah, yes, it does look like Mr. Script does something like that through drop boxes (basically just selections for the first coordinates, which is probably what most everyone uses, but it never hurts to be complete). Thanks for pointing it out, it helps a bit. I think I'll keep on working on Mafia-end stuff, though, because selective laziness prevents me from downloading Greasemonkey. :p Besides, reinventing the wheel builds character.
 
Last edited:

Bale

Minion
Oracle of Wuffing, that was a very credible first script for a purpose that I do find useful! You know what would make it even better? It would be even better if the names of the adventures were buttons and clicking those buttons took me to the adventure without having to actually type the coordinates.

If you have no idea how to do that, take a look at this: Form of... HTML

You could learn even more about writing relay scripts by upgrading this script in that way and I would find it even more useful.

If you want to be really fancy you could even have the button randomly select one of the many valid coordinates for that adventure. That would definitely be overkill though. ;)

PS. The way that you implemented this was very simple and straightforward as well as equally effective. I have no complaints or criticisms. The suggested upgrade though will require you to learn how to use nails instead of screwdrivers.
 
Last edited:
PS. The way that you implemented this was very simple and straightforward as well as equally effective. I have no complaints or criticisms.
Oh. That's... Good. I guess. It just felt awkward from the start to here, and didn't seem to be letting up (Insert joke about my mom here).:p

Undoubtedly, though, that's where I wanted to go with this, after I made it look a bit nicer. I was thinking more spans or anchors with onClick()s than buttons, though, because filling up a page with buttons just doesn't look nice. Also, I couldn't immediately find how to seed KoLMafia's random() function, because getting truly pseudo-random numbers for this purpose is really reeeally important.

Wait, so like... The way I was seeing it, was that I'd have to document.getElementByTagName() to grab the textbox where you'd type in the coordinates. Or, wait... I'm supposed to just use visit_url(blah?foo=bar) for that, right? Or is it bad form groan to let someone adventure to the clicked on coordinates and bypass KoL's native button altogether? Gah, I need to spend less time second-guessing myself. Think I'll just make Thursday my sorta-annual workday to get stuff like this progressed, that'll give me time to think about how this should be done as opposed to how I'm going to do it.
 

Bale

Minion
I don't see a problem with bypassing KoL's native button altogether. You could remove it and use a new set of buttons. That would not bother me in the least since, let's face it, the native interface for the sea was designed to not be user friendly. Does anyone actually want to ever see the coordinates? If you threw away the coordinates and just had a series of buttons for destinations I think anyone using it would be very happy to be free of seeing those meaningless integers.
 
The problem is... I love overcomplicating things too much.

I think that, on principle, I shouldn't remove functionality from the game itself. I mean, if we weren't able to pick coordinates, it'd be another ten years before we'd even have half the data to find out about Ak'gyxoth. There's basically eight buttons that would be needed if I masked this as a choice adventure (Mus/Mys/Mox, Sphere, Trapezoid, Sand, Fragment, and Chest-Key). If I toss in a random button, that gives me nine buttons. The thing that nags me about a random button, is that a truly random button would be so incredibly biased towards a chest or key to be pretty much redundant. So a better button would effectively pick one of the eight buttons, and click on that. But that distinction is not exactly user friendly, either, so aaaauugh!

Stepping away from that, 8-9-10-12 is the sweet spot for buttons, because that's easily arrangeable into a rectangle, which works with KoL's boxy interface. It's still a whole lot of buttons, though, which kinda distresses me, but there's not exactly going to be a pretty way to do it other than one honking huge selection box, which has its own problems.
 

lostcalpolydude

Developer
Staff member
Anyone that wants this relay override isn't going to bother exploring, so it won't hurt to just give 8 choices. If they really change their mind, they can disable the script. I don't think the target audience would even make use of a Random button.
 

roippi

Developer
I'd personally agree with lost here. It is globally inappropriate to delete native functionality in vanilla mafia. It's fine to do it in a relay override, especially for a part of the game that hasn't changed in 5 (?) years. Of course, if that doesn't jive with your personal sensibilities, I'd say of course do what feels right to you.
 

Winterbay

Active member
I generally always enter random numbers into the boxes when I get there, but then I do not have an override either so I guess that is kind of a moot point :)
 
It isn't whether or not a random button would be used, it's about how fun random buttons are. :D

Maybe it's my blind newbieness, but I think it'd be a good practice for every script to strive to be something presentable in Vanilla Mafia, regardless of how ludicrous the chances are of such scripts getting added into Mafia. Regardless, yeah, a bunch of those buttons will get used a whole lot more than others. Hm.

I'm back to imagining injecting some Javascript on this thing, and hitting a better compromise between what I was thinking and what's probably best. The most important buttons are the stats and maybe the Power Sphere. I ought to be able to just present those three or four buttons, then allow the player to click on a link or another button to show all the options. Sure, it's feature bloat and most of that will be executed maybe three times in my lifetime, but if I was sane I wouldn't be playing with stickfigures.
 
This update improves stability and enhances performance for the ocean.ash Virgin Booty Slapper, as well as addressing a minor bug that broadcasted your social security numbers to Alefgard. To install, delete your old ocean.ash and put this new one in its place.

Okay but serious updates:
  • You have buttons now, that immediately whisk you away on an adventure to the most common locations.
  • The table that displays all the locations has been moved, and shrunk!
  • That table is even hidden by default, and you gotta click a button to show it!

Known bugs / things that still need to be improved:
  • The button that shows the locations spoilers is still available on the page after you have gained your reward. Known fixable, too lazy to fix that now.
  • The quick location buttons do not send you to a random location, just the first location for each type. Will be changed in a future release.
  • I still want to make that silly table clickable, much to the same affect as the quick buttons.

Screenshots:

The magic button!
Screen shot 2012-03-29 at 11.12.19 PM.png

The tiny table!
Screen shot 2012-03-29 at 11.12.02 PM.png
 

Attachments

  • ocean.ash
    5 KB · Views: 30
A new version of ocean.ash is available. Would you like to download it now?

Details:
Probably fixed issue of the "Spoiler important locations" thing appearing when it shouldn't.
Quick adventure buttons probably take you to a random adventure for that result.

The spread-out nature of the noncombat, the amount of locations to vist, and the limited number of adventures I reserve for testing this make it hard to determine, specifically, if those statements are true, but they're true enough to warrant pushing this out. I still want to knuckle down and work on that table, but I kinda wanted this functionality, too. I hope mafia handles seeding the rng, because I certainly didn't find anything about that.
 

Attachments

  • ocean.ash
    10.9 KB · Views: 37

Bale

Minion
Just want to say that this is now one of my essential relay scripts.

Pretty soon you'll have bumcheekcity asking you for permission to add it to his hugeass swiss army relay script. ;)
 
Him asking would just be a formality, he already has my soul due to snapshot. :p
I'm afraid I didn't get around to the table stuff today, though, due to holiday stress issues. Tuesday's probably going to be my workday, urgh!
 
In hindsight, what I should have done in making this script, was load all the noteworthy locations into a single three-ish dimensional map, and used a handful of loops to parse that information out every time I wanted to use that information. I have no short-term intention of doing so right now, as I know if I try that now, I'll end up getting this thing into development hell and just be on a constant improvement cycle with no satisfying releases. But let it be known that I know about that.:p

I guess you could call this the first "fully featured" release. There's a whole lotta links in that table now, and it's even color coded. I even implemented the random location link. And yes, I even tried to make sure you don't randomly adventure into the mainland for you. Needless to say, I can't really test the script fully myself, and I actually don't see this popular enough where It'll ever be rigorously tested enough for me. :D However, these are more options than anyone really needs for their Booty.

Again, I feel sorry for anyone who wants to look through my code, which probably means I did something right.

Here's what the table looks like now, the buttons from previous versions that had buttons are still there.
Screen shot 2012-04-11 at 12.24.39 AM.png
 

Attachments

  • ocean.ash
    32.2 KB · Views: 33
Top