Spooky Spam Sweeper (for lolli)

For script writing
Post Reply
User avatar
wyli romesco
Spy vs. Pie
Posts: 81
Joined: Wed May 07, 2014 6:39 am

Spooky Spam Sweeper (for lolli)

Post by wyli romesco » Mon Nov 10, 2014 9:07 pm

Inbox getting clogged up with requests for aid from long-dead landed gentry? Never fear. This little routine will delete all NPC kmails, including those from Lady Whatsherfingers.

Code: Select all

import <zlib.ash>;

boolean deleteNPC (kmessage fromWhom)
{
	if (fromWhom.fromid == 0) return true;
	return false;
}

void main ()
{
	process_kmail ("deleteNPC");
}

User avatar
lostcalpolydude
Forum Maestro
Posts: 2940
Joined: Wed Apr 23, 2008 6:54 pm

Re: Spooky Spam Sweeper (for lolli)

Post by lostcalpolydude » Mon Nov 10, 2014 9:52 pm

That seems like it might eventually catch a message you care about. (My saved messages include a message from The Council of Loathing and Mother Goose. I think adding a check of fromWhom.message.contains_text( "something" ) would be good, but I don't know the contents of those kmails.
bmaher: Softcore character
lostcalpolydude: Hardcore character (abandoned)

User avatar
wyli romesco
Spy vs. Pie
Posts: 81
Joined: Wed May 07, 2014 6:39 am

Re: Spooky Spam Sweeper (for lolli)

Post by wyli romesco » Mon Nov 10, 2014 10:52 pm

lostcalpolydude wrote:That seems like it might eventually catch a message you care about. (My saved messages include a message from The Council of Loathing and Mother Goose. I think adding a check of fromWhom.message.contains_text( "something" ) would be good, but I don't know the contents of those kmails.
Fair comment that you might not want absolutely every single NPC message deleted. After a quick test I can confirm that the script will NOT delete [Saved] messages, only those in your Inbox. So, that should serve as a 'built-in' way to avoid deleting important mail.

littlelolligagged
Leader of Heck
Posts: 677
Joined: Tue Aug 23, 2011 10:42 am

Re: Spooky Spam Sweeper (for lolli)

Post by littlelolligagged » Tue Nov 11, 2014 10:20 am

Hooray, it worked beautifully!

User avatar
wyli romesco
Spy vs. Pie
Posts: 81
Joined: Wed May 07, 2014 6:39 am

Re: Spooky Spam Sweeper (for lolli)

Post by wyli romesco » Tue Nov 11, 2014 11:41 am

littlelolligagged wrote:Hooray, it worked beautifully!
Huzzah! :)

User avatar
cheesecookie
Inscrutable Pi
Posts: 260
Joined: Mon Nov 24, 2014 4:53 pm

Re: Spooky Spam Sweeper (for lolli)

Post by cheesecookie » Tue Nov 25, 2014 6:07 pm

Code: Select all


import <zlib.ash>;

boolean deleteNPC (kmessage fromWhom)
{
	if((msg.fromid == 0) && (contains_text(msg.message, "We found this telegram at the bottom of an old bin of mail.")))
	{
		return true;
	}
	if(msg.fromname == "Lady Spookyraven\\'s Ghost")
	{
		return true;
	}
	return false;
}

void main ()
{
   process_kmail ("deleteNPC");
}

This revision will be a bit more selective about what gets deleted so you don't have to worry about saving mail.

Post Reply