GiftBot

Donavin69

Member
GiftBot 0.3

Like a lot of scripts, I utilize ZLib (thanks Zarqon)

Thanks to my code contributors (even though they didn't know they did it) Bumcheekcity (crimbo gifter), Zarqon(randbot), Bale(candycredits)
And special thanks to Theraze for helping me get the chatbot part working!

This script will buy 1 Crimbo gift for each person talking in chat, it will automatically turn candy into credits with a limit on value/credit every 30 minutes.

To run this as a "chatbot" simply download it (and zlib if you don't have it) put them in your scripts folder, then at the CLI type
set chatbotScript = GiftBot.ash

To avoid any chance of multiabuse, make sure you edit this and modify it to blacklist your multies!

Any suggestions, let me know.

Revision History:
0.1 Initial release (Dec 20, 2011)
0.2 Check available credits before attempting to send, and turning in candy, only turn in candy if less than 5000 credits (also ignores PMs)
0.3 Rollover turn-in timer for new day, if too low to buy a gift, try to turn in.
 

Attachments

  • GiftBot.ash
    5.5 KB · Views: 71
Last edited:

Donavin69

Member
Is there a way to see this before trying to send a gift?

--10148: Detect when your desired victim already has a Crimbo present --
 

slyz

Developer
Nope. r10148 just means that when you try to buy a big present for someone, the purchase is not logged if the response text contains "already has one of those".

The only way of knowing if someone has a present is trying to send him one, anyway.
 
Last edited:

Donavin69

Member
That's what I thought....I just didn't want to be hitting the server for it if I didn't have to.

Thanks for the responses :)
 

slyz

Developer
Just so you know, you can get all kinds of information on a coinmaster by doing the following:
Code:
> ash $coinmaster[ Crimbo 2011 ]

Returned: Crimbo 2011
token => Candy Credit
item => none
property => availableCandyCredits
available_tokens => 11
buys => true
sells => true
In this case, the token (Candy Credit) isn't an item ($coinmaster[ Crimbo 2011 ].item = none), but $coinmaster[ Crimbo 2011 ].property will tell you which Mafia property will tell you the amount of tokens you currently have.

EDIT:

I overlooked it, but
PHP:
$coinmaster[ Crimbo 2011 ].available_tokens
is an easier way to access the amount of candy credits you have.
 

jwylot

Member
re your comment in the script "sometimes, for some reason, it sends 'none' filter out and give them a second chance", $item[5504] doesn't exist so this is fixable by removing line 100 and changing line 99 to "int x=random(6);".
 

Donavin69

Member
I had already fixed that in version 0.3, apparently didn't remove the comment.

I also changed it to random(9) and gave the '30 credit' items double chance...

Thanks though!
 

Donavin69

Member
I'm not sure if it can monitor the others, but I would assume that if you change (or add) the line that specifies /clan, it should monitor others.
PHP:
	if(channel == "/clan") {
		vPrint("Checking gift status for: "+Sender,6);
		if (get_credits() < 2500) {
			turn_in_candy();
			set_property("GiftBot_LastTurnIn", now_to_string("HHmm"));
		}
		CrimboGifter(Sender);
	}

You could add a section after that that would read something like
PHP:
	if(channel == "/newbie") {
		vPrint("Checking gift status for: "+Sender,6);
		if (get_credits() < 2500) {
			turn_in_candy();
			set_property("GiftBot_LastTurnIn", now_to_string("HHmm"));
		}
		CrimboGifter(Sender);
	}
 
Last edited by a moderator:

jwylot

Member
erm I think that mafia's chatbot function is limited to /clan, possibly to avoid easy spamming of /newbie etc but I may be wrong.
 
Top