Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need Script Help, Permissions problem?

Markus Brendel
Registered User
Join date: 16 Oct 2006
Posts: 13
12-17-2007 22:23
Im working with a tipjar script that allows various users in the same group to sign in... problem i am having with the script is the user does not get the sign out option after they have been signed in, it seems as id only the owner of the object can log it out. Also, is there a easy way to intergrate notecard config into the script instead of using the description field of the object?

I am new to scripting, and spent some time trying to find the problem, maybe you can spot it right away...

(BEGIN SCRIPT)

integer paid=0;
float percent=0.05;
integer kept;

integer tiped=0;

key tipper;
string Tipper;
integer lasttip=0;

string User;
key user;
integer inuse=FALSE;

integer Chan=1;
integer handle;

Text()
{
if(inuse==TRUE)
{
User=llKey2Name(user);

}
else
{
User="Not in use";
}
if(tipper!=NULL_KEY)
{
Tipper=llKey2Name(tipper);
}
else
{
Tipper="None, Yet!";
}
llSetText(User+"
Tips: "+(string)tiped+"
Tiped Last: "+Tipper+"
Amount Tiped: "+(string)lasttip,<1,1,1>,1);
}


default
{
state_entry()
{
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
percent=(float)llGetObjectDesc();
Tipper="None, Yet.";
llOwnerSay("Percent kept: "+(string)percent+", You can set the percent, to be kept, in the objects description, Defult 0.05 or 5%, If changed reset by touching then clicking reset.";);
Text();
Chan=llRound(llFrand(1500));
handle=llListen(Chan,"","","";);
llSetPayPrice(PAY_DEFAULT, [25, 50, 100, 200]);
}
on_rez(integer t)
{
llResetScript();
}
money(key id, integer amount)
{
if(inuse==TRUE)
{
tipper=id;
lasttip=amount;
tiped+=lasttip;
llWhisper(0,"Thank you for your tip, "+llKey2Name(tipper));
Text();
}
else
{
llWhisper(0,"Thank you for your Donation.";);
}
}
listen(integer chan, string name, key id, string m)
{
if(m=="Sign in";)
{
inuse=TRUE;
user=id;
Tipper="None, Yet.";
tiped=0;
lasttip=0;
Text();
llInstantMessage(user,"You've just signed in, Percent we'll Keep = "+(string)percent);
}
if(m=="Sign out";)
{
kept=(integer)(tiped*percent);
paid=tiped-kept;
//llOwnerSay((string)kept+";("+(string)tiped+"*"+(string)percent+";) - "+(string)tiped+" = "+(string)paid);
if(paid>0)
{
llGiveMoney(user,paid);
llInstantMessage(user,"You've just signed out, We kept = "+(string)kept+", You got "+(string)paid+".";);
}
inuse=FALSE;
User="Not in use";
user=NULL_KEY;
tipper=NULL_KEY;
Tipper="None, Yet";
tiped=0;
lasttip=0;
Text();
}
if(m=="Reset" && id==llGetOwner())
{
llResetScript();
}
}
touch_start(integer total_number)
{
if(llGetOwner()==llDetectedKey(0))
{
if(inuse==FALSE)
{

llDialog(llDetectedKey(0), "What would you like to do?",["Sign in", "Reset"],Chan);
}
else if(inuse==TRUE)
{
llDialog(llDetectedKey(0), "What would you like to do?",["Sign out", "Reset"],Chan);
}
}

else if(llSameGroup(llDetectedKey(0)))
{
if(inuse==FALSE)
{
llDialog(llDetectedKey(0), "What would you like to do?",["Sign in"],Chan);
}
else if(inuse==TRUE)
{
if(llDetectedKey(0)==User)
{
llDialog(llDetectedKey(0), "What would you like to do?",["Sign out"],Chan);
}
}
}
else
{
llSay(0,"You are not in the group allowed to use this Item";);
}
}
}
(END SCRIPT)
Renee Roundfield
Registered User
Join date: 10 Mar 2006
Posts: 278
12-17-2007 22:31
missing some elses?