Jump to content

Object self-delete dont work. Script


Sunbleached
 Share

You are about to reply to a thread that has been inactive for 1794 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

There is such a script, it unpacks, sends an invitation to the group and makes a delivery confirmation. and then it self-delete. usually it happens, but sometimes the following happens: when I install all three lines

integer SEND_ON_REZ = FALSE;//when set to false, you need to click the box to unpack

integer OWNER_ONLY = TRUE;// set to true only the owner can unpack the package

integer DIE_AFTER_UNPACK = FALSE;//when set to to true,the package will destroy after it given its inventory

to TRUE, it refuses to self-delete. what could be the problem?

// YOU NEED TO SET PERMISSIONS ON THIS SCRIPT TO:
// [NO MODIFY & NO COPY] OR [NO MODIFY & NO TRANSFER]

integer delivery = 0;

///////////////////// CONFIGURATION //////////////////

key your_uuid = "00000000-0000-0000-0000-000000000000"; // type your key UUID here
string PRODUCT_NAME = "Product name here";
string PRODUCT_VERSION = "Version numbers here";
string CREATED_BY = "Creator name here";

string PRODUCT_NAME_TEXT = "Product description here";

string TOUCH_TEXT = "Click Me To Unpack!";

string UNPACKING_TEXT = "Unpacking...please wait";

string SENDING_ITEMS_TEXT = "Unpacked, Now Sending Items...";

string UNAUTHORISED_TEXT = "You are not allowed to unpack this.";

string GOOD_BYE_TEXT = "Thank you for your Purchase ! Self-Destruction";

string group_uuid = "00000000-0000-0000-0000-000000000000"; // type the key group here UUID
string join_message = "Click here to join our support group:"; // message that appears in the local chat
string content = "";

integer SEND_ON_REZ = FALSE;//when set to false, you need to click the box to unpack

integer OWNER_ONLY = TRUE;// set to true only the owner can unpack the package

integer DIE_AFTER_UNPACK = FALSE;//when set to to true,the package will destroy after it given its inventory

//Under this line you can enable or disable the floating texts above your box.
integer FLOAT_TEXT_SHOW_PRODUCT_NAME = TRUE;
integer FLOAT_TEXT_SHOW_PRODUCT_VERSION = TRUE;
integer FLOAT_TEXT_SHOW_CREATED_BY = TRUE;

// Here you can change the floating text color.

vector TEXT_COLOR = <0.0,1.0,1.0>;

//Beyond this point i would not recommend modifications, and there for that is on own risk.
DEFINITION_REZ_EFFECTS()
{
//DEFINITION_Text(FALSE);
// Plus whatever else
}

DEFINITION_Text(integer show)
{
if(show == TRUE)
{
string title;
if(FLOAT_TEXT_SHOW_PRODUCT_NAME == TRUE)
{
title += PRODUCT_NAME_TEXT+PRODUCT_NAME+"\n";
}
if(FLOAT_TEXT_SHOW_PRODUCT_VERSION == TRUE)
{
title += PRODUCT_VERSION+"\n";
}
if(FLOAT_TEXT_SHOW_CREATED_BY == TRUE)
{
title += CREATED_BY+"\n";
}
title+=TOUCH_TEXT;
llSetText(title, TEXT_COLOR, 1.0);
}
else if(show == FALSE)
{
llSetText("", ZERO_VECTOR, 0);
}
}

