Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

~~Now Open Sorce - Rent Cube~~

Shippou Oud
The Fox Within
Join date: 11 Jul 2005
Posts: 141
02-24-2007 21:13
I'm opining up this project to the public.
2 parts of it are not compelate, but it should not be too much trouble to finish the script.
The first part is under the money function, I did not add an if for when the person who is allready renting, pays too much to add time, and goes over the max amount of time alowed. There is an else statement that will pick it up , but the message would be a bit odd.

The major part that is missing is the time() function, and script that goes along with it. llSetTimerEvent has been declared, and is set to fire every 24 hours. There is scattered script that adds time in the money section, but has not been beta tested.

The textures will need to be changed, the ones I used in the script were just for testing.

The script works....but is not compelate. After the end of the code, I'll add the notecard that the user modifies,
CODE

uzoink()
{
llSetTexture("d9785695-b160-a6a9-552a-45216494f821",ALL_SIDES);
llSetScale (sc);
llSetAlpha(1,ALL_SIDES);
llSetStatus(STATUS_PHANTOM,FALSE);
llSetPos(llGetPos() + <0,0,-1>);
llSetObjectDesc("Scripted by Shippou Oud");

}
zoink()
{
llSetTexture("64904062-3582-246c-6964-cb21c93f236b",ALL_SIDES);
sc = llGetScale();
llSetScale (<.1,.1,.1>);
llSetAlpha(.8,ALL_SIDES);
llSetStatus(STATUS_PHANTOM,TRUE);
llSetPos(llGetPos() + <0,0,1>);


llSetObjectDesc("Scripted by Shippou Oud");
float payday = pd * .02;
if (payday > 0)
{
llGiveMoney(me,(integer)payday + 1);
}
if (payday < 1)
{
llGiveMoney(me,1);
}
}

vector sc;
integer chan = 404;
key me ;
key renter;
integer daysl;
integer weeksl;
integer rentime;
integer price;
integer limitmi;
integer limitma;
string title;
string rules;
integer rtime;
integer pd;
//title,rules,price,limitmi,limitma


