Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Public mailbox

Tadao Nordenskiold
Registered User
Join date: 9 May 2009
Posts: 37
06-15-2009 18:39
Hey!

I'm trying to create something funny for an event, unfortunately I do not know much about scripting yet. I'm trying to learn it.

My hopes is that you can either direct me to some code already working, or atleast some resource where I can read on how to do just what I need for this particular script.

here's the thing,
I made a mailbox that is taking notecards as letters, but I want it to notify the reciever (who will be within speaking range) that there is a notcard for him/her.
My suggestion would be that the name of the notecard/title is the recievers full name.
When a user then drops a notecard to the mailbox, the script should read the name of the notecard, and send an IM to the reciever saying something like "Someone has sent you a letter. Please click on the mailbox to recieve it". The thing is, that the reciever should only be able to read his/hers notecard. If there is no notecard waiting for a user, the mailbox should just say "Sorry, no mail for you."

And when the reciever has gotten his/her notecard, it should be deleted.

The script I have in place is only recieving notecards.
Tadao Nordenskiold
Registered User
Join date: 9 May 2009
Posts: 37
06-16-2009 00:39
I'm not sure if I really made any good sence to what I wanted, but heres the general idea of the whole system.

Lets say there are 3 avatars on a sim; John Doe, Jane Doe and David Mills.
John want's to send an anonymous message to Jane,
So he writes a notecard, naming it "Jane Doe" and drops it in the mailbox.

The mailbox sees the name of the notecard, and sends an IM to Jane Doe with the message "You have mail".

When Jane clicks the mailbox, she recieves the notecard, and the mailbox deletes it from it's inventory.

But lets say that Jane is a bit slow, and David is a bit curious what the mailbox are and clicks it, he should not get Jane's notecard, only a message saying something like "Sorry, no mail for you.". Unless there actually are a notecard with his name, then he recieves his notecard, which then is deleted.

It couls also be good if the IM to the recieving user is repeated every 10 minutes in case the recipient missed the first message. (Since, from what I have seen so far, the IM's isn't opened in a new IM tab, only a private message in the local chat.)

I know this isn't the forum to ask for complete scripts. Ofcource, a complete script would be apreciated as long as I have the right to modify it. but anything that could leat me into the right direction is apreciated, as long as you don't just say something like "Use llWhatEver" since that won't make any sence to me yet. I am also willing to pay for good help. I'm not very rich though, so please don't ask for several thousands. :)

So far, this is the script I have for the dropoff of the notecards (found on this forum):
(Two lines are not working for some reason though)



key name;
key owner;

default {
state_entry() {
owner = llGetOwner();
llAllowInventoryDrop(FALSE);
}
touch_start(integer n) {
llAllowInventoryDrop(TRUE);
llSetTimerEvent(20.0);
name = llDetectedKey(0);
llInstantMessage(name,"Touched.";);
}
changed(integer change) {
if(change & CHANGED_ALLOWED_DROP){
llSay(0, "thank you";);
llInstantMessage(name, " Thank you! Your message will be delivered as soon as the recipient klicks the mailbox.";); // Does not work
llInstantMessage(owner," dropped a notecard";); // Does not work

llAllowInventoryDrop(FALSE);
llSetTimerEvent(0.0);
}
}
timer() {
llAllowInventoryDrop(FALSE);
llSetTimerEvent(0.0);
}
}



Any help is greatly appreciated.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
06-16-2009 06:02
you're going to have to do a lot of soft checking of names....

for instance, the mailbox is going to have trouble deciding what is and isn't a legitimate name, (there could be spelling errors, capitalization errors [those can be fixed with llToLower], or names that don't exist [or just aren't present) plus the fact that notecards of the same name will be autonumbered (although it tacks on a space, so that shouldn't be too hard to parse out)

you'll also have an issue even alerting legitimate targets, since inventory order will change with each note dropped in. which means searching for the new one to know who it's for, then checking if they are legit target, then messaging only them...

the other issue you have is that it isn't going to be reliably anonymous (if that's important) since the writer will be listed as the creator of the note (unless they reuse someone else's open mod notecard in their inventory, which could get VERY interesting if they have such for other people present)

the simplest way will to have the writers only require the first few letters/first name of the av then check this against the person clicking to pick up their notes...

the rest gets kinda complicated fast, probably using a sensor, or some kind of pre-registration where the mailbox saves users names that are allowed recipients. or even checking via a key2name database.
_____________________
|
| . "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...
| -