bumCrimbo11.ash - Send one of each present to somebody!

bumcheekcity

Active member
bumcheekcity's bumCrimbo11.ash 0.1

This script will send one of each item to a comma-separated list of character names. Heart away!

HOW DO I USE THIS?
Simply type the following into the CLI:
Code:
bumcrimbo11v0.1 bumcheekcity, jick, mr skullhead

Basically, comma-separate a list of names, and it'll send one of each item to everyone.


0.1 - Send one of each item to a comma-separated list of character names.

Download files from the SourceForge page - this does not require registration!
 
Last edited:
Thank you for the script. I noticed a bug in it: if you can't afford an item, the script still reports that you sent it.

(Note: if you can't afford an item, visit_url returns a buffer containing the substring, "Your fingers are writing checks that your Crimbo Credit Balance can't cash.")

PS: There's another, more minor, bug. The script tries to give the player item 5504, which doesn't exist.
 
Last edited:

jwylot

Member
This is nice, thanks BC. I don't suppose anyone has included this in a script which parses the clan roster, maybe removing "inactives" ? By the time I come up with something workable, crimbo will be long gone.
 

Bale

Minion
I would like to suggest a change to main(). The chat effect is simply too appropriate to not use.

Code:
void main(string usernamelist) { 
	
	string [int] usernames = split_string(usernamelist, ",");
	string success;
	item prev_weap = $item[none];

	try {
		if(available_amount($item[origami riding crop]) > 0 && !have_equipped($item[origami riding crop])) {
			prev_weap = equipped_item($slot[weapon]);
			equip($item[origami riding crop]);
		}
	
		foreach i in usernames {
			if (!alreadySentTo(usernames[i])) {
				success = "";
				foreach j in $ints[5505,5506,5507,5508,5509,5510] {
					success = success+send(usernames[i], j);
				}
				set_property("bumcheek_crimbo11_sentto_"+usernames[i]+"_"+today_to_string(), success);
				//chat_private(usernames[i], "You've received some gifts from me courtesy of bumcheekcity's Crimbo11 Script! Merry Crimbo!"); 
			} else {
				print("BCC: "+usernames[i]+" has already received items.", "blue");
			}
		}
	
	} finally
		if(prev_weap != $item[none]) equip(prev_weap);
}
 

BlanketThief

New member
Would be nice if that small issue in line 36 got fixed.
Code:
foreach j in $ints[5500,5501,5502,5503,5504,5505,5506,5507,5508,5509,5510]
5504 isn't currently valid, so the script currently never reaches the stocking stuffers portion.
 

Bale

Minion
This script is massively buggy! The biggest problem is that it generates broken properties to keep track of your sending. There are a few other less significant bugs I fixed as well for my own use. Here's a fixed version:

Code:
/*
	bumcheekcity's bumCrimbo11.ash
	
	0.1 - Send one of each item to a [list of] usernames.
*/

script "bumcrimbo11.ash";
notify bumcheekcity;

boolean [int] gifts = $ints[5505,5506,5507,5508,5509,5510];

string strip(string u) {
	return u.replace_string(" ", "").to_lower_case();
}

boolean alreadySentTo(string username) {
	if(strip(username) == strip(my_name())) return true;
	string prop = get_property("bumcheek_crimbo11_sentto_"+strip(username)+"_"+today_to_string());
	if(prop == "") return false;
	foreach j in gifts
		if(!prop.contains_text(to_string(j))) return false;
	return prop != "";
}

string send(string username, int i) {
	string page = visit_url("crimbo11.php?action=reallybuygifts&howmany=1&towho="+username+"&whichitem="+i+"&pwd=");
	if	(contains_text(page, "already has one of those")) 
	{ 
		print(username+" already has a "+to_string(to_item(i)), "red"); 
	} else if(contains_text(page, "My elves will stuff that stocking just right, okay?")) { 
		print(username+" just got a "+to_string(to_item(i)), "green"); 
		return to_string(i)+",";
	} 
	return "";
}

void main(string usernamelist) { 
	
	string [int] usernames = split_string(usernamelist, ",");
	string success;
	item prev_weap = $item[none];

	try {
		if(available_amount($item[origami riding crop]) > 0 && !have_equipped($item[origami riding crop])) {
			prev_weap = equipped_item($slot[weapon]);
			equip($item[origami riding crop]);
		}
	
		foreach i,n in usernames {
			if (!alreadySentTo(n)) {
				success = get_property("bumcheek_crimbo11_sentto_"+strip(n)+"_"+today_to_string());
				foreach j in gifts {
					if(!success.contains_text(to_string(j)))
						success = success+send(n, j);
				}
				set_property("bumcheek_crimbo11_sentto_"+strip(n)+"_"+today_to_string(), success);
				//chat_private(usernames[i], "You've received some gifts from me courtesy of bumcheekcity's Crimbo11 Script! Merry Crimbo!"); 
			} else {
					print("BCC: "+n+" has already received items.", "blue");
			}
		}
	
	} finally
		if(prev_weap != $item[none]) equip(prev_weap);
}

At the top is a list of gifts you are going to send. I removed the big gifts from that list.
 

bumcheekcity

Active member
I actually just got bored of tracking sending and had alreadySentToday() return false all the time.

Unfortunately, Christmas happened and customising this script is left as an exercise for the user.
 

sleepy g

Member
Could anyone offer any suggestions that would allow me to send the stocking stuffers multiple times in a day to a single player? Or are we not allowed to do that??
 

sleepy g

Member
Could anyone offer any suggestions that would allow me to send the stocking stuffers multiple times in a day to a single player? Or are we not allowed to do that??

OK... I guess we are only allowed to stuff a person once per day.. I guess I need to focus on how to modify the script to send multiples of an item to a player.
 

bumcheekcity

Active member
Change the first function from:

Code:
boolean alreadySentTo(string username) {
	return get_property("bumcheek_crimbo11_sentto_"+username+"_"+today_to_string()) != "";
}

Code:
boolean alreadySentTo(string username) {
	return false;
}
 
Top