aliases

Okay, I decided I disliked like the whole thing and recommend you use the following shorter, simpler and faster alias instead:

Code:
alias advent => ashq if(substring(today_to_string(), 4, 6) == "12") { matcher advent = create_matcher("(campground.php\\?preaction=openadvent&whichadvent=\\d+)>", visit_url("campground.php?action=advent")); while(advent.find()) visit_url(advent.group(1)); }

Note: I use that in my loginScript, not as an alias, but the same principle works. I don't really think that the date check is necessary for an alias since you're not going to run it when you don't have an advent calendar. You like that part though, so I left it in the alias. It doesn't hurt anything after all...
 
It's been a while since anyone posted in this thread. Here's an alias I use to eat fortune cookies. First it prevents user error by checking that I didn't already eat a cookie. (It would be unfortunate to eat a cookie when it isn't helpful.) Then it buys and eats the cookie. Finally it prints out my fortune, since sometimes they are amusing. I actually wrote the alias because I wanted to see my fortunes without having to eat them in the relay browser. I added the check to see if I already had a cookie counter after an unfortunate accident which I did not want to experience a second time.


Code:
alias fc => ashq if(length(get_counters("Fortune Cookie", 0, 200)) == 0) {if(my_fullness() < fullness_limit()) {retrieve_item(1, $item[fortune cookie]); matcher fortune = create_matcher("cellpadding=10><tr><td>(.*?)<p>", visit_url("inv_eat.php?pwd&ajax=1&which=1&whichitem=61")); if(find(fortune)) print_html("<br><font color='green'>"+fortune.group(1)+"<font>");} else print("Too stuffed to eat a fortune cookie!", "red");} else print("You've already eaten a Fortune Cookie!", "red");
 
Last edited:
Note: I use that in my loginScript, not as an alias, but the same principle works. I don't really think that the date check is necessary for an alias since you're not going to run it when you don't have an advent calendar. You like that part though, so I left it in the alias. It doesn't hurt anything after all...

Just noted the note due to your new post. I leave that in my loginScript year round as well, and the date check helps keep me from wasting server hits 11 months out of the year. :) So it is necessary, but... yeah, not strictly so if you're only using it as an alias.
 
I've got a really simple little alias I use to make my life a lot easier as an Avatar of Sneaky Pete. I find myself having to pop and unpop my collar a lot. For anyone else who wants to cut the typing for that act down to three letters, try this:

