These forums are CLOSED. Please visit the new forums HERE
Efficiency Question |
|
|
Lillie Ellison
Registered User
Join date: 16 Oct 2006
Posts: 8
|
10-14-2008 13:33
Hi, can any veteran scripters offer an opinion on which would be more efficient? Should an attachment script always send messages via email or should it use a sensor first to see if the object is within chat range then either send chat or email as appropriate? Security is not an issue in this case. Messages might go directly to someone else's attachment via chat or to a fixed location relay server via email.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
10-14-2008 13:48
Efficient in what sense? I doubt you are going to see a huge difference either way in terms of server resources, though it may depend on how often the messages are likely to be local. Obviously your code complexity is going to be greater if you use the sensor and both communication methods. If this is going to be a heavy-load system I would suggest doing some testing. Otherwise, I'd just pick the one that you are most comfortable with and not worry about it too much.
|
|
Lillie Ellison
Registered User
Join date: 16 Oct 2006
Posts: 8
|
10-14-2008 14:15
Efficient in terms of server resources. Probably in most cases the two scripts would be within chat range of each other. Assuming that's the case the majority of the time, the question was intented to discern the relative cost of the two methods.
Method 1: Scan, send chat message, recieve chat reply or Scan, failover to Method 2 Method 2: Obj1 sends email message to server, server receives email message and resends email message to Obj2, Obj2 receives email message and sends email reply to server, server receives email reply and forwards email reply to Obj1, Obj1 receives email reply So it comes down to is 4 emails more costly than a scan, 2 chat messages and the open listens needed for chat? |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-14-2008 15:40
Well scanning wouldn't be all that great in this case. llRegionSay will cover the whole sim but sensor only covers 96 meters. You could do a data server call to see if the object was in the same sim but that can be pretty slow when the asset server is backed up. Email can also be slow at times so if it was me, I would probably use llRegionSay with the recieving object setup to acknowledge reciept of message. If no answer within say about 30 seconds, then email will be used.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
10-14-2008 15:54
Oh. One more thing to consider, because it sounded like the receiving objects might (at least at times) be attachments: I don't think you can scan for an attachment, even by key. I'm not sure you can get an attachment's details with llGetObjectDetails() either, but I'm really not sure. So unless you want to assume mere presence of an avatar means they also have their attachment on, you might want to use a chat protocol (as Jesse mentioned) instead of a sensor.
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
10-15-2008 03:16
Also bear in mind that llEmail() is very much cheaper if local to the sim than if it has to go across sims... so, unless the vast majority of these communication events would be sim-local, I really wouldn't bother complicating the scripts with extra listen() events (and certainly not a sensor).
|
|
Lillie Ellison
Registered User
Join date: 16 Oct 2006
Posts: 8
|
10-15-2008 08:04
Thanks for the great tips. I do believe the vast majority of the time the 2 attachments would be local sim and I was planning to have 1 of the 2 have an open listen anyway so I think, unless someone gives a good argument against it, I should use chat when local and email when remote. Jesse mentioning the llRegionSay caused me to recall a trick used by Strife for detecting if a user is in the same sim using llGetAgentInfo. So, I'm thinking something like this:
if ( !llGetAgentInfo(user) ) sendEmailMessage(user, message); else sendChatMessage(user, message); |
|
Lillie Ellison
Registered User
Join date: 16 Oct 2006
Posts: 8
|
10-15-2008 12:47
I've encountered a basic problem using a relay server. When you login or rez your attachment it gets a new UUID, thus the reason for the relay server. The question is, when your attachment sends it's new UUID to the relay server, how does the server validate the email is coming from you? If you're not in the same sim as the server the function llGetOwnerKey won't return the owners key.
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-15-2008 15:53
I've encountered a basic problem using a relay server. When you login or rez your attachment it gets a new UUID, thus the reason for the relay server. The question is, when your attachment sends it's new UUID to the relay server, how does the server validate the email is coming from you? If you're not in the same sim as the server the function llGetOwnerKey won't return the owners key. Password in the subject field etc? _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
10-16-2008 22:03
You can use llGetObjectDetails to determine the objects position, which avoids the need to use a sensor.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
|
Lillie Ellison
Registered User
Join date: 16 Oct 2006
Posts: 8
|
10-17-2008 11:15
Thanks Strife,
I had looked at that function too. Are you recommending it over the llGetAgentInfo for determining if the person is in the same sim? The object is an attachment so my understanding is that I can't detect it, only the avatar. I also don't really need to know the position. Using llRegionSay will work if they are anywhere in the same sim. |
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
10-17-2008 16:41
Thanks Strife, I had looked at that function too. Are you recommending it over the llGetAgentInfo for determining if the person is in the same sim? The object is an attachment so my understanding is that I can't detect it, only the avatar. I also don't really need to know the position. Using llRegionSay will work if they are anywhere in the same sim. I would use llGetAgentSize to determine if someone were in the region, it's possible for llGetAgentInfo to return zero even if they are in the region (naked and standing around returns zero). I've got an example for you now on... https://wiki.secondlife.com/wiki/LlGetAgentSize#Notes _____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
10-19-2008 01:06
Note that llGetObjectDetails() SHOULD also work for determining whether another resident is in the same sim. Some functions like llKey2Name() may keep results "cached" for a bit even after a resident leaves the sim. This hasn't been true of llGetAgentSize() or llGetAgentInfo() so far, which is why people have often used those functions for this purpose, but since the primary purpose of those functions isn't determining avatar presence/position....
Determining position information of a known entity (identified by key) is one of the primary intents of llGetObjectDetails(), on the other hand. If the agent is in the sim, it will always return a result. if the agent is in a different sim, it will either return no results, or can give you a position that reflects that the avatar is not in the current region: (Note: Not yet compiled; may need minor syntax fixes.) CODE
|