Odd Options such as Spirit Hobo Feeding

Keldi

New member
Heya!

I'm a new scripter; Hardcore Teetotaler Seal Clubber in game. I've been making some pretty basic scripts, but I'm totally stumped on one thing:

My Spirit Hobo, Foul Ol' Ron.

Is there currently a method to keep him lubricated via the CLI or scripting? If I don't keep the hooch flowing he starts to make grinding noises and tries to bite passersby, so it's advantageous to make an easy method for him to remain incoherant.

If I'm overlooking something astoundingly obvious, please tell me! I don't have much I can send in terms of payment, being on a Hardcore run and all, but I'll do my best to compensate you for your time.

-Keldi
 

Tirian

Member
Tell you what. Open up the minibrowser, feed the spirit hobo, and copy the url of the response page. Then tell us what that is and we can probably write a function that will allow you to feed any drink to the hobo.
 
See now this request is a fair one. I'll just point out that we might want to know what you gave the spirit when you obtained the url. Most kol urls are simple enough to understand, but knowing which item for verification purposes will help. What we would do is check the item number of the item you gave the hobo spirit against a number in the url to be sure we are reading the url right.
 

Keldi

New member
Sorry for the delay on response, been out of town.

From my web browser, it looks like the link is:

http://www3.kingdomofloathing.com/inventory.php?pwd=(pwd)&action=hobo&which=1&whichitem=41
...to feed him an Ice Cold Sir Schlitz.

http://www3.kingdomofloathing.com/inventory.php?pwd=(pwd)&action=hobo&which=1&whichitem=180
...for an Ice Cold Fotie.

http://www3.kingdomofloathing.com/inventory.php?pwd=(---)&action=hobo&which=1&whichitem=470
...for an Imp Ale.

So looks like it's a pretty simple URL... I don't know how I'd handle that via a script though.

Thanks for the help!

-Keldi
 

Tirian

Member
Always glad to help!

Like you say, this is a pretty regular URL. The number at the end is the item number, which you can find from paging through the KOL Encyclopedia which is part of the Help menu. For instance, if you look up Imp Ale, you'll see that it is item #470. Just saying that for illumination.

Anyway, here is a function that you can paste into your scripts:

Code:
void feed_hobo (item booze)
{
  string command = "inventory.php?pwd&action=hobo&which=1&whichitem=";
  cli_execute(command + item_to_int(booze));
}

That's something to try first anyways. I suspect that the actual password is unneeded since I've never seen it used before, but if things go wrong, it'll be something that might actually need to be there. (Just to check that, you can type the URL into the minibrowser and delete out the =password part to see if you wind up feeding your hobo.)

If you're feeling rebelious, you also might try typing the URL into your minibrowser except using 471 instead of 470. This will try feeding your Spirit Hobo a hot wing instead of booze. If you get a successful message, then you'll have something to do with all of your Trollhouse cookies and Sand Witch sammiches too. ;)
 
[quote author=Tirian link=topic=244.msg1392#msg1392 date=1152293834]
Always glad to help!

Like you say, this is a pretty regular URL.  The number at the end is the item number, which you can find from paging through the KOL Encyclopedia which is part of the Help menu.  For instance, if you look up Imp Ale, you'll see that it is item #470.  Just saying that for illumination.

Anyway, here is a function that you can paste into your scripts:

Code:
void feed_hobo (item booze)
{
   string command = "inventory.php?pwd&action=hobo&which=1&whichitem=";
   cli_execute(command + item_to_int(booze));
}

That's something to try first anyways.  I suspect that the actual password is unneeded since I've never seen it used before, but if things go wrong, it'll be something that might actually need to be there.  (Just to check that, you can type the URL into the minibrowser and delete out the =password part to see if you wind up feeding your hobo.)

If you're feeling rebelious, you also might try typing the URL into your minibrowser except using 471 instead of 470.  This will try feeding your Spirit Hobo a hot wing instead of booze.  If you get a successful message, then you'll have something to do with all of your Trollhouse cookies and Sand Witch sammiches too.   ;)
[/quote]