Code:
alias pop => ashq if(available_amount($item[Sneaky Pete's leather jacket (collar popped)]) == 0) cli_execute("fold Sneaky Pete's leather jacket (collar popped)"); else if(available_amount($item[Sneaky Pete's leather jacket]) == 0) cli_execute("fold Sneaky Pete's leather jacket");

I could definitely manage to make that more robust, but as long as I don't try to pop my collar when I have neither form of the Jacket, it won't have an error.
 
I could definitely manage to make that more robust, but as long as I don't try to pop my collar when I have neither form of the Jacket, it won't have an error.

Just curious - but why make this an alias instead of a small ash script named pop.ash?
Is this just a convenience issue of trying to avoid too many small scripts?
 
Just curious - but why make this an alias instead of a small ash script named pop.ash?
Is this just a convenience issue of trying to avoid too many small scripts?

ASH scripts will show up in the MRU list, if enabled. You can have your convenience commands push the useful scripts off the list. That's bad.
You can easily see what your aliases are and what they do by simply typing alias. This is much easier than opening a text editor to check what, exactly, your 251 scripts do, and which one was a specific script for something. And yes, I do need to clear out my scripts folder at some point.
Aliases allow for using scripts, whether gCLI or ASH, without needing to worry as much about how well they import and play with other scripts. It's not a guarantee that it will work, but any sand-boxing you can do decreases the chance of shared variable names.
If you have weird file permissions that allow you to edit existing files but not add new ones, as a moderate scattering of users appear to have, then you can still add aliases since you're editing existing files.

There are more reasons, but ultimately the choice is yours. Want it as a script? Go for it. Personally I like aliases when possible. Point of personal preference. *shrugs*
 
I lost the battle with my obsession. I made the collar popping alias needlessly robust. :(

Code:
alias pop => ashq item unpop = $item[Sneaky Pete's leather jacket]; item popped = $item[Sneaky Pete's leather jacket (collar popped)]; string choice; if(available_amount(popped) == 0 && available_amount(unpop) > 0) choice = popped; else if(available_amount(popped) > 0) choice = unpop; if(choice == $item[none]) print("You do not have a collar you can pop.", "red"); else cli_execute("fold "+choice);
 
Last edited:
For the DNA stuff, it is nice to know which monsters are which phylum, and where to find them. I wrote this to list monsters and locations for a given phylum:

Code:
alias phyl => ashq phylum pp=(to_phylum(to_lower_case($string[%%]))); print("Phylum: "+pp,"blue"); foreach ll in $locations[] { foreach ii,mm in get_monsters(ll) { if (mm.phylum==pp) { print(ll+" => "+mm); } } }
 
/me waves "howdy"

Back after a 2.5 yr break. All my old scripts lost. I looked clean thru this thread and zarqon mentions [prefref] but I don't see the actual alias in this thread. Could someone please post prefref please?
 
My personal version of prefref also allows me to use it as a set command so that I can set preferences without using their entire name or correct capitalization as long as I match a single preference:

Code:
alias prefref => ashq record r{string d;};r[string,string] m; string[int]a; file_to_map("defaults.txt",m); matcher s = create_matcher("(\\w+)(\\s=*\\s*([\\w\\.]+))?",$string[%%]); if(find(s)){foreach t,p,d in m if(to_lower_case(p).contains_text(to_lower_case(s.group(1)))) {print(p+" ("+t+(get_property(p)==d.d? ": ":": now '"+get_property(p)+"', default ")+d.d+")"); a[count(a)] = p;}if(s.group(2)!=""){if(count(a)==1)set_property(a[0],s.group(3));else print("You do not match exactly one preference!","red");}}else print("Invalid parameters","red");
 
Last edited:
It can be a PITA to use a GameInformPowerDailyPro magazine to get an SGEEA and assorted scrolls from a dungeoneering kit. I've been automating the process with my getkit alias. It uses the magazine, adventures once in the newly opened dungeon (0 adventure cost) and then uses the new kit for me.

Code:
alias getkit => ashq item mag = $item[GameInformPowerDailyPro magazine]; item kit = $item[dungeoneering kit]; if(item_amount(mag) > 0) {visit_url("inv_use.php?pwd&whichitem=6174&confirm=Yep."); cli_execute("inv refresh"); adv1($location[Video Game Level 1], -1, ""); int x = available_amount(kit); if(x > 0) use(x, kit);} else print("You need another "+mag+" to get another "+kit, "red");
 
Couple uses for Heavy Rains, printing out the locations you can adventure in to get the skill you desire.
Code:
alias lightningSkill => ashq import <canadv.ash> foreach loc in $locations[] { int depth = 1; switch(loc.environment){ case "underground": depth += 2; case "indoor": depth += 2; default: break; } if (loc.recommended_stat >= 40) depth += 1; if (have_effect($effect[Personal Thundercloud])>0) depth += 2; if (have_effect($effect[The Rain in Loathing])>0) depth += 2; if (loc.environment == "outdoor" && can_adv(loc) && depth >= 6){ print(loc); } }
alias rainSkill => ashq import <canadv.ash> foreach loc in $locations[] { int depth = 1; switch(loc.environment){ case "underground": depth += 2; case "indoor": depth += 2; default: break; } if (loc.recommended_stat >= 40) depth += 1; if (have_effect($effect[Personal Thundercloud])>0) depth += 2; if (have_effect($effect[The Rain in Loathing])>0) depth += 2; if (loc.environment == "indoor" && can_adv(loc) && depth >= 6){ print(loc); } }
alias thunderSkill => ashq import <canadv.ash> foreach loc in $locations[] { int depth = 1; switch(loc.environment){ case "underground": depth += 2; case "indoor": depth += 2; default: break; } if (loc.recommended_stat >= 40) depth += 1; if (have_effect($effect[Personal Thundercloud])>0) depth += 2; if (have_effect($effect[The Rain in Loathing])>0) depth += 2; if (loc.environment == "underground" && can_adv(loc) && depth >= 6){ print(loc); } }
 
Couple uses for Heavy Rains, printing out the locations you can adventure in to get the skill you desire.
Code:
alias lightningSkill => ashq import <canadv.ash> foreach loc in $locations[] { int depth = 1; switch(loc.environment){ case "underground": depth += 2; case "indoor": depth += 2; default: break; } if (loc.recommended_stat >= 40) depth += 1; if (have_effect($effect[Personal Thundercloud])>0) depth += 2; if (have_effect($effect[The Rain in Loathing])>0) depth += 2; if (loc.environment == "outdoor" && can_adv(loc) && depth >= 6){ print(loc); } }
alias rainSkill => ashq import <canadv.ash> foreach loc in $locations[] { int depth = 1; switch(loc.environment){ case "underground": depth += 2; case "indoor": depth += 2; default: break; } if (loc.recommended_stat >= 40) depth += 1; if (have_effect($effect[Personal Thundercloud])>0) depth += 2; if (have_effect($effect[The Rain in Loathing])>0) depth += 2; if (loc.environment == "indoor" && can_adv(loc) && depth >= 6){ print(loc); } }
alias thunderSkill => ashq import <canadv.ash> foreach loc in $locations[] { int depth = 1; switch(loc.environment){ case "underground": depth += 2; case "indoor": depth += 2; default: break; } if (loc.recommended_stat >= 40) depth += 1; if (have_effect($effect[Personal Thundercloud])>0) depth += 2; if (have_effect($effect[The Rain in Loathing])>0) depth += 2; if (loc.environment == "underground" && can_adv(loc) && depth >= 6){ print(loc); } }

You could simplify that with int depth = loc.water_level + numeric_modifier("Water Level");

Code:
alias lightningSkill => ashq import <canadv.ash> foreach loc in $locations[] {int depth = loc.water_level + numeric_modifier("Water Level"); if (loc.environment == "outdoor" && can_adv(loc) && depth >= 6) print(loc); }

alias rainSkill => ashq import <canadv.ash> foreach loc in $locations[] {int depth = loc.water_level + numeric_modifier("Water Level"); if (loc.environment == "indoor" && can_adv(loc) && depth >= 6) print(loc); }

alias thunderSkill => ashq import <canadv.ash> foreach loc in $locations[] {int depth = loc.water_level + numeric_modifier("Water Level"); if (loc.environment == "underground" && can_adv(loc) && depth >= 6) print(loc); }
 
Last edited:
Hey, just came across this thread and figured I'd post an alias I just wrote. If you use OCD Inventory Control and have PriceAdvisor then you can use this alias to show PriceAdvisor's advice for all your currently uncategorized items.

You have to first have the PriceAdvisor alias set.
Code:
 alias pa => ash import <PriceAdvisor.ash> print(price_advisor($items[%%], true))

Code:
alias paocd => ashq import <zlib.ash> record ocd_data { string act; int keep; string info; string message; }[item] ocdata; if (!file_to_map("OCDdata_"+vars["BaleOCD_DataFile"]+".txt",ocdata) || count(ocdata) == 0) file_to_map("OCD_"+my_name()+".txt",ocdata); foreach it in get_inventory() { if ((ocdata contains it) || (it.quest == true)) continue; else cli_execute("pa "+it+""); }

Unfortunately, I can't figure out how to not use the pa alias but still print it out with the pretty formatting.
 
Last edited:
Wild guess... that script won't actually work without the 'pa' alias that it calls.

Personally, I still use Zarqon's old PAtoOCD.ash script for that. :)
 
Yeah, I assumed if people have PriceAdvisor then they have put the Alias it tells you to use.

The difference between PAtoOCD.ash and the paocd alias is the alias doesn't change any settings, just gives you the info about the items, which I prefer. Then I get to choose what I want OCD to do with it rather than having options automatically selected which may or may not be the best course of action based on market trends and item movement.
 
My personal version of prefref also allows me to use it as a set command so that I can set preferences without using their entire name or correct capitalization as long as I match a single preference:

Since prefref is now an innate part of KoLmafia, I recommend that this now be used as a prefset alias.

Code:
alias prefset => ashq record r{string d;};r[string,string] m; string[int]a; file_to_map("defaults.txt",m); matcher s = create_matcher("(\\w+)(\\s=*\\s*([\\w\\.]+))?",$string[%%]); if(find(s)){foreach t,p,d in m if(to_lower_case(p).contains_text(to_lower_case(s.group(1)))) {print(p+" ("+t+(get_property(p)==d.d? ": ":": now '"+get_property(p)+"', default ")+d.d+")"); a[count(a)] = p;}if(s.group(2)!=""){if(count(a)==1)set_property(a[0],s.group(3));else print("You do not match exactly one preference!","red");}}else print("Invalid parameters","red");
 
Back
Top