Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Ad Board Rental Script

ChyriaH Collins
Registered User
Join date: 30 Aug 2007
Posts: 5
09-29-2008 11:21
hey everybody!!!..ive been looking in the forums for a pay script that rents space particularly BOARD SPACE ..where the person can pay. put notecard in ands change texture. can ANYONE either direct me to where i can find it?
my apologies if this question was already posed. i was unable to find it.
thanks in advance :)
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-29-2008 12:34
did you check out the products wanted thread?

_____________________
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
ChyriaH Collins
Registered User
Join date: 30 Aug 2007
Posts: 5
09-29-2008 16:18
From: Ruthven Willenov
did you check out the products wanted thread?


thanks...no luck there
but if anyoine knows of a adboard script please let me know..i will pay for it..thanks so much Ruthven :)
ab Vanmoer
Registered User
Join date: 28 Nov 2006
Posts: 131
09-29-2008 18:16
I think Rutheven meant that you should post your request in the products wanted forum not search it.

I do sell ad rental boards http://www.slexchange.com/modules.php?name=Marketplace&file=item&ItemID=506164
but not the script on its own.
If there is any reason that you need the script and not a complete board, IM me in-world and I will see what i can do.
Regards,
ab
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
09-29-2008 21:41
likewise, if you're interested in scripting your own, then this is the right forum to come to if you run into trouble while writing the script.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Imago Aeon
Animation Designer
Join date: 23 Oct 2007
Posts: 65
12-25-2008 19:28
Well, if anyone can get this working right this would be nice. But I've got it working to a point but got bored with it. I know it's a little late, but better to necro a post with information I guess.

(Edit: It gives a math error. I don't remember where the script came from so I don't know if I picked it up somewhere, bought it, or just got it out of a freebie box. I have over 30000 things in my inventory about 10000 of those are scripts. *laughs* Well, if anyone can fix it then please post the fix for everyone to enjoy and use.)

CODE

integer rentperiod = 7;
integer rentcost;
string rentinfonotecard = "_RentInformation_";
string rentadtexture = "_RentAdTexture_";
string rentscript;
string rentboardowner;
integer amountpaid = 0;

key renterkey;
string rentername;
integer countdown = 0;

string ItemNotecard="";
string ItemLandmark="";
string ItemObject="";
string ItemTexture="";

string Day2Left = "No";
string Day1Left = "No";

string tstring;

delnonowneritems()
{
integer x;
for (x = llGetInventoryNumber(INVENTORY_ALL) ; x >= 0 ; x--)
{
tstring = llGetInventoryName(INVENTORY_ALL, x);
if ((tstring != rentinfonotecard) && (tstring != rentadtexture) && (tstring != rentscript) && (tstring != ""))
{
llRemoveInventory(tstring);
}
}
}

default
{
state_entry()
{
// llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
rentboardowner = llKey2Name(llGetOwner());
state init;
}
}

state init
{ //Initialize
state_entry()
{
amountpaid = 0;
rentername = "";
renterkey = NULL_KEY;
countdown = 0;
ItemNotecard="";
ItemLandmark="";
ItemObject="";
ItemTexture="";
Day2Left = "No";
Day1Left = "No";
rentcost = (integer)llGetObjectDesc();
rentscript = llGetScriptName();
llSetTexture(rentadtexture, 0);
delnonowneritems();
state waitforrenter;
}
on_rez(integer i) {llResetScript();}
}

state waitforrenter
{ //Accept payment or dispense "about me" notecard
state_entry()
{
llInstantMessage(llGetOwner(), "Ready to rent...");
llSetPayPrice(PAY_DEFAULT, [PAY_DEFAULT, PAY_DEFAULT, PAY_DEFAULT, PAY_DEFAULT]);
// llSetPayPrice(PAY_HIDE, [1, (rentcost*2), (rentcost*3), (rentcost*4)]);
}

touch_start(integer num)
{
if (llGetInventoryType(rentinfonotecard) == INVENTORY_NONE)
{
llInstantMessage(llDetectedKey(0), "Sorry, I don't have instructions to dispense. Please notify "+rentboardowner);
return;
}
integer perm_mask = llGetInventoryPermMask(rentinfonotecard, MASK_OWNER);
if(perm_mask & PERM_COPY)
{
llGiveInventory(llDetectedKey(0), rentinfonotecard);
}
else
{
llInstantMessage(llDetectedKey(0), "Sorry, I don't have permission to dispense instructions. Please notify "+rentboardowner);
}
}

money(key id, integer amount)
{
if ((amount/rentcost) != (integer)(amount/rentcost))
{
llGiveMoney(id, amount);
llInstantMessage(id, "Refunding, the cost to rent this per week is L$"+(string)rentcost);
return;
}
countdown = (amount / rentcost) * 7 * 24 * 60 * 60; //Seven days in a week, 24 hours in a day, 60 mins in an hour, 60 seconds in a min
llInstantMessage(id, "Thank You "+llKey2Name(id)+", you now have "+(string)(countdown/60/60/24)+" days left on your rent");
renterkey = id;
rentername = llKey2Name(renterkey);
amountpaid = amount;
state acceptitems;
}

link_message(integer sender_num, integer num, string str, key id)
{
if (str == "reset")
{
llInstantMessage(llGetOwner(), "Resetting, please wait...");
llResetScript();
}
}

on_rez(integer i) {llResetScript();}
}