DEFINITION_SEND_ITEMS(key id)
{
integer i = 0;
integer items = llGetInventoryNumber(INVENTORY_ALL);
string name;
list itemslist;
string complete;
do
{
complete = (string)(i*100/items);
llSetText(UNPACKING_TEXT+"\n"+complete+"% Complete", TEXT_COLOR, 1.0);
name = llGetInventoryName(INVENTORY_ALL, i);
if(llStringLength(name) > 0 && name != llGetScriptName())
{
itemslist += name;
}
}while(i++<items);
llSetText(SENDING_ITEMS_TEXT+"\nMay take "+(string)((integer)(3*llGetRegionTimeDilation()))+" seconds till you recieve.", TEXT_COLOR, 1.0);
string FOLDER_NAME = PRODUCT_NAME+" "+PRODUCT_VERSION;
llGiveInventoryList(id, FOLDER_NAME, itemslist);
llInstantMessage(id, "The folder is named "+FOLDER_NAME+" in your inventory");
}
default
{
state_entry()
{
llSetObjectName(PRODUCT_NAME+" "+PRODUCT_VERSION+" (Boxed)");
DEFINITION_Text(TRUE);
}
on_rez(integer a)
{
if(delivery == 0){
delivery = 1;
llInstantMessage(your_uuid,llGetObjectName()+ " Rezzed by "+ llKey2Name(llGetOwner()));
llOwnerSay( join_message + " secondlife:///app/group/" + group_uuid + "/about");
// send invite to group as a link for the recipient to click

content = llKey2Name( llGetOwner()) + " has rezzed " + llGetObjectName() ;
}
DEFINITION_REZ_EFFECTS();
if(SEND_ON_REZ == TRUE)
{
DEFINITION_SEND_ITEMS(llGetOwnerKey(llGetKey()));
}
else
{
DEFINITION_Text(TRUE);
}
}
touch_start(integer d)
{
if(OWNER_ONLY == TRUE)
{
if(llDetectedKey(0) == llGetOwnerKey(llGetKey()))
{
DEFINITION_SEND_ITEMS(llGetOwnerKey(llGetKey()));
if(DIE_AFTER_UNPACK == TRUE)
{
llSetText(GOOD_BYE_TEXT, TEXT_COLOR, 1.0);
llSleep(3);
llDie();
}
DEFINITION_Text(TRUE);
}
else
{
llInstantMessage(llDetectedKey(0), UNAUTHORISED_TEXT);
}
}
else if(OWNER_ONLY == FALSE)
{
DEFINITION_SEND_ITEMS(llGetOwnerKey(llGetKey()));
if(DIE_AFTER_UNPACK == TRUE)
{
llSetText(GOOD_BYE_TEXT, TEXT_COLOR, 1.0);
llSleep(3);
llDie();
}
DEFINITION_Text(TRUE);
}
}
} 

 

Edited by Sunbleached
Link to comment
Share on other sites

Stick some llOwnerSay or llWhisper(,...) lines at various places to see which places it goes to and what the values of variables are just before it goes to another spot. Another good practice is to add an else clause to an if, so in this case you would have an else clause that chatted out something like "DIE_AFTER_UNPACK was false". Do this in all the possible branches the script can take so that you can see where the execution flow is going.

 

Looking back at your posting history, I commend you for your interest in learning LSL, but I would suggest you spend some time learning more about the mindset involved in debugging, it is very similar to watching ants scurrying around on the ground and wondering why they choose to go in certain ways and not others? It is no good asking the ants, and it is no good asking friends on the phone, you have to make your own observations.

Edited by Profaitchikenz Haiku
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Also, as several people have commented in your previous threads, it is almost always harder to debug someone else's script than to debug one of your own.  Get in the practice of writing your own scripts.  Not only will you have a better chance of understanding what the script is meant to do, you won;t be inheriting some other scripter's mistakes.
 

And, one decent step before you do any debugging .... Use proper indentation so you can see where the scope of each block of code begins and ends.

  • Thanks 1
Link to comment
Share on other sites

4 hours ago, Profaitchikenz Haiku said:

Stick some llOwnerSay or llWhisper(,...) lines at various places to see which places it goes to and what the values of variables are just before it goes to another spot. Another good practice is to add an else clause to an if, so in this case you would have an else clause that chatted out something like "DIE_AFTER_UNPACK was false". Do this in all the possible branches the script can take so that you can see where the execution flow is going.

 

Looking back at your posting history, I commend you for your interest in learning LSL, but I would suggest you spend some time learning more about the mindset involved in debugging, it is very similar to watching ants scurrying around on the ground and wondering why they choose to go in certain ways and not others? It is no good asking the ants, and it is no good asking friends on the phone, you have to make your own observations.

Hello and thank you! I followed your suggestion and watched the ants! They lead me to something, I noticed that part on rez missing self delete option! So I added it and it works now! Thank you!

on_rez(integer a)
{
if(delivery == 0){
delivery = 1;
llInstantMessage(your_uuid,llGetObjectName()+ " Rezzed by "+ llKey2Name(llGetOwner()));
llOwnerSay( join_message + " secondlife:///app/group/" + group_uuid + "/about");
// send invite to group as a link for the recipient to click

content = llKey2Name( llGetOwner()) + " has rezzed " + llGetObjectName() ;
}
DEFINITION_REZ_EFFECTS();
if(SEND_ON_REZ == TRUE)
{
DEFINITION_SEND_ITEMS(llGetOwnerKey(llGetKey()));
if(DIE_AFTER_UNPACK == TRUE)
{
llSetText(GOOD_BYE_TEXT, TEXT_COLOR, 1.0);
llSleep(3);
llDie();
}
DEFINITION_Text(TRUE);

}
else
{
DEFINITION_Text(TRUE);
}
}
touch_start(integer d)

 

Edited by Sunbleached
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1794 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...