Added the tree scripts, w/ comments
[ProgettoPaperellaDiGomma.git] / moneySensor.lsl
blob739d8a613c8c89992c7e1d77607f9af0774e2ca0
1 //originally written by Davide Byron
2 //this code is released under the GPLv3
3 //
4 // Produces E_MONEY_QTY_KEY event
5 // Money has been given to the creature, the amount is passed as a string and the giver as a key
6 //
7 // here we're messing with people money, and it's really fair if we promise them the creature will
8 // reproduce with the money they give to it and it doesn't what expected.
9 // so a creature carrying this script should be always carry an energy script too and a robust way of reproduction.
10 // if the Lindens are really going to put in work the patch allowing to pay 0L$ that sum will be enough
11 // for our needs.
13 //dedicated to Mealea, thanks for the passion you put into things and for being able to pass it on to me :)
15 //standard stuff
16 integer E_MONEY_QTY_KEY = 8;
17 integer R_MOD_ENERGY = 11;
22 default
25 state_entry()
27 //put a sign on our head to instruct avatars
28 llSetText("Pay me 1L$ to help me live and reproduce", <llFrand(1.1),llFrand(1.1),llFrand(1.1)>, 1.0);
34 on_rez(integer param)
36 llResetScript();
42 //someone has give us money
43 money(key id, integer amount)
45 //gratifies the user
46 llSay(0, "Thank you! I'll try to reproduce thanks to your help!");
47 //pass the event and the amount of money with the key of the giver
48 llMessageLinked(LINK_SET, E_MONEY_QTY_KEY, (string)amount, id);
49 //give energy
50 llMessageLinked(LINK_SET, R_MOD_ENERGY, (string)amount, "");