PDA

View Full Version : Tattoos.ash - Updated



Raven434
02-14-2009, 01:35 PM
Hi,

I have updated this script. I am very much a newb at ash programming.

The subversion info:

Original script from: http://kolmafia.us/index.php/topic,527.msg2569.html#msg2569 - 19 October 2006
Updated by Hippymon 13 November 2007
Updated by Raven434 - 2009-02-13

There are 49 outfit based tattoos now, up from Hippymon's last update of 38.

Data obtained from http://kol.coldfront.net/thekolwiki/index.php/Outfits_by_number
New tat #10 added in
Modded - there is no #13 listed in the outfits_by_number page

I need to account for there be no entry 13 in the table, due to Jick. LOL

Bale
02-14-2009, 06:54 PM
Just a small tip. You could leave out entry 13 in the table if you used



void get_tats_main(){
foreach key in Tat;
get_tats(key);
}

That would only match keys that you actually use. Hence, if you deleted Tat[13].gear it would work perfectly.

Or else you could do this:



void get_tats_main(){
for a from 1 upto 49
if(a != 13) get_tats(a);
}

Not that there's anything wrong with your code. I just thought I'd show you a couple of things since you say that you're a newb.

DerDrongo
02-14-2009, 07:06 PM
another small tip would be to have visit_url outside of the loop, no need to request the page each time, easiest way would be..


void get_tats_main(){
string html = to_lower_case(visit_url("account_tattoos.php"));
foreach key in Tat {
if (contains_text(html, to_lower_case(Tat[key].Img))) {
if (have_outfit(Tat[key].gear)) {
outfit(Tat[key].gear);
visit_url("town_wrong.php?place=artist");
} else print(Tat[key].gear + " is incomplete.");
}
}
}

also making sure everything is in lower case helps avoid case-sensitivity, "Dnatat.gif" wasnt being detected as the page has "dnatat.gif"

Raven434
02-15-2009, 12:50 AM
Awesome!

Thanks for both tutorials!

I'll make the updates.

:-)

zarqon
02-15-2009, 08:28 AM
Another option for skipping 13 is continue:


for a from 1 to 49 {
if (a == 13) continue;
get_tats(a);
}

Zaranthos
08-26-2009, 04:36 PM
Does something like this exist that doesn't try to get tattoos you already have? This changed outfits and visited the artist a bunch of times and didn't get me any missing tattoos.

driedsponge
10-19-2009, 01:04 PM
Found a small bug:


Tat[7].gear = "eXtreme-Cold Weather gear";

Should be:

Tat[7].gear = "eXtreme Cold-Weather gear";

The hyphen seems to be in the wrong spot, causing this outfit check to fail.

Batrachomyomachia
11-04-2009, 04:32 AM
I fixed the script to:

use a map from outfit name to tattoo gif file name
fixed some typos
made it only hit the server once
had it checkpoint your current outfit iff you were going to actually unlock a new tattoo
report which outfits you needed for tattoos you couldn't get yet
include all 56 tattoos known to date

xanth
01-30-2010, 10:35 PM
Since I've found it a big pain to check all my tattoos (instead of just the outfit ones), I've made significant changes to the base script in this thread to now check against all known tattoos. A couple things it does:

-Only hits the server once to grab the tattoo page
-Checks against all outfit, class, ascension, and misc tattoos (except for the few 1 off specialized tattoos given to certain players)
-Checks the 'level' of your hobo tattoo if present
-Provides a complete, color coded listed of haves vs. missing
-Provides a summary of total number have vs missing

Note it DOES NOT automatically try to put on outfits and visit the artist like the previous versions do. This script is purely for informational purposes.

The tattoos are hardcoded into the script unfortunately, so we'll need to update it as new outfits are released.

Hope everyone finds this as helpful as I do!

Version 1.0
Version 1.1 - fixed summary total error

SinginSally
05-11-2010, 04:34 PM
I can cut&paste with the best of em. :-)

Tattoo original script updated with the latest outfit list.

Spiny
05-11-2010, 11:03 PM
I seem to have a small criticism about each of these various tattoo scripts lol.

Batrachomyomachia''s functionality I like in that it will only put on outfits to get a tattoo if you don't have the tattoo and have the outfit, and it will backup the equipment you're wearing to start with so you end up wearing what you started with, not some random outfit. The downside of this script is that it keeps telling me that my hobo boss outfits are incomplete, due to the fact they are in my DC. I KNOW I have the tattoos for them, but this script doesn't care that I have the tattoo since it can't find the equipment. If I have the equipment in my inventory, it realizes I have the tattoo and doesn't mention the outfit as being needed.

Xanth's script is wonderful in that it shows all possible tattoos, be it outfit, consumption, ascension related or whatever. The downside is that it does not do what Batra's script does and retrieve missing outfit tattoos. It is also not completely up to date and has some missing outfits. I had the Knight's Armor outfit, but never got the tattoo, for example.

