|
chendhil Highfield
Registered User
Join date: 21 Jul 2009
Posts: 11
|
08-02-2009 13:02
Can any one tell me about "How the aution system happens in Second life?"
I would like to implement "auction system (Bidding)" for selling my objects in second life,
Please suggest me the procedures on that and tell me where can I get the more
information?
Thanks....
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
08-02-2009 13:13
Try just writing a script that (a) sets an opening bid for the item, (b) accepts a bid from a curious buyer, (c) compares that bid to the opening bid and any previous ones to see if it is the highest so far, (d) checks a clock to see if bidding is still open, and  sends an IM to the highest bidder when the clock says bidding is closed. If the person reponds within a reasonable time, accept his/her money and hand over the item. If not, IM the next highest bidder or start the auction all over again. There are things to include to make the script pretty and secure, but that's a basic outline.
_____________________
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 
|
|
chendhil Highfield
Registered User
Join date: 21 Jul 2009
Posts: 11
|
08-02-2009 16:49
Thanks a lot Rolig...
Can I have sample scripts for this Auction system?
or tell me from where can I get those stuffs ?
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
08-02-2009 17:04
You have to write it. I just sketched out the obvious steps. Take a look at how money events are handled (  ). The rest of it is fairly straightforward.
_____________________
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 
|
|
chendhil Highfield
Registered User
Join date: 21 Jul 2009
Posts: 11
|
08-02-2009 19:22
Thanks for your valuable reply, Rolig.
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
08-02-2009 21:08
OK... The challenge got the better of me..... Here's a simple auction script that I just wrote and tested in world. Put it in a prim. To start it, you (the owner) need to provide two parameters. Type /85 bid = xxxx where xxxx is an optional opening (reserve) bid in L$ for the item being auctioned. If you don't enter anything, the reserve is L$0. Type /85 time = xxxxx where xxxx is the time (in seconds from now) when you want to close bidding. A bidder clicks on the prim to open a dialog box and then enters information as requested on channel 58. When the bidding clock runs out, the script sends you the names and bids of the two highest bidders. It's up to you to complete the sale by collecting their L$ and handing over the item. I could have included that stuff in this script, but got lazy. I suggest you try setting the clock for a couple of minutes (< 120 seconds) while you're playing with it. This script is not elegant or optimized. I wrote it fast and ugly, but it works. //Auction by Rolig Loon 8/2/09 // A simple auction script that keeps track of the two highest bidders and their bids and reports out that information to the // owner at the close of bidding. The owner must then contact the high bidder to collect payment --- not part of this script. // // Owner sets two parameters with chat commands on channel 85: // integer TimeToCloseBids = 0; //When (in seconds from when you start the clock) will the bidding close? One hour = 3600; One day = 86400. Owner must set with /85 Time = xxxxx integer StartBid = 0;// This is the (optional) opening bid. Owner may reset with /85 Bid = xxxx
// ===================== Do Not Change Below This Line ============================ list buttons = ["BID", "Not now"]; list avList; key av; integer CHAN; integer handle1; integer handle2; integer handle3; integer Bid; integer HighBid; integer NextHigh;
default { state_entry() { HighBid = StartBid; CHAN = -27652; handle2 = llListen(85,"",llGetOwner(),""); llResetTime(); }
touch_start(integer total_number) { av = llDetectedKey(0); handle1 = llListen(CHAN,"","",""); integer clocktime = TimeToCloseBids - (integer)llGetTime(); llDialog(llDetectedKey(0), "Bids will close in "+(string)clocktime+" seconds. \n \n The current bid is L$"+(string)HighBid+". If you wish to place a bid, click BID.",buttons,CHAN);
}
listen(integer channel, string name, key id, string message) { if (channel == 85) // Owner, say /85 time = xxxxxx where xxxxx = TimeToClose Bids (in seconds from now) { integer len = llStringLength(message); if (llSubStringIndex(llToLower(message),"time") != -1) { TimeToCloseBids = (integer)llGetSubString(message,llSubStringIndex(message,"=")+2,len-1); llOwnerSay("Time = " + (string)TimeToCloseBids + " seconds."); llResetTime(); llSetTimerEvent(TimeToCloseBids); return; } else if (llSubStringIndex(llToLower(message),"bid") != -1) // Owner, say /85 bid = xxxx where xxxx = opening (reserve) bid in L$ { StartBid = (integer)llGetSubString(message,llSubStringIndex(message,"=")+2,len-1); HighBid = StartBid; llOwnerSay("Starting Bid = L$" +(string)StartBid); return; } } else if(message == "BID") { llInstantMessage(av,"To place a bid, type \"/58 My bid is xxxx\" where xxxx is a number greater than " +(string)HighBid); handle3 = llListen(58,"",av,""); return; } else if(llToLower(llGetSubString(message,0,9)) == "my bid is ") { Bid = (integer)llGetSubString(message,10,llStringLength(message)-1); llInstantMessage(av,"You have just submitted a bid of L$"+(string)Bid+". If that is correct, type \"/58 YES\". If not, type \"/58 \"My bid is xxxx\" where xxxx is a number greater than " +(string)HighBid); return; } else if (llToLower(message) == "yes") { if (Bid < HighBid) { llInstantMessage(av,"Sorry. Your bid of L$"+(string)Bid+ " is too low. You must submit a bid higher than L$"+(string)HighBid); llInstantMessage(av,"To place a bid, type \"/58 My bid is xxxx\" where xxxx is a number greater than " +(string)HighBid); llInstantMessage(av,"To quit without placing a bid, type \"/58 QUIT\"."); return; } else { llInstantMessage(av,"Thank you, " +llKey2Name(av)+". Your bid of L$" +(string)Bid+ " is now the high bid."); NextHigh = HighBid; HighBid = Bid; avList += av; llListenRemove(handle3); return; } } if (llToLower(message) == "quit") { llListenRemove(handle3); llListenRemove(handle1); return; } else { llInstantMessage(av,"Sorry. I did not understand your message. Please type \"/58 YES\" or \"/58 My bid is xxxx\" where xxxx is a number greater than " +(string)HighBid); llInstantMessage(av,"To quit without placing a bid, type \"/58 QUIT\"."); } }
timer() { llInstantMessage(llGetOwner(),"The top bid for item "+llGetObjectName()+ " was L$" +(string)HighBid+ " by " + llKey2Name(llList2Key(avList,llGetListLength(avList)-1))+ "."); llInstantMessage(llGetOwner(),"The next highest bid was L$" +(string)NextHigh+ " by "+ llKey2Name(llList2Key(avList,llGetListLength(avList)-2))+ "."); llInstantMessage(llGetOwner(),"Bidding was closed at "+ (string)llGetTimestamp()+"."); llSetTimerEvent(0); } }
_____________________
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 
|