Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script to send IM when object is purchased?

Inez Angelus
Elephant Rider
Join date: 11 Nov 2004
Posts: 129
12-27-2004 09:42
Hello all you brilliant scripters!

Well my furniture business is up and running, and I'm starting to get to the point that I'd like to track which location my sales are coming from.

I don't use vendors; I place the furniture in the store and set it For Sale. So I get a message when the object is purchased, but I don't know where it was purchased or to whom it was sold. (What the object is is secondary to me - would be nice, but I can generally tell by the price what was bought.)

Is there a script I can place inside the object for sale that will IM/notify me with a message like "John Doe purchased Comfy Chair at SuperSim (123, 21) for $100" when an object is purchased?

Or would this not be recommended, as the script would transfer along with the item when it is purchased?

If this kind of script isn't freebee quality, I would be happy to purchase it or hire a scripter to create it for me.

Thanks in advance, happy holidays

-Inez
Zeb Zamboni
Registered User
Join date: 29 May 2004
Posts: 12
12-27-2004 11:50
When not using vendors, the method I've found that works the best is to change the name of the item being sold.

If you are selling an item "Big Comfy Chair" at Mall X and you want to know that it came from Mall X, change the name of the item to "Big Comfy Chair (MX)". If you sell the same item in Mall Y, change the name of the item to "Big Comfy Chair (MY)"

That way you don't have to worry about your script getting distributed along with the merchandise.

This naming scheme works really well when being viewed in your Account History (via Tools/Account History). You can quickly tell who purchased what, where, when, and at what price.

:)
Inez Angelus
Elephant Rider
Join date: 11 Nov 2004
Posts: 129
12-27-2004 11:58
Aahhhhh...I am ashamed to admit that I haven't checked out my Tools menu as closely as I should have. I was relying on my account history page on the website to determine who I made sales to and when. (is there an embarrassed smiley?)

You way sounds much better - thank you for kick-starting my brain into gear.


-Inez
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
12-28-2004 06:40
something else you can do, is modify the price slightly for the different items if they are all 100 Lindens change them to 91, 92, 93, 94, 95 etc... so you then have a list of which ones were priced at that level and you can also determine what items were sold in your spreadsheet.
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Maximus Zander
Registered User
Join date: 30 Apr 2004
Posts: 55
12-30-2004 12:06
Ive made a script just for that purpose.
It uses similar ways like Vendors, but for only one item.

I also wanted to track who bought my stuff:
User, Item, Price, Location.

So i made a simple script for just that purpose.
If you want the script, IM me inworld and ill hand it over.
Ill upload the code here when the Grid is online again.

/ Max
offstar Charming
Registered User
Join date: 26 Dec 2004
Posts: 22
12-30-2004 14:33
Untested code, wrote it just now..
Is this basically what you are after, a script to call from within the inventory of the item on some event which will send you an IM then remove itself from the inventory of the item?

I suppose you could at some sort of timer or event listener for an owner change, or an inventory change and then execute this. Not sure how to handle tracking the amount it was sold for though..

Hope this helps or atleast points you in the right direction; or as a starting point for improvements by someone who has been using LSL a bit longer than myself. ;)


// A simple IM script, with self clean-up

default
{
state_entry()
{
// Call our outbound information function
ItemSold();
}

state_exit()
{
// Delete this script, so as to not clutter up inventory on the item sold
// after we have finished IM'ing..
llRemoveInventory(llGetScriptName());
}
}

ItemSold()
{
string OriginalOwnerKey = "xxx-xxx-xxx"; // your personal avatar key
string SoldItemInformation = "Item (" + llGetObjectName() + ";) was sold in " + llGetRegionName() + " at position " + llGetPos() + ".";
llInstantMessage(OriginalOwnerKey, SoldItemInformation);
}

P.S. Sorry the code doesn't come out nicely formatted, not sure how others are getting that to happen. =)
Maximus Zander
Registered User
Join date: 30 Apr 2004
Posts: 55
12-31-2004 12:14
As soon as this f#ยค% Grid goes up, ill give u my crappy code :)
Maximus Zander
Registered User
Join date: 30 Apr 2004
Posts: 55
12-31-2004 19:07
integer price=100; // The Price of the Object
string object="SuperChair"; // Your Item to be sold
string notecard="SuperChair Instructions"; // Your notecard for the item

default
{
state_entry()
{
llSay(0, "Script Activated";);
llRequestPermissions( llGetOwnerKey( llGetKey() ), PERMISSION_DEBIT );
}
on_rez(integer start_param)
{
llResetScript();
}
money(key giver, integer amount) {

if (amount < price) {
llSay(0,"Not Enough Credits";);
llSay(0,"This item costs L$" +(string)price);
llSay(0,"Returning your money";);
llGiveMoney( giver, amount );
}
else {
llSay( 0, "Credits Accepted";);
llSay( 0, object +" sent to your inventory";);
llGiveInventory(giver, object);
llGiveInventory(giver, notecard);

if (amount > price)
{
llSay( 0, "Too much Credits";);
llSay( 0, "Giving you back the extra amount L$"+(string)(amount - price));
llGiveMoney(giver, amount - price);
}
llInstantMessage(llGetOwner(), (string)llKey2Name(giver) +" Bought " +"'" +object +"'"+" at "+ (string)llGetRegionName());
}
}

}
Inez Angelus
Elephant Rider
Join date: 11 Nov 2004
Posts: 129
01-03-2005 07:23
Ooooooh Max and Offstar *drools*

can't wait to try both of them out tonight :D If you guys are interested in feedback, I'll let you know how they work out.

Thanks so much!

<guinness guy> BRILLIANT! </guinness guy>



-Inez
offstar Charming
Registered User
Join date: 26 Dec 2004
Posts: 22
01-03-2005 07:31
It looks like Maximus Zander's code will give you what you want without any editing or extra scripting. Its a nice little script. :)