Sally's version covered new outfits that the previous two scripts didn't know about. However, it goes thru and puts on EVERY outfit to visit the artist with and never looks to see if I have the tattoo first. Also, it doesn't backup my current outfit before doing all the gear swapping.

So, in a perfect world, I want the thoroughness of Xanth's script (updated with new outfits/tattoos), Batra's script functionality in terms of acquiring tattoos automagically, but with the intelligence to know whether or not I have the tattoo before telling me I don't have a given outfit. Don't need the outfit to get a tattoo I already have after all ;)

Maybe one of these days I'll get around to updating this the way I'd like... maybe.

Edit: Hrmm, Batra's script is no longer complaining that I need hobo outfits, perhaps I'm not remembering something correctly from my prior runthru of this script.

I think the reason Sally's script equips every outfit to check for tattoos is because the tattoo names have capital letters in the script which doesn't match with the case sensitivity of the tattoo image names on the actual tattoo page. Perhaps this is just a linux issue, but Batra's script was behaving the same way when I transferred the new data from Sally's script to that one. Then it worked fine when I changed case of the tattoo image names.

Grotfang
05-12-2010, 10:40 AM
I would like to point out that not checking the tattoo page for the presence of a tattoo actually does have a slight benefit -- new outfits can be covered too. I wrote my own tattoo checker, and I grab outfit names from the drop down box on the equipment page. My solution was to match up all the outfits I knew to a tattoo name and check the tattoo page, thereby eliminating all the outfits I had the tattoo for, but regardless it still works to get new outfit tattoos when they crop up.

A nice addition to this, which I might try when I have some free time (finals at the moment) would be to check DC and closet for item pieces, as well as to backup the outfit you started on. I might give this a shot tomorrow afternoon.

I've attached the script as it is so far. Shouldn't be too hard to add to.

SinginSally
05-12-2010, 08:59 PM
Keep in mind all I did was update the original script to include the new outfits. I didn't try to improve it otherwise. I figure efficiency isn't all that important since you don't exactly run this script all that often. :-)

Updates by real ash scripts would of course be appreciated!

Grotfang
05-14-2010, 03:19 PM
UPDATED (WORKING) VERSION

Ok. Got an initial version of the script ready to go. NOTE: You may need a version >= 8440, since Arrrbor Day Apparrrrrel was mis-spelled before that update.

Initial problems should have now been solved, but it is still only tentatively tested (by myself and DoctorRotelle -- many thanks to him for trying to break it!).

It does have some useful features:


Creates a backup before the first outfit change
Should handle outfits missing from mafia, or from the script (albeit with more URL hits)
Gives information on achieved tattoos AND unachievable tattoos, with colours indicating whether you have the outfit
Can optionally check your storage, dc and stash for extra items to use for outfits.


However, it is still in beta, so may be a little buggy beyond what I've stated. For now I recommend leaving the options at the top as:


boolean checkInventory = true;
boolean checkStorage = false;
boolean checkDisplay = false;
boolean checkStash = false;

If you do this, it should work fine for you. The extra options will allow the script to pull stuff/move things around. I believe this works (it works consistently for the outfits I have tried it with -- which is limited as I have most of my outfit tattoos), but be aware that it won't move items back where they came from.

As soon as I think it's safe to consider bug-free, I'll remove the debug setting. However, please make sure it's set to "false".

zarqon
08-26-2011, 03:59 AM
I took a spin at this. Rather than use a data file or hardcode a map -- both of which would require updating later -- this one hits the Wiki for outfit/tattoo/image names, which means it should also work with all future outfits as soon as they are added to the Wiki and mafia. Some details:

This script tries to acquire all outfit tattoos, buying cheap parts if you lack them. Cheap is determined by buypartsupto (default 1000 meat, edit the script to change this value). I recommend setting the value to something which you consider inconsequential. If you don't want it to purchase anything, set it to 0.
It's small -- only 2K! It's meant to be a simple, useful utility. This pleases me.
The Wiki evidently has at least three of the tattoo image names wrong (it appends "tat" to all tattoo image names whereas some of the KoL images lack that suffix), which means that this script will think you don't have that tattoo yet, so it will equip the outfit and visit the Artist in order to realize that you actually have that tattoo, every time. If someone were to fix the Wiki (I'm scared to edit anything there) this problem would be resolved.
The item images were meant to be Wiki links, but I didn't get it working. If someone posts a fix, I'll update this post.
There is a real live regex in this script. Please use caution when editing, particularly if you lack nifty regex tongs such as mine.


Enjoy! Feedback welcome.

Weatherboy
08-26-2011, 11:34 PM
Zarqon's Awesome Rating +1
very nice script. exactly what my clam was talking about recently.