Kolmafia automattically adds your password hash just after the string "pwd=" I am not certain if it will work for just "pwd" so if tirian's function does not work then this should.

Code:
void feed_hobo (item booze)
{
  string command = "inventory.php?pwd=&action=hobo&which=1&whichitem=";
  cli_execute(command + item_to_int(booze));
}
 

Nightmist

Member
Just curious now, but any particular reason you people define the url in a variable string and then use that variable instead of just having a single cli execute? (I also see none of you have a habit of adding "./" to the front of your raw urls, hahah guess its just something I do)
 
[quote author=Nightmist link=topic=244.msg1395#msg1395 date=1152329601]
Just curious now, but any particular reason you people define the url in a variable string and then use that variable instead of just having a single cli execute? (I also see none of you have a habit of adding "./" to the front of your raw urls, hahah guess its just something I do)
[/quote]

The reason for the variable containing the string for the url is readability. Placing the url into a cli_execute command, and adding the item number is harder to read, and thus harder for a newb to script writing to understand.

adding ./ to the begining is an extra step, but it also may help with readability.
 

Tirian

Member
[quote author=Nightmist link=topic=244.msg1395#msg1395 date=1152329601]
Just curious now, but any particular reason you people define the url in a variable string and then use that variable instead of just having a single cli execute? (I also see none of you have a habit of adding "./" to the front of your raw urls, hahah guess its just something I do)
[/quote]

In general, I like defining $command just in case I ever want to print it in addition to executing it for debugging purposes. And then I punted and stuck the item in the cli_execute because I didn't want any of the lines to get too long. :)
 

Veracity

Developer
Staff member
[quote author=efilnikufecin link=topic=244.msg1394#msg1394 date=1152319653]
Code:
void feed_hobo (item booze)
{
   string command = "inventory.php?pwd=&action=hobo&which=1&whichitem=";
   cli_execute(command + item_to_int(booze));
}
[/quote]

FWIW, I would just do this:

Code:
void feed_hobo (item booze)
{
   cli_execute("inventory.php?pwd=&action=hobo&which=1&whichitem=" + item_to_int(booze));
}

If I'm not going to use the intermediate result, I'd just as soon not put it into a variable, since I think it is more readable if you don't have extra assignments. Others find it more readable to show your calculations step by step. Obviously, opinions vary. :)
 
Thread necro.

I'm doing a predominantly Green Ghost run, and have been using the relay browser to keep him fed. I was wondering if there was some way I could use gCLI commands to save me the tedium of clicking over to my inventory page each time I wanted to give him food. My search turned up this thread, and from it, I've been able to figure out how to write an ASH function to do that, and, from what I understand, if I import that function into my namespace, that should allow me to do what I want to do. So my problem is solved (or will be, once I do the work).

But that made me wonder, and I have a proposed feature request. Here it goes -- if you have a Ghost or Hobo as your active familiar, and you go to the Item Manager, in the "Usable - Food" (for Ghost) and "Usable - Booze" (for Hobo), KoLmafia would add an additional button in the upper grouping ("Feed Familiar" or something similar), that allows you to feed the food/booze to your familiar, in addition to "Consume" and "Create" buttons.
 

Veracity

Developer
Staff member
Interesting. I see that there is a "hobo" command that is like "drink" but gives the booze to your hobo.
Can't say I've ever used a GGG. I gather it's the same as a hobo, but for food?
If so, then we probably need a "ghost" command that is like "eat" but gives the food to your ghost.

I like your idea for the item manager, too.

Edit:

I added a "ghost <optional count> <food item>" command which feeds a ghost.
Neither the hobo nor the ghost command checks your own inebriety/fullness to determine if it's possible.
And they have different messages from "eat" and "drink", rather than saying "Eating xxx" or "Drinking xxx".

Thanks for bringing this to my attention. :)
 
Top