What's in your login/logout scripts?

Here's a little bit to make the most of my Reagnimated Gnome, so that I don't ever forget to get the daily bodypart. The kgnee is what I usually want, so I make sure to get it first and equip it.

Code:
int gnome() {
	// Ensure that you have body parts with the following priority. Otherwise snag the kgnee
	foreach i in $items[gnomish housemaid's kgnee, gnomish coal miner's lung, gnomish athlete's foot, gnomish swimmer's ears, gnomish tennis elbow]
		if(available_amount(i) < 1) return (to_int(i) - 5767);
	return 4;
}

// Get body part for Reagnimated Gnome every day
if(have_familiar($familiar[Reagnimated Gnome])) {
	familiar f = my_familiar();
	use_familiar($familiar[Reagnimated Gnome]);
	visit_url("arena.php");
	visit_url("choice.php?pwd&whichchoice=597&option="+gnome());
	if(equipped_item($slot[familiar]) == $item[none])
		equip($item[gnomish housemaid's kgnee]);
	use_familiar(f); // Restore original familiar
}

I've got that in my once a day section so that it won't happen more than once even if I log in again.
 
My simple logout script. This first checks to see if I am overdrunk, then checks to see if I have a disembodied hand, and if so switches to it before maximizing adventures. Otherwise, it simply maximizes adventures. If I am NOT overdrunk, it does nothing.

EDIT: Whoopsie, forgot to close a parenthesis.

PHP:
if(my_inebriety() > inebriety_limit()) 
{
	if (have_familiar($familiar[Disembodied Hand]))
	{
		cli_execute("maximize adv, switch disembodied hand");
	}
	else
	{
		cli_execute("maximize adv");
	}
}
 
Last edited:
Solid shifting time weirdness works on a disembodied hand. It's just the hatrack and pantsrack that it fails with.

There's an entirely different matter which irritates me about that code. It could be simplified to

PHP:
if(my_inebriety() > inebriety_limit()) 
{
		maximize("adv, switch disembodied hand", false);
}

You see, the "switch" keyword will tell mafia to consider IF the disembodied hand will improve your maximization and switch to it only if necessary. So if you don't have the disembodied hand it won't try to swtich to it and it won't trouble you about it.
 
Solid shifting time weirdness works on a disembodied hand. It's just the hatrack and pantsrack that it fails with.

There's an entirely different matter which irritates me about that code. It could be simplified to

PHP:
if(my_inebriety() > inebriety_limit()) 
{
		maximize("adv, switch disembodied hand", false);
}

You see, the "switch" keyword will tell mafia to consider IF the disembodied hand will improve your maximization and switch to it only if necessary. So if you don't have the disembodied hand it won't try to swtich to it and it won't trouble you about it.
An ASH newbie is me! Thanks for the tip, Bale.
 
So, do the other familiar items not work on a Hatrack / Pantsrack either, or is it just this one? If it's just this one, then I guess it sounds like a KoL bug that it can be equipped but doesn't provide the bonus. If it's all of them then it's probably a KoL bug that they can be equipped, but we can more easily stop maximizer equipping all familiar items on them.
 
Code:
if(substring(today_to_string(), 4, 6) == "12") {
	    string advent = visit_url("campground.php?action=advent");
	    while(advent.contains_text("left to punch out right now"))
	         advent = visit_url("campground.php?preaction=openadvent");
		}
This doesn't work for me. I just found it on this forum the other day, and decided to try it out.
 
Code:
if(substring(today_to_string(), 4, 6) == "12") {
        string advent = visit_url("campground.php?action=advent");
        while(advent.contains_text("left to punch out right now"))
             advent = visit_url("campground.php?preaction=openadvent");
        }
This doesn't work for me. I just found it on this forum the other day, and decided to try it out.


This has been working for me:

Code:
//advent calendar
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));
}

I think Bale wrote it, but I don't really know. I've had it a long time.
 
This has been working for me:

Code:
//advent calendar
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));
}

I think Bale wrote it, but I don't really know. I've had it a long time.

Worked like a dream, thanks much!
 
I think Bale wrote it, but I don't really know. I've had it a long time.

Ayup! That's mine. It's changed just a bit since then to reduce server hits on successive logins.

Code:
	if(substring(today_to_string(), 4, 6) == "12" && get_property("_loginCrimboCheck") == "") {
		matcher advent = create_matcher("(campground.php\\?preaction=openadvent&whichadvent=\\d+)>", visit_url("campground.php?action=advent"));
		while(advent.find()) visit_url(advent.group(1));
		set_property("_loginCrimboCheck", "done");
	}
 
Ayup! That's mine. It's changed just a bit since then to reduce server hits on successive logins.

I have it in a section of my script that only runs once per day. But, thanks for the update anyway ! You're a regular Crimbo elf ! :p I guess that makes Veracity Aunt Crimbo ? lol
 
I have it in a section of my script that only runs once per day. But, thanks for the update anyway ! You're a regular Crimbo elf ! :p I guess that makes Veracity Aunt Crimbo ? lol

I used to have a section like that, but I changed so that if one part aborted I could re-run it without concern.
 
I tend to have relatively small sections under prop control ... and I still have about a billion custom props in my settings file. 11+ years of this game really adds up to a lot of code !
 
Back
Top