state acceptitems
{ //CTRL drag items into contents
state_entry()
{
llSetTimerEvent(30 * 60);
llAllowInventoryDrop(TRUE);
llInstantMessage(renterkey, "Please hold down the CTRL key and drag an image, notecard, and landmark onto me. Click me when finished to begin displaying your advertisement");
}

timer()
{
llInstantMessage(renterkey, "Did not accept items and start advertisement within 30 minutes, issuing refund");
llGiveMoney(renterkey, amountpaid);
state init;
}

link_message(integer sender_num, integer num, string str, key id)
{
if (str == "reset")
{
llInstantMessage(llGetOwner(), "Resetting, please wait...");
llResetScript();
}
}

touch_start(integer num)
{
if (llDetectedKey(0) != renterkey)
{
return;
}

llInstantMessage(renterkey, "Preparing your advertisement...");

if (ItemTexture != "")
{ llInstantMessage(renterkey, "Texture: "+ItemTexture); }
else
{ llInstantMessage(renterkey, "Texture: <none>"); }
if (ItemNotecard != "")
{ llInstantMessage(renterkey, "Notecard: "+ItemNotecard); }
else
{ llInstantMessage(renterkey, "Notecard: <none>"); }
if (ItemObject != "")
{ llInstantMessage(renterkey, "Object: "+ItemObject); }
else
{ llInstantMessage(renterkey, "Object: <none>"); }
if (ItemLandmark != "")
{ llInstantMessage(renterkey, "Landmark: "+ItemLandmark); }
else
{ llInstantMessage(renterkey, "Landmark: <none>"); }

if ((ItemTexture == "") || (ItemNotecard == "") || (ItemObject == "") || (ItemLandmark == ""))
if ((ItemTexture == "") || (ItemNotecard == "") || (ItemLandmark == ""))
{
llInstantMessage(renterkey, "One of each item is required to start renting this board");
return;
}

llListen(50, "", renterkey, "");
llDialog(renterkey, "Are you ready?", ["Yes", "No"], 50);
}

listen(integer channel, string name, key id, string message)
{
if (channel != 50)
{
return;
}
if (message == "Yes")
{
state dispense;
}
}

changed(integer mask)
{
integer i;
for (i=0 ; i<llGetInventoryNumber(INVENTORY_ALL) ; i++)
{
string tstring = llGetInventoryName(INVENTORY_ALL, i);
if ((tstring != rentadtexture) && (tstring != rentinfonotecard) && (tstring != rentscript))
{
if (llGetInventoryPermMask(tstring, MASK_NEXT) & PERM_COPY)
{}
else
{
llInstantMessage(renterkey, "I do not have COPY permission to distribute "+tstring);
llGiveInventory(renterkey, tstring);
return;
}
}
}

if(mask & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY))
{
integer i;
for (i=0 ; i<llGetInventoryNumber(INVENTORY_TEXTURE) ; i++)
{
string tstring = llGetInventoryName(INVENTORY_TEXTURE, i);
if ((tstring != ItemTexture) && (tstring != rentadtexture) && (ItemTexture != ""))
{
llInstantMessage(renterkey, "Replacing "+ItemTexture+" with "+tstring);
llRemoveInventory(ItemTexture);
ItemTexture=tstring;
return;
}
if ((tstring != rentadtexture) && (ItemTexture == ""))
{
llInstantMessage(renterkey, "Recieved Texture: "+tstring);
ItemTexture=tstring;
return;
}
}

for (i=0 ; i<llGetInventoryNumber(INVENTORY_NOTECARD) ; i++)
{
string tstring = llGetInventoryName(INVENTORY_NOTECARD, i);
if ((tstring != ItemNotecard) && (tstring != rentinfonotecard) && (ItemNotecard != ""))
{
llInstantMessage(renterkey, "Replacing "+ItemNotecard+" with "+tstring);
llRemoveInventory(ItemNotecard);
ItemNotecard=tstring;
return;
}
if ((tstring != rentinfonotecard) && (ItemNotecard == ""))
{
llInstantMessage(renterkey, "Recieved Notecard: "+tstring);
ItemNotecard=tstring;
return;
}
}

for (i=0 ; i<llGetInventoryNumber(INVENTORY_OBJECT) ; i++)
{
string tstring = llGetInventoryName(INVENTORY_OBJECT, i);
if ((tstring != ItemObject) && (ItemObject != ""))
{
llInstantMessage(renterkey, "Replacing "+ItemObject+" with "+tstring);
llRemoveInventory(ItemObject);
ItemObject=tstring;
return;
}
if (ItemObject == "")
{
string tstring = llGetInventoryName(INVENTORY_OBJECT, i);
llInstantMessage(renterkey, "Recieved Object: "+tstring);
ItemObject=tstring;
return;
}
}

for (i=0 ; i<llGetInventoryNumber(INVENTORY_LANDMARK) ; i++)
{
string tstring = llGetInventoryName(INVENTORY_LANDMARK, i);
if ((tstring != ItemLandmark) && (ItemLandmark != ""))
{
llInstantMessage(renterkey, "Replacing "+ItemLandmark+" with "+tstring);
llRemoveInventory(ItemLandmark);
ItemLandmark=tstring;
return;
}
if (ItemLandmark == "")
{
string tstring = llGetInventoryName(INVENTORY_LANDMARK, i);
llInstantMessage(renterkey, "Recieved Landmark: "+tstring);
ItemLandmark=tstring;
return;
}
}
}
}

