Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Detecting the "buy" button

Barrington John
Yorkshire guy
Join date: 17 Nov 2007
Posts: 119
09-12-2009 05:28
Is there any way a script in an object can tell if a copy of that object is bought using the "Buy" button?

I could rely on the on_rez() event on the new copy, but obviously that doesn't get fired unless someone rezzes the purchase. The money() event only gets fired when the "Pay" button is used, the changed() event doesn't get fired with anything, and frankly I'm at a bit of a loss.

Any ideas? TIA.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
09-12-2009 05:41
What is it you want to do?
Anything sold by the 'Buy' -button will show in your 'Transaction History'
_____________________
From Studio Dora
Barrington John
Yorkshire guy
Join date: 17 Nov 2007
Posts: 119
09-12-2009 05:49
What I want to do is to fire code in a vendor when an item is bought from it with the "Buy" button. I'm aware of the "Transaction History", but I would rather not write code to attempt to read and parse that if there's a simpler way (or even at all).

I've come to the conclusion that there really isn't a way for a script to tell, but I thought I'd ask here before writing the idea off completely.

(Incidentally, I know this could be done with the "Pay" button, but I'd rather use the "Buy" button to make it easy for purchasers to see exactly what they're getting, permissions, etc. I know that - rightly or wrongly - a lot of people much prefer that way of doing things, and don't trust the advertised descriptions.)
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
09-12-2009 07:35
From: Barrington John
What I want to do is to fire code in a vendor when an item is bought from it with the "Buy" button.
This will trigger the "money" event in your script, so your code should go there. See for more detail.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
09-12-2009 08:08
I think he actually means "buy" not "pay". The 'money' event doesn't fire when you "buy" an object. If the original is set to buy (rather than them buying a copy), you could probably set a fast timer, record the real-world time each time, and see how much time elapsed between the timer and a changed/CHANGED_OWNER event. You can't transfer an in-world object and have it stay rezzed without "buy", so it's a good guess (but still a guess) that if the object was in-world an instant before it receives the changed/CHANGED_OWNER event, it was probably a "buy". Lag may cause the object to believe it was potentially transferred without a "buy" though.
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
09-12-2009 08:55
Oops. My apologies. Diving in out of my depth again. Thanks for pointing that out Hewee. Sorry for misleading you, Barrington.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
09-12-2009 09:21
From: Barrington John
(Incidentally, I know this could be done with the "Pay" button, but I'd rather use the "Buy" button to make it easy for purchasers to see exactly what they're getting, permissions, etc. I know that - rightly or wrongly - a lot of people much prefer that way of doing things, and don't trust the advertised descriptions.)

I'm one of those people myself. Very often, there isn't any advertized description at all, or it is very meager. When I buy something, I want to know what's included and (just as important) I want to know what perms are on the things I buy. I can't get that information if I click Pay. Worse still, I have found some merchants who don't state a price on their advertizements and then use default Quick Pay and don't indicate the price there either.

When I purchase something, I always use Buy when I can. When I sell things, I assume that other people are like me and I avoid the Pay option. As the OP notes, though, this means I have to do a lot of off-line spreadsheet work with my transaction summaries to keep track of sales. It's a real nuisance. Like the OP, I wish there were a way to script around it.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-12-2009 09:45
put it in a rezzer, have it for sale for original.
when the user buys it, the changed owner event is triggered
have it move itself out of the way of the rezzer
issue a command for the rezzer to rez a new one
tell the user to pick up the one they bought

when the rezzer gets the listen event for the command to rez a new one, it can check the owner's key and add it to the sales tracker of your choice

you might also want to add a timer or touch event to rez a new copy if it doesn't get the command to rez the new copy for whatever reason
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
09-12-2009 11:05
I like it. :)

Except for a nagging worry about sales to newbies who get confused by any process that (a) has multiple steps or (b) is unexpected, I'm tempted to try it. My small worry is based on my experience with a similar tactic I used in my first shop a couple of years ago. I used a rezzer to create a freebie that the new owner was supposed to take, but found that a few annoying people would leave the freebie behind instead of taking it. Cleaning up was tough because I no longer owned items once they had been rezzed and I didn't have "Return" powers in my shop's parcel. People are less likely to walk away from something they paid for than a freebie, but even a few confused customers make me nervous.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
09-12-2009 11:38
Make a cute text bubble appear, bob up and down above the item, saying "Take me!" "Right-click -> Take!"
_____________________
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
09-12-2009 18:16
Pah! I read the posts at the wrong time of day - Ruthven has nailed it as far as I can see.

Your land? Their object? If they don't pick up the object then parcel auto-return should take care of it, no?
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-12-2009 20:02
From: Rolig Loon
I like it. :)

