A couple miscellaneous questions

Malurth

Member
1. I can't think of a good way to refer to an item set containing all the items in your closet. I'd like to make a script to simply throw everything in my closet into my mall store, but short of checking every item in the game against my closet contents I don't know how. This is kind of annoying as I can just type in "closet" and the GCLI will list them all, but I can't think of a way to convert that into an item set in-code. Suggestions pls?

2. How should I be figuring out what exactly the URLs are to visit with visit_url? My only two methods are to view frame source or hope I can find someone else's script that refers to the url/url format I want. This is especially a problem with the buttons on pages, since they don't clearly indicate what URL will be visited by clicking them. For example, I'd like to make my post-Ascension script auto-get all 30 AoSP skills and then cast Check Mirror > Pompadour, but I'm too clueless.

Thanks!
 

Bale

Minion
1. I actually recommend checking every item in the game against your closet contents. It's not hard if you do it like this...

Code:
int [item] my_closet;
foreach it in $items[]
   if(closet_amount(it) > 0)
      my_closet[it] = closet_amount(it);

2. I recommend viewing the frame source as you have been doing. It can be a pita sometimes, but it works. Sometimes you can get the answer by using the min-browser (General -> Mini-Browser), but it doesn't always work.

BTW, I already know the answer for the first example you posit since I use it in my newLife script. I got it by viewing the html source code.

Code:
visit_url("choice.php?whichchoice=867&pwd&option=4"); // All 10 Loveable Rogue
visit_url("choice.php?whichchoice=867&pwd&option=5"); // All 10 Motorcycle Guy
visit_url("choice.php?whichchoice=867&pwd&option=6"); // All 10 Dangerous Rebel
 

Winterbay

Active member
Getting the URL from an action in KOL can be done relatively fast and easy by using the mini-browser and performing the action and then noticing what the resulting URL in the browser address bar is.
 

Malurth

Member
Thanks a ton guys. These responses are very helpful.

And I viewed the source code for that page but didn't know that

Code:
<form action=choice.php method=post style='display: inline;'><input type=hidden name=option value=4><input type=hidden name=whichchoice value=867><input type=hidden name=pwd value=blahblahblah><input type=submit class=button value="Get All 10!"></form>

would convert into
Code:
visit_url("choice.php?whichchoice=867&pwd&option=4");
:p I'll keep this in mind!
 

Bale

Minion
Note that it is just &pwd instead of &pwd=blahblahblah because KoLmafia will automatically fill in the value of the password hash. (Password hash is different every single time you log in, so this is a nice feature.)
 

Bale

Minion
Right. And I gotta use my_hash() for relay scripts for some reason, as you've previously informed me. :p

The reason for that is because when you create a relay script you're not using visit_url(). Instead you are embedding the link directly into the page's URL in the relay browser. So if you click on a link, mafia doesn't care if it put that link there, it only knows that it needs to do what the html says. It makes sense, but it can be confusing.
 
Top