Constance Peregrine wrote:This modifiable set of 2 scripts are for those who wish to keep track of their residents by requiring the box to be clicked on a set time frame...ex: if they do not then you can consider them no longer interested enough and go from there.
rentbox1
rentbox2Code: Select all
key kRenter; default { state_entry() { kRenter=NULL_KEY; llSetColor(<0,1,0>,ALL_SIDES); llSetText("Touch to rent this spot!",<1,1,1>,1); } touch_start(integer foo) { if(kRenter == NULL_KEY) { kRenter=llDetectedKey(0); llSetText("",<1,1,1>,1); llWhisper(0,"thx for the renting!"); llSetColor(<1,0,0>,ALL_SIDES); } else if(kRenter == llDetectedKey(0)) { kRenter=NULL_KEY; llWhisper(0,"Awww I love you bye bye D:"); llSetColor(<0,1,0>,ALL_SIDES); llSetText("Touch to rent this spot!",<1,1,1>,1); } else { llSetTimerEvent(5); llSetText("Rented by: "+llKey2Name(kRenter),<1,1,1>,1); } } timer() { llSetTimerEvent(0); llSetText("",<1,1,1>,1); } }
Code: Select all
string getFirstName(string name) { return llGetSubString(name, 0, llSubStringIndex(name, " ") - 1); } default { touch_start(integer num_detected) { llSetText(getFirstName(llDetectedName(0)), <1,1,1>, 1); // } }
I am trying to use the touch-to-rent rental box scripts posted in the scripts library thread, but I have to admit I'm terrible at scripting. Mainly, what I am trying to figure out is how to set the time limit. I gather that the second script doesn't handle that at all, so I was playing with the first script, but the setTimerEvent didn't seem to do anything.
How can I set a time limit to touch and renew the rental?