Update server for texture and landmark
|
|
Dumisani Ah
Pass me the hammer
Join date: 2 Dec 2006
Posts: 95
|
07-04-2008 16:14
Is there an example of an update server that can transmit region wide a new texture and landmark when dropped into it?
I have tried Emma Nowhere's Intra-Region Update Server in the SL Wiki, but I cannot for the life of me get it to do an actual update when I try using textures and landmarks loaded into the server's inventory.
I did modify this script originally to allow it to apply the inventory texture to a prim face that was also the update receiver, as well as give the inventory landmark if touched, but as soon as the scripts were not working, I rolled it back to the original with a straight cut and paste, checked that the two indicate that they are registered to each other, and then dropped a simple empty ncard into the server, selected update and still nothing worked.
I can try and write this from scratch, but with so many open source update servers seemingly available this seems pretty redundant. So one more question, is there a known bug with Emma's script that I may have missed?
_____________________
Screwdrivers are so 90's...
|
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
07-04-2008 20:52
You cannot use a "request" update server with a texture or landmark because the texture or landmark cannot include the script that would make the request. So most standard ones would not work.
The only way to do this would be to use a "push" update server which keeps track of everyone who has bought your texture or taken your landmark and sends them the new one when you create an update. Unfortunately this is such a large amount of data that it would quickly become too big for a script to store, so you would need an external database server accessed through the web.
|
|
Dumisani Ah
Pass me the hammer
Join date: 2 Dec 2006
Posts: 95
|
07-05-2008 00:30
From: Yumi Murakami You cannot use a "request" update server with a texture or landmark because the texture or landmark cannot include the script that would make the request. So most standard ones would not work. The only way to do this would be to use a "push" update server which keeps track of everyone who has bought your texture or taken your landmark and sends them the new one when you create an update. Unfortunately this is such a large amount of data that it would quickly become too big for a script to store, so you would need an external database server accessed through the web. Hi Yumi, yep, I gave up on a direct update system and have instead turned this around to make it a prim update instead, so the project script is changing to one where the master or server prim will update prims on the same channel with UUID's of new textures. The only thing I am not sure of is doing the same for a landmark. I may as well tell you what its for as I'll be posting the resulting code back here again as usual. Im tired of updating all the event boards on my estate, so the script is to allow myself and managers to dump any new event onto the server script that then sends that event 'texture' to the event board prims directly, region wide. The new texture and the new landmark in the event board prim contents are then simply applied to the prim for texture, and to any 'touch' event for the landmark give. I think emailing the content of the server to its 'registered' event boards will work quite well due to distance. Someone's obviously done this all before, but its a cool challenge for me to try out 
_____________________
Screwdrivers are so 90's...
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-05-2008 01:26
If it is within the same region, this is actually a pretty simple thing to do with a query/response protocol. If it is not the same region, you'd have to send a courier object across region boundaries anyway. So assuming the former: (NOTE: These scripts have not yet been compiled, and may require minor syntax fixes.) Server script (you may want to use a 'changed/CHANGED_INVENTORY' event or some other to decide when to give out new content; here I assumed the owner would give the command "/37 do update", so customize to taste). integer UPDATE_CHANNEL = -1385585192; string NOTIFY_NEW_CONTENT_CHAT = "notifyNewContent"; string REQUEST_NEW_CONTENT_CHAT = "requestNewContent";
integer COMMAND_CHANNEL = 37; string DO_UPDATE_CHAT = "do update";
integer listenHandle = 0;
giveContent(key id) { integer i; string item; for (i = llGetInventoryNumber(INVENTORY_TEXTURE); i > 0; --i) { item = llGetInventoryName(INVENTORY_TEXTURE, i-1); llGiveInventory(id, item); } for (i = llGetInventoryNumber(INVENTORY_LANDMARK); i > 0; --i) { item = llGetInventoryName(INVENTORY_LANDMARK, i-1); llGiveInventory(id, item); } }
default { state_entry() { listenHandle = llListen(COMMAND_CHANNEL, "", llGetOwner(), DO_UPDATE_CHAT); llListen(UPDATE_CHANNEL, "", NULL_KEY, REQUEST_NEW_CONTENT_CHAT); }
changed(integer changes) { if (changes & CHANGED_OWNER) { llListenRemove(listenHandle); listenHandle = llListen(COMMAND_CHANNEL, "", llGetOwner(), DO_UPDATE_CHAT); } }
listen(integer channel, string name, key id, string message) { if (llGetOwnerKey(id) != llGetOwner()) { return; }
if (channel == COMMAND_CHANNEL) { if (message == DO_UPDATE_CHAT) { llRegionSay(UPDATE_CHANNEL, NOTIFY_NEW_CONTENT_CHAT); } } else if (channel == UPDATE_CHANNEL) { if (message == REQUEST_NEW_CONTENT_CHAT) { giveContent(id); } } } }
Script for receiving objects: integer UPDATE_CHANNEL = -1385585192; string NOTIFY_NEW_CONTENT_CHAT = "notifyNewContent"; string REQUEST_NEW_CONTENT_CHAT = "requestNewContent";
default { state_entry() { llListen(UPDATE_CHANNEL, "", NULL_KEY, NOTIFY_NEW_CONTENT_CHAT); }
listen(integer channel, string name, key id, string message) { if (llGetOwnerKey(id) != llGetOwner()) { return; }
if (message == NOTIFY_NEW_CONTENT_CHAT) { llRegionSay(UPDATE_CHANNEL, REQUEST_NEW_CONTENT_CHAT); } } }
|
|
Dumisani Ah
Pass me the hammer
Join date: 2 Dec 2006
Posts: 95
|
07-05-2008 15:21
Hewee, the scripts worked like a charm. Thank you very much. I have amended and adapted to accommodate the parts I needed within it, and they do work very well. May I ask one more thing? Is it possible to use a script to delete the inventory of a prim in which the script is held? I wish to purge the inventory between the notification of a new update from the server and the receiving of the actual new content. Nowhere in the wiki do I find something that shows how this can be done. The changes I made are in the receiving script and I wish to add something in here that can enable the content other than the script to be purged (draft here so excuse the mess): From: someone integer UPDATE_CHANNEL = -1385585192; string NOTIFY_NEW_CONTENT_CHAT = "notifyNewContent"; string REQUEST_NEW_CONTENT_CHAT = "requestNewContent";
default { state_entry() { llListen(UPDATE_CHANNEL, "", NULL_KEY, NOTIFY_NEW_CONTENT_CHAT); }
listen(integer channel, string name, key id, string message) { if (llGetOwnerKey(id) != llGetOwner()) { return; }
if (message == NOTIFY_NEW_CONTENT_CHAT) {
llRegionSay(UPDATE_CHANNEL, REQUEST_NEW_CONTENT_CHAT); { string texture = llGetInventoryName(INVENTORY_TEXTURE, 0); llSetTexture(texture, ALL_SIDES); } } } touch_start(integer total_number) { llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_LANDMARK, 0)); } }
_____________________
Screwdrivers are so 90's...
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-05-2008 15:27
From: Dumisani Ah May I ask one more thing? Is it possible to use a script to delete the inventory of a prim in which the script is held? I wish to purge the inventory between the notification of a new update from the server and the receiving of the actual new content. Nowhere in the wiki do I find something that shows how this can be done. Certainly. http://www.lslwiki.net/lslwiki/wakka.php?wakka=llRemoveInventory
|
|
Dumisani Ah
Pass me the hammer
Join date: 2 Dec 2006
Posts: 95
|
07-05-2008 15:34
Remove!!! Hehehe, I tried DeleteInventory, PurgeInventory, ClearInventory, and just about everything else except Remove. Many thanks Hewee!
_____________________
Screwdrivers are so 90's...
|
|
Dumisani Ah
Pass me the hammer
Join date: 2 Dec 2006
Posts: 95
|
07-09-2008 00:48
Ok, I've modified my client script for this to empty the inventory inbetween the server giving notice of an update and the client requesting the update, as well as the client updating its texture with the new texture and allowing for a touch event to be managed with the landmark give. Two small problems I am battling with, that may be because Im working on too many projects and not focusing enough, so forgive me if it is a simple mistake I overlooked. From: someone integer UPDATE_CHANNEL = -1385585192; string NOTIFY_NEW_CONTENT_CHAT = "notifyNewContent"; string REQUEST_NEW_CONTENT_CHAT = "requestNewContent"; default { state_entry() { llListen(UPDATE_CHANNEL, "", NULL_KEY, NOTIFY_NEW_CONTENT_CHAT); } listen(integer channel, string name, key id, string message) { if (llGetOwnerKey(id) != llGetOwner()) { return; } if (message == NOTIFY_NEW_CONTENT_CHAT) { llRemoveInventory(llGetInventoryName(INVENTORY_LANDMARK, 0)); llRemoveInventory(llGetInventoryName(INVENTORY_TEXTURE, 0)); llRegionSay(UPDATE_CHANNEL, REQUEST_NEW_CONTENT_CHAT); } } touch_start(integer total_number) { llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_LANDMARK, 0)); } changed(integer change) { if (change & CHANGED_INVENTORY) { llOwnerSay("The inventory has changed."  ; string texture = llGetInventoryName(INVENTORY_TEXTURE, 0); llSetTexture(texture, ALL_SIDES); } } } Two issues with this script as it is, one being a script error when the script tries to remove inventory when there is no inventory, normally only just after I rezz the client. And the second is the mulitple confirmation messages the client gives on removing the inventory objects. My questions then are: 1. How do I prevent an error message during an llRemoveInventory function? and 2. how do I script llRemoveInventory to remove all inventory once with a single message given once removed? Note: the server script currently has remained the same as the one Hewee wrote me before in this thread. I wont touch that until I have the client working the way I wish it to  (Edit: I see spaces in the quoted script - grrrr - please ignore as the original does not have those and therefore are not the cause of my problems.)
_____________________
Screwdrivers are so 90's...
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-09-2008 11:16
From: Dumisani Ah Two issues with this script as it is, one being a script error when the script tries to remove inventory when there is no inventory, normally only just after I rezz the client. And the second is the mulitple confirmation messages the client gives on removing the inventory objects. My questions then are: 1. How do I prevent an error message during an llRemoveInventory function? and 2. how do I script llRemoveInventory to remove all inventory once with a single message given once removed? ... (Edit: I see spaces in the quoted script - grrrr - please ignore as the original does not have those and therefore are not the cause of my problems.) 1. Try llGetInventoryNumber() to see if there is at least one of a given type of inventory item: http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetInventoryNumber2. I'm not aware of any messages given to the user due to llRemoveInventory(). Maybe clearing up the error messages as in #1 will fix this. (Edit). Hitting the forum "Quote" button will allow anyone to see the script as you wrote it (with indentations and without extra inserted spaces), so don't worry too much about that bizarre formatting issue.
|