default
{
on_rez(integer x)
{
llResetScript();
}
state_entry()
{
me = llGetCreator();
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
llListen(chan,"",llGetOwner(),"");
llSetText("",<0,0,0>,1);
llSetObjectDesc("Scripted by Shippou Oud");
llSetTimerEvent(86400);

sc = llGetScale();

}

touch_start(integer x)
{

if (llDetectedKey(0) == llGetOwner())
{


if (renter == "")
{
llInstantMessage(llGetOwner(),"No one is renting this space.");
}
if (renter != "")
{
string gg = llKey2Name(renter);
llInstantMessage(llGetOwner(),gg + " has this space for " + (string) daysl + " days.");
}
}
if (llDetectedKey(0) == renter)
{
llInstantMessage(renter,"You have " + (string) daysl + " days left.");
}
if (llDetectedKey(0) != renter)
{
if (llDetectedKey(0) !=llGetOwner())
{
if (renter == "")
{
llInstantMessage (llDetectedKey(0),title + " - Rules: " + rules + " - Price $L" + " " + (string) price + " per week - Min renting time " + (string) limitmi + " weeks - Max renting time " + (string) limitma + " weeks");
}
if (renter != "")
{
llInstantMessage(llDetectedKey(0), "Sorry, this space is taken.");
}
}
}





}
run_time_permissions(integer perm)
{
if (PERMISSION_DEBIT & perm)
{

}
else
{
llInstantMessage(llGetOwner(),"Sorry, you must click 'yes' to operate this. Please click me to retry.");

state null;
}

}
dataserver(key queryid, string data)
{
title = data;
state one;
}
listen(integer chan,string name,key id,string xxx)
{
if (id == llGetOwner())
{
if (xxx == "stats")
{
llInstantMessage (llGetOwner(),title + " - Rules: " + rules + " - Price $L" + " " + (string) price + " per week - Min renting time " + (string) limitmi + " weeks - Max renting time " + (string) limitma + " weeks");
llSetObjectDesc("Scripted by Shippou Oud");

}
else if (xxx == "bootup")
{
llInstantMessage(llGetOwner(),"Starting config. process.");
llGetNotecardLine("info",1);
llListenRemove(llListen(chan,"",llGetOwner(),""));
llSetObjectDesc("Scripted by Shippou Oud");

}
else if (xxx == "res")
{
uzoink();
renter = "";
daysl = 0;
weeksl = 0;
llInstantMessage(llGetOwner(),"Resetting compleate.");
llSetObjectDesc("Scripted by Shippou Oud");
}

}
}
money (key ren, integer pay)
{
pd = pay;
integer min = price * limitmi;
integer max = price * limitma;
integer fweeks = pay / price;
float gweeks = (float) pay / (float) price;
integer change;


llSetObjectDesc("Scripted by Shippou Oud");

if (renter != "")
{
if (renter == ren)
{
if ( fweeks + weeksl < limitma + 1)
{
weeksl = weeksl + fweeks;

llInstantMessage(ren,"Thank you for extending your lease for " + (string) fweeks + " weeks. You have " + (string) weeksl + " weeks left.");
;
if (gweeks > fweeks)
{
integer ref2 = pay - (price * fweeks);
llGiveMoney(ren, ref2);
llInstantMessage(ren,"You overpayed, here is $L" + (string) ref2 + " back.");
}
}
else
{
llInstantMessage(ren,"Sorry, this spot is reserved.");
llGiveMoney(ren,pay);
}
}


}

if (renter == "")
{
if (pay < min)
{
llInstantMessage(ren,"This is not enough, you need to pay at least $L" + (string) min);
llGiveMoney(ren,pay);
}
else if (pay > min - 1)
{

if (pay > max)
{
zoink();
renter = ren;
weeksl = limitma;

integer ref = pay - max;
llGiveMoney(ren, ref);
llInstantMessage(ren,"You overpayed, here is $L" + (string) ref + " back.");
llInstantMessage(ren,"You have rented this space for " + (string) limitma + " weeks.");

}
else if (fweeks == gweeks)
{
zoink();
renter = ren;
weeksl = fweeks;

llInstantMessage(ren, "You have rented this space for " + (string) fweeks + " weeks.");
}
else if (gweeks > fweeks)
{
if (pay < max)
{
zoink();
renter = ren;
weeksl = fweeks;

integer ref1 = pay - (price * fweeks);
llGiveMoney(ren, ref1);
llInstantMessage(ren,"You overpayed, here is $L" + (string) ref1 + " back.");
llInstantMessage(ren,"You have rented this space for " + (string) fweeks + " weeks.");
}


}

}
}



}
}

// ----break----
state null
{
state_entry()
{
llSetText("Out of order",<0,0,0>,1);
}
touch_start(integer x)
{

state default;

}
}
state one
{
state_entry()
{
llGetNotecardLine("info",3);
}
dataserver(key queryid, string data)
{
rules = data;
state two;
}
}

state two
{
state_entry()
{
llGetNotecardLine("info",5);
}
dataserver(key queryid, string data)
{
price = (integer)data;
state three;
}
}
state three
{
state_entry()
{
llGetNotecardLine("info",7);
}
dataserver(key queryid, string data)
{
limitmi = (integer)data;
state four;
}
}
state four
{
state_entry()
{
llGetNotecardLine("info",9);
}
dataserver(key queryid, string data)
{
limitma = (integer) data;
llInstantMessage(llGetOwner(),"Done.");
state default;
}

}



The way you use voice comand is this. say /404 and the following:
bootup (this sets the data from note card)
stats (this tells the owner what the data is from the note card)
res (this resets the weeks/days left to 0, and boots the renter out, basically a reset)

Here is the note card named "info"

From: someone

~Tilte:
My Mall
~Rules:
limit of 3 prims, no mature stuff.
~Price: (number only-per week)
2
~Min Time: (number only-weeks)
3
~Max Time: (number only-weeks)
10


have fun ^-^
Shippou Oud
The Fox Within
Join date: 11 Jul 2005
Posts: 141
02-25-2007 15:21
no replys yet, lol.
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
02-25-2007 15:50
From: Shippou Oud
no replys yet, lol.


Reply to what?
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
02-25-2007 17:23
Uhhh.... thanks?

Does that count as a reply? ;)