Request (with reward!) - Item Distribution script

fortyforks

New member
I was hoping someone could write a script for me. I'm looking for something that will respond to specific PMs with a kmail containing items (with a once-per-day limit). Like for example, say it receives a PM saying "beer" and it would kmail the sender a can of Sir Schlitz.

I'd be happy to reward/pay with meat! Not sure what the going rate is for this type of thing... a million meat maybe?

There's a few other little things I'd like it to do, but that would be the main function. If anyone would be willing to do this, leave/send me a message and I'll send you some more details.

Thanks!

-ff
 
Last edited:

mredge73

Member
Kmail or Chat PM? Bot script or Run once script?
Framework for both exist on the forum so creating this would just be copy/paste for the most part.
Specifics would help for the more difficult parts such as matching keywords to items.

FYI:
Typical hire rate for a scripter is 1 Mr. Accessory
 
Last edited:

heeheehee

Developer
Staff member
PM generally means PM, especially since the OP used kmail to mean what kmail means. I'd say the easiest way to approach this is to write a quick chatbot script and import zarqon's zlib.ash, which has the handy kmail() function.

PHP:
import <zlib.ash>
int [item] map;
map[$item[sir schlitz]] = 1;
void main(string sender, string message) {
    if (message == "beer")
        kmail(sender, "Here's some schlitz!", 0, map);
}

Alternatively, if you wanted, you could build a map that maps keyword to sent stuff, then use the following framework:
PHP:
import <zlib.ash>
int [string, item] map;
map["beer", $item[sir schlitz]] = 1;
map["clovers", $item[disassembled clover]] = 1; // you can add multiple items to the same
map["clovers", $item[ten-leaf clover]] = 1;    // key, and it'll work as you expect it to.
void main(string sender, string message) {
    if (map contains message)
        kmail(sender, "Here's some stuff!", 0, map[message]);
}
 
Last edited:

slyz

Developer
Be careful, Heeheehee's examples are just that - examples. They don't limit the number of requests per user, which is something you might want. It's a very good basis to start with, though.
 
Last edited:

heeheehee

Developer
Staff member
Yeah, if you wanted to limit the uses per user, I'd suggest using a datafile to keep track of that, presumably returning date of last use. For 1/day, extend the main() function as such:
PHP:
void main(string sender, string message) {
    int[string, string] used;
    file_to_map("used.txt", used);
    if (used[sender, message] != today_to_string())
        if (map contains message) {
            kmail(sender, "Here's some stuff!", 0, map[message]);
            used[sender, message] = today_to_string();
        }
    map_to_file(used, "used.txt");
}
 
Top