on_rez(integer i) {llResetScript();}
}

state dispense
{ //Also allows lease extension by either renter or owner
state_entry()
{
if (ItemTexture != "")
{
llSetTexture(ItemTexture, 0);
}
llInstantMessage(renterkey, "Your advertisement has now began...");
llSetTimerEvent(60);

llSetPayPrice(PAY_HIDE, [0, 0, 0, 0]);
if (countdown <= (3 * 7 * 24 * 60 * 60))
{
llSetPayPrice(PAY_HIDE, [rentcost, 0, 0, 0]);
}
if (countdown <= (2 * 7 * 24 * 60 * 60))
{
llSetPayPrice(PAY_HIDE, [rentcost, (rentcost*2), 0, 0]);
}
if (countdown <= (1 * 7 * 24 * 60 * 60))
{
llSetPayPrice(PAY_HIDE, [rentcost, (rentcost*2), (rentcost*3), 0]);
}
}

link_message(integer sender_num, integer num, string str, key id)
{
if (str == "reset")
{
llInstantMessage(llGetOwner(), "Resetting, please wait...");
llResetScript();
}
}

money(key id, integer amount)
{
if ((amount/rentcost) != (integer)(amount/rentcost))
{
llGiveMoney(id, amount);
llInstantMessage(id, "Refunding, the cost to rent this per week is L$"+(string)rentcost);
return;
}
if ((id != llGetOwner()) && (id != renterkey))
{
llGiveMoney(id, amount);
llInstantMessage(id, "Only the owner or current renter can extend the rental period. Issuing refund");
return;
}
countdown += (amount / rentcost) * 7 * 24 * 60 * 60; //Seven days in a week, 24 hours in a day, 60 mins in an hour, 60 seconds in a min
llInstantMessage(id, "Thank You "+llKey2Name(id)+", you now have "+(string)(countdown/60/60/24)+" days left on your rent");

llSetPayPrice(PAY_HIDE, [0, 0, 0, 0]);
if (countdown <= (3 * 7 * 24 * 60 * 60))
{
llSetPayPrice(PAY_HIDE, [rentcost, 0, 0, 0]);
}
if (countdown <= (2 * 7 * 24 * 60 * 60))
{
llSetPayPrice(PAY_HIDE, [rentcost, (rentcost*2), 0, 0]);
}
if (countdown <= (1 * 7 * 24 * 60 * 60))
{
llSetPayPrice(PAY_HIDE, [rentcost, (rentcost*2), (rentcost*3), 0]);
}

}

touch_start(integer num)
{
if (ItemNotecard != "")
{
llGiveInventory(llDetectedKey(0), ItemNotecard);
}
if (ItemObject != "")
{
llGiveInventory(llDetectedKey(0), ItemObject);
}
if (ItemLandmark != "")
{
llGiveInventory(llDetectedKey(0), ItemLandmark);
}
}

timer()
{
countdown -= 60;

llSetPayPrice(PAY_HIDE, [0, 0, 0, 0]);
if (countdown <= (3 * 7 * 24 * 60 * 60))
{
llSetPayPrice(PAY_HIDE, [rentcost, 0, 0, 0]);
}
if (countdown <= (2 * 7 * 24 * 60 * 60))
{
llSetPayPrice(PAY_HIDE, [rentcost, (rentcost*2), 0, 0]);
}
if (countdown <= (1 * 7 * 24 * 60 * 60))
{
llSetPayPrice(PAY_HIDE, [rentcost, (rentcost*2), (rentcost*3), 0]);
}

if ((Day2Left == "No") && (countdown < (3600 * 48)))
{
Day2Left="Yes";
llInstantMessage(renterkey, "You have less than two days left on your rent at "+(string)(llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME])));
return;
}
if ((Day1Left == "No") && (countdown < (3600 * 24)))
{
Day1Left="Yes";
llInstantMessage(renterkey, "You have less than one day left on your rent at "+(string)(llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME])));
return;
}
if (countdown < 0 )
{
llInstantMessage(renterkey, "Your rent at "+(string)(llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]))+" has expired.");
state init;
}
}

on_rez(integer i) {
llResetScript();
}
}