The latest confusion
|
|
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
|
11-07-2006 14:04
Hey guys! I've confused myself again! I know, easily done! What I'm trying to do is to get two prims that are not actually anywhere near each other, to communicate. Or more specifically, to communicate with the scripts within. I made the mistake of thinking I could just IM the key of the receiving prim, but that doesn't work. At the moment they're close enough to hear a whisper, but I intend on taking one out with me in the world and need to communicate between the two, the one back home effectively acting as a server I guess. Any chance this is really simple and can be written in some code that I'll easily understand?  Thanks again guys!
_____________________
<VOTE PROPOSITION 4968/> http://jira.secondlife.com/browse/VWR-4968 For SecondLife Builders who need better mapping for better building
|
|
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
|
11-07-2006 14:39
I have come up with an idea... How about if the 'client' constructs a series of instructions to send to the script in the server prim, and when ready emails the whole lot. The server then processes the request and emails it back, would that work?
My theory being that the 'client' would be like a remote control. You would generate the instruction that you want, and then send the instruction to the server. The server does what ever it needs to, and then emails the result back. The 20 second delay in emails would be perfect here since that would allow a slower timer running on the server for auto-receiving emails, and in theory by the time the instruction has been carried out and returned, the 20 seconds wouldn't have passed yet, so by the time the client script gets going again the result would be waiting.
Is that the craziest thing ever or does that actually make sense? Reading it over it does seem logical to me!
_____________________
<VOTE PROPOSITION 4968/> http://jira.secondlife.com/browse/VWR-4968 For SecondLife Builders who need better mapping for better building
|
|
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
|
11-07-2006 14:47
This is my code for the client prim (this is a proof-of-concept for me only) key SERVER_UUID = "SERVER_KEY";// Set this to the key of your server prim key CLIENT_UUID; // This prims key string SERVER_EMAIL; // Where the email will be sent to integer MESSAGE_INDEX; // In case of multiple emails all sent at once... default { state_entry() { CLIENT_UUID = llGetKey(); // Get the UUID/Key of the client llSetObjectDesc(CLIENT_UUID); // and set it as your description SERVER_EMAIL = (string)SERVER_UUID + "@lsl.secondlife.com"; // Where to send the email to (our server) } touch_start(integer total_number) // Click the client to send a test email { MESSAGE_INDEX++; llEmail(SERVER_EMAIL, CLIENT_UUID, "TEST MESSAGE " + (string)MESSAGE_INDEX); // CLIENT_UUID set as subject for return. Delays for 20 secs llGetNextEmail("", SERVER_UUID); //Server has now responded, so get the email response } email(string time, string address, string subj, string message, integer num_left) { message = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1); llOwnerSay("Message From Server: " + message); // Echo the servers response to the owner } } And this is the code for the server prim: default { state_entry() { llSetTimerEvent(10);//Will check for emails every 10 seconds } timer() { llGetNextEmail("", "");//Get all emails with any subject llSetTimerEvent(10);//And do so again in 10 seconds } email(string time, string address, string subj, string message, integer num_left) { message = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1); string RETURN_EMAIL = subj + "@lsl.secondlife.com";//Return email sent to UUID of sender as UUID is the subject llEmail(RETURN_EMAIL, UUID, "TEST MESSAGE RECEIVED!");//Send a reply to the client that sent original message } } Doesn't do anything at all other than send a couple of emails between two prims. Note how the UUID is set to the object description? That's me being lazy working out the UUIDs. I guess in theory the server could talk to the client when in close proximity to set the UUID for each other? Time to get to work... better ways to do this always welcome!
_____________________
<VOTE PROPOSITION 4968/> http://jira.secondlife.com/browse/VWR-4968 For SecondLife Builders who need better mapping for better building
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
11-07-2006 16:05
This is always a problem, because if you re-rez your server, it gets a new UUID, and then all your clients need to be updated.
Check the archives, this has been discussed at length on this forum. Possible solutions are to use multiple servers for redundancy, and have some way of the servers to update each other as well. So if one server re-rezzes, the other servers can find out. And if a client tries to contact a server and can't find it, it tries the next server, which it hopefully finds, and then it can hopefully get the new UUID of the server that re-rezzed.
A simpler solution is to use off-world email. The client always emails a known email address - [email]your-email@your-domain.com[/email]. You set up your webhost to send that email into SL, targeted to the server's UUID. This is better, because if the server re-rezzes, you just change a UUID in one place (the script running on your webhost), and all clients now automatically talk to the new server. LSL and Perl/PHP/etc. scripts to do this have been posted on this forum in the past, as well as instructions on how to set up procmail or whatever, so you should be able to find examples to help you.
|
|
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
|
11-07-2006 16:29
Yeah, I'm aware of the problem of re-rezzing something, but when I try to email a UUID from outside SL it never seems to get there! I figured I'd have a "Reconfigure Station" where the server can update the UUID of any client by dropping the client near it and hitting a reset button
I'm sure there are better ways of doing this, but since I couldn't sinply find a method of getting servers and clients to talk to each other I trawled through the Wiki till I found email and did it with that. If it didn't have a 20 second delay it would be REALLY cool, but that 20 secs does give me time to process what I want it to do, so it's not so bad I guess. Also keeps the timer down! Now if only I didn't have to leave the timer running all the time for it to always be available... is there a way to get it to wake up, kinda stay on standby, but be woken remotely?
_____________________
<VOTE PROPOSITION 4968/> http://jira.secondlife.com/browse/VWR-4968 For SecondLife Builders who need better mapping for better building
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-08-2006 00:18
Do No Copy Objects get new keys as well? I was under the impression that no copy would mean that even when rerezzed the object retained the same ID?
|
|
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
|
11-08-2006 03:08
I will find out!
_____________________
<VOTE PROPOSITION 4968/> http://jira.secondlife.com/browse/VWR-4968 For SecondLife Builders who need better mapping for better building
|
|
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
|
11-08-2006 03:26
OK, I made a no-copy object (a cube of course!) and had it tell me its key every time it was clicked.
First time it was 2e79921a-366e-3f4c-5fc3-3cc8786dd869. This continued to be the case while I deeded it to group and also when I bought it back for myself.
I then took it to my inventory and re-rezzed it. It now changed to 6c29c165-fb22-06bf-85ff-0eb30bba188f.
So yeah, no-copy objects do also get new UUIDs when re-rezzed
_____________________
<VOTE PROPOSITION 4968/> http://jira.secondlife.com/browse/VWR-4968 For SecondLife Builders who need better mapping for better building
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
11-08-2006 10:00
Well, no-copy applies to the next owner, if you created an object you always have full permissions on it, right? I think you'd need to give the cube to someone else and have them test it.
|