Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Gift box with specified opening date

Kathrina Benelli
Registered User
Join date: 10 Aug 2007
Posts: 2
11-22-2007 02:29
Hello!
I want to build an advent calendar in my place with 24 gift boxes that do not open before a specified date. e.g. people should not be able to open the box of dec. 3rd before that date but they can still open it later. I couldn't find a script for it so far, maybe someone has an idea how to do this? Thank you!
Kathrina
Linnrenate Crosby
Registered User
Join date: 5 Jun 2007
Posts: 49
11-22-2007 02:40
i love your idea Kathrina, unfortunately i am not a script wizz... thought i just should give you my headsup for your idea tho :)
Sekker Thirroul
Registered User
Join date: 27 Aug 2006
Posts: 28
11-22-2007 03:50
This date script in the wikki libery should work for you it has a check that subtracts the target date from todays date so if the result is 1 or greater it is on or after the date yo want

http://wiki.secondlife.com/wiki/Date_Library

it would then be relativly easy to have a touch event with if the number returned is >=1 then if gives contents.

sounds a nice idea good luck with it
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
11-22-2007 08:42
From: Kathrina Benelli
people should not be able to open the box of dec. 3rd before that date but they can still open it later.
Perhaps I'm being too literal, but if by this you mean restrict usage of the Open option on the pie menu, there is no way to do that through script. Any user can see the contents of any object they own (or have modify rights on) at any time with Open, and even any object they don't own with Edit.
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
11-22-2007 09:08
What a cute idea! Deanna, I think she means a single advent calendar in her own place, which visitors can go to for freebies, but not before the right day comes.

The simplest way to build this might be to have a script which reads the "day" it is to open from the object description line. Then it would be simple to do the arithmetic in the script and only give the item if it is past the "open" date.

The script would only have to do the cumbersome date arithmetic on rez or reset.

Be cute to have the object open a door too when it gives the item, just like a real advent calendar. Behind the door could be a picture of the item, if you were so inclined :)

Lol I could make the script, if no one has it.
_____________________
.
:) To contact forum folks, join the inworld group "The Forum Cartel". New residents with questions about SL more than welcome! We has parties!

:) To contact forum scripters, join the inworld group "Scriptoratti" (thanks Void!). New scripter questions welcome!
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
11-22-2007 09:10
If you have an object server you can have the prize saved in the server and don't deliver until the dated is reached. The giftbox would just contain the script that sends the request to the server. Or you can have an gift inside a gift. So then when you edit it all you see it the 2 box with the real gift in it.
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
11-22-2007 10:24
Kathrina, we're confused! Help us! :)

Do you mean a "gift box" as in something that you _give_ to someone in advance, that they can "open" to get the contents on a specific date? Or do you mean that the "advent calendar" remains on your land, owned by you, and dispenses things when clicked on the appropriate date?

The first type, the "gift box", can't be done unless you have a server in-world.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-22-2007 13:20
Something like this?
You could hang the gift boxes on a tree and then put this script into each box(set the day for each box);

CODE


//This example would only give the object inside on the 20th of December or later
integer month = 12;
integer day = 20;

default
{
touch_start(integer total_number)
{
string date = llGetDate();
if(month <= (integer)llGetSubString(date,5,6))
{
if(day <= (integer)llGetSubString(date,8,9))
{
llWhisper(0, "Merry Christmas");
llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_OBJECT, 0));
}
else
llWhisper(0, "Patience is a virtue");
}
else
llWhisper(0, "Patience is a virtue");
}
}


It isn't perfect thou, everyone could get as many of each item as they wanted etc. Depending on the item, it may not matter.

The one other small problem is that the date is GMT/UTC time. IF you only want to give out the packages at midnight or past your local time then let us know and I am sure we could cobble together something. I can not think of a way to give the objects with an offset for the local time of anyone that clicks on it, no matter where they live. The simplest soultion may be to have a script in the tree which displays the date using llSetText.

The script could also be modified to use llGvieInventoryList instead, in case you wanted to give an object and a card etc.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Kathrina Benelli
Registered User
Join date: 10 Aug 2007
Posts: 2
11-22-2007 15:16
Sorry for the confusion. I want presents displayed in my garden and when someone clicks it on the appropriate date they will dispense notecards, maybe some pictures.

Thank you Jesse, thank you so much! This is exactly what I was looking for.

And thanks to everyone who's helping
:)

Oh, as you're offering it: it will be mostly for our german visitors, so it would be great if the time was set to german time (PST +9).
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-22-2007 19:40
Fun little script for people to play around with. Consider it an early Christmas present.

