Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

camping chair

Ante Flan
'yote
Join date: 14 Sep 2005
Posts: 46
12-05-2005 14:58
Let me start with saying that I'm not a very good scripter. You may notice a few shortcuts and stuff here that could have probably been handled more easily if I knew how. Also, this is edited from an example on the wiki and the comments are still in there. I made this because the only free camping chair I could find wasn't open source and sitting on it didn't quite work right (it works a bit better on this, but not well, for some reason. It seems to right itself a bit every timer event). But hey, it works, sorta, and I haven't seen an open-source camping chair anywhere out there, so yeah. Have it, edit it, do whatever with it.

CODE
integer campmoney = 0;
integer campadd = 2;
integer camptime = 300;
string reciever;
default {
state_entry() {
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
llSetText("sit here for free money,\nL$"+(string)campadd+" every 5 minutes",<0,1,0>,1);
llSitTarget(<0.4, 0, 0.6>, ZERO_ROTATION); // needed for llAvatarOnSitTarget to work
// Note that if both the vector and the rotation are zero,
// the SitTarget is removed instead of set and the following will not work:
}

changed(integer change) { // something changed
if (change & CHANGED_LINK) { // and it was a link change
//llSleep(0.5); // llUnSit works better with this delay
if (llAvatarOnSitTarget() != NULL_KEY) { // somebody is sitting on me
reciever = llAvatarOnSitTarget();
llSetText("Money:"+(string)campmoney,<0,1,0>,1);
llSetTimerEvent(camptime);
//llSay(0, "Get off!");
//llUnSit(llAvatarOnSitTarget()); // unsit him
}
else{
llGiveMoney(reciever,campmoney);
reciever="";
campmoney=0;
llSetText("sit here for free money,\nL$"+(string)campadd+" every 5 minutes",<0,1,0>,1);
llSetTimerEvent(100000000);
}
}
}
timer()
{
campmoney = campmoney+campadd;
llSetText("Money:"+(string)campmoney,<0,1,0>,1);
if (llAvatarOnSitTarget() != NULL_KEY)
{
}
else
{
reciever="";
campmoney=0;
llSetText("sit here for free money,\nL$"+(string)campadd+" every 5 minutes",<0,1,0>,1);
llSetTimerEvent(100000000);
}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
12-06-2005 22:17
/54/07/75897/1.html
_____________________
i've got nothing. ;)