Except for a nagging worry about sales to newbies who get confused by any process that (a) has multiple steps or (b) is unexpected, I'm tempted to try it. My small worry is based on my experience with a similar tactic I used in my first shop a couple of years ago. I used a rezzer to create a freebie that the new owner was supposed to take, but found that a few annoying people would leave the freebie behind instead of taking it. Cleaning up was tough because I no longer owned items once they had been rezzed and I didn't have "Return" powers in my shop's parcel. People are less likely to walk away from something they paid for than a freebie, but even a few confused customers make me nervous.


yeah, i thought about that too, only other solution i can think of is maybe a bot? but i have no idea how to program a bot for any reason. but for someone that can, i guess the bot would be able to keep track of who paid what for what and communicate it to a script or server
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
09-12-2009 20:49
From: Indeterminate Schism
Pah! I read the posts at the wrong time of day - Ruthven has nailed it as far as I can see.

Your land? Their object? If they don't pick up the object then parcel auto-return should take care of it, no?

Not if you're renting a shop on someone else's land. If the landlord doesn't have autoreturn set, you have to keep bugging him to return stuff for you. It's a pain.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
09-13-2009 03:05
I dunno...I'm the same way, I wanna know what I'm buying, but from day one I've always just right clicked and edited the vendor to see what's in there. I've never even thought about scripting for the Buy button lol..Ruthven's rezzer idea is pretty good though.
Barrington John
Yorkshire guy
Join date: 17 Nov 2007
Posts: 119
09-13-2009 16:03
Thanks, everyone. It does seem a little silly that this can't be done directly, but it's hardly a show stopper.

I like Ruthven's suggestion, but share Rolig's reservations about it being just too complicated for some to manage.

EIQ: editing the vendor to see the contents is fine - I do that myself - but not everybody knows that, or even knows how to do it.

Anyway, since the store in question isn't exactly the busiest business in SL, relying on Transactions History is just fine - it's just my geekdom that makes me want to automate everything.

Again, thanks to all.
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
09-14-2009 10:06
From: Ruthven Willenov
put it in a rezzer, have it for sale for original.
when the user buys it, the changed owner event is triggered
have it move itself out of the way of the rezzer
issue a command for the rezzer to rez a new one
tell the user to pick up the one they bought

when the rezzer gets the listen event for the command to rez a new one, it can check the owner's key and add it to the sales tracker of your choice

you might also want to add a timer or touch event to rez a new copy if it doesn't get the command to rez the new copy for whatever reason
Good post. Just keep in mind, folks, that this would not be the best way to sell that 200-prim hair! ;)

On a different note: if you use "buy copy" and the owner-changed handler, note that both the bought item AND the original get the event. So, you have to test whether the owner actually changed. (As you know, this approach won't solve your problem for tracking sales, but I thought I'd add it here since it's so non-intuitive.)
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-14-2009 14:12
From: Lear Cale
Good post. Just keep in mind, folks, that this would not be the best way to sell that 200-prim hair! ;)

On a different note: if you use "buy copy" and the owner-changed handler, note that both the bought item AND the original get the event. So, you have to test whether the owner actually changed. (As you know, this approach won't solve your problem for tracking sales, but I thought I'd add it here since it's so non-intuitive.)

i was talking about putting the package in the rezzer not the item being packaged. the rezzer would retain a copy of the package, and rez a new copy after the rezzed one is sold as an original
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369