CODE

//This script will only work correctly from now till December 31st

integer gmt_offset = 1;//Enter your local offset to GMT/UTC here
//It will also work with US times zones. Example EST would be entered as "-5"
//If you are not sure : http://wwp.greenwichmeantime.com/ for your local offset

integer month = 12;
integer day = 20;

default
{
touch_start(integer total_number)
{
string timestamp = llGetTimestamp();
integer current_month = (integer)llGetSubString(timestamp,5,6);
integer current_day = (integer)llGetSubString(timestamp,8,9);
integer current_hour = (integer)llGetSubString(timestamp,11,12);
current_hour = current_hour + gmt_offset;
if(current_hour < 0)
{
current_hour = current_hour + 24;
if(current_month == 12 && current_day == 1)
{
current_month = 11;
current_day = 30;
}
else
current_day--;
}
else if(current_hour > 24)
{
current_hour = current_hour - 24;
if(current_month == 11 && current_day == 30)
{
current_month = 12;
current_day = 1;
}
else
current_day++;
}
if(month <= current_month)
{
if(day <= current_day)
{
llWhisper(0, "Merry Christmas");
llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_OBJECT, 0));
}
else
llWhisper(0, "Patience is a virtue");
}
else
llWhisper(0, "Patience is a virtue");
}
}
[\php]
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-23-2007 16:26
Testing pasting script into Irfanview as a jpg and uploading to picassa. Link between img tags.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-23-2007 16:30
OMG that works even better. Just selected text and pasted into irfanview, saved as a jpg and then used "manage attachments" to upload. Wonder how long it will stay in the forum and if they clean out attachments every now and then?
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Bobbyb30 Zohari
SL Mentor Coach
Join date: 11 Nov 2006
Posts: 466
12-03-2007 09:03
From: Jesse Barnett
Fun little script for people to play around with. Consider it an early Christmas present.

CODE

//This script will only work correctly from now till December 31st

integer gmt_offset = 1;//Enter your local offset to GMT/UTC here
//It will also work with US times zones. Example EST would be entered as "-5"
//If you are not sure : http://wwp.greenwichmeantime.com/ for your local offset

integer month = 12;
integer day = 20;

default
{
touch_start(integer total_number)
{
string timestamp = llGetTimestamp();
integer current_month = (integer)llGetSubString(timestamp,5,6);
integer current_day = (integer)llGetSubString(timestamp,8,9);
integer current_hour = (integer)llGetSubString(timestamp,11,12);
current_hour = current_hour + gmt_offset;
if(current_hour < 0)
{
current_hour = current_hour + 24;
if(current_month == 12 && current_day == 1)
{
current_month = 11;
current_day = 30;
}
else
current_day--;
}
else if(current_hour > 24)
{
current_hour = current_hour - 24;
if(current_month == 11 && current_day == 30)
{
current_month = 12;
current_day = 1;
}
else
current_day++;
}
if(month <= current_month)
{
if(day <= current_day)
{
llWhisper(0, "Merry Christmas");
llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_OBJECT, 0));
}
else
llWhisper(0, "Patience is a virtue");
}
else
llWhisper(0, "Patience is a virtue");
}
}
[\php]


Lol...patience is a virtue.:D
_____________________
Tomas Gandini
Just Me!
Join date: 27 Jun 2006
Posts: 384
12-05-2007 06:12
A great script for a gift box that is not to be opened until a specific date and works as advertised.

But, could it also be made so that a specific person would be the only person to be able to open it on that specific date?

Like presents under the tree. Each one is for a particular person so only that person would be able to open it.
_____________________

Never underestimate the power of stupid people in large groups
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-05-2007 07:18
From: Tomas Gandini
A great script for a gift box that is not to be opened until a specific date and works as advertised.

But, could it also be made so that a specific person would be the only person to be able to open it on that specific date?

Like presents under the tree. Each one is for a particular person so only that person would be able to open it.

in the touch event

EDITED BELOW
if("target av name in lowercase" == llToLower( llDetectedName( 0 ) )){
//-- give stuff
}

or

if(~llSubStringIndex( llToLower( llDetectedName( 0 ) ), "lowercase partial av name";)){
//-- give stuff
}
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Tomas Gandini
Just Me!
Join date: 27 Jun 2006
Posts: 384
12-05-2007 07:41
Thanks Void, I'll give that try.
_____________________

Never underestimate the power of stupid people in large groups