Texture remote script wanted.
|
Draven Ceriano
Registered User
Join date: 12 Oct 2008
Posts: 7
|
07-30-2009 10:37
I am in need of a script that will enable an avatar to drag and drop a texture onto face #2 of a prim and have it appear on face #2 of another (remote, unlinked) prim. The first prim to act as a preview window of sorts.
I have seen this script working in shops in SL, I just can't find a script to read the UUID of the texture, "say" it to the second prim and have the second prim display it.
Thank you.
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
07-30-2009 10:50
Is it ok to require that the texture be full perm?
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
07-30-2009 10:56
Hm.. Untested but probably close... In the preview-prim: integer FACE = 2; // which prim face to check float POLL_TIME = 10.0; // how often to check, in seconds integer CHANNEL = -23123214; // random < 0 number
string gPrevTexture;
default { state_entry() { gPrevTexture = llGetTexture (FACE);
llSetTimerEvent (POLL_TIME); }
timer() { string texture = llGetTexture (FACE); if (texture != gPrevTexture) { llSay (CHANNEL, texture); gPrevTexture = texture; } } }
// edit: todo: should check the return on llGetTexture and yell at the user if it's NULL_KEY // edit: todo: having a trigger before sending to the other prim would be good - maybe have it only send if the owner touches
On the 2nd prim: integer FACE = 2; // which prim face to check integer CHANNEL = -23123214; // random < 0 number (same as other script!!)
default { state_entry() { llListen (CHANNEL, "", "", ""); }
listen (integer channel, string from, key id, string message) { if (llGetOwnerKey (id) == llGetOwner()) { llSetTexture (message, FACE); } } }
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
Draven Ceriano
Registered User
Join date: 12 Oct 2008
Posts: 7
|
07-30-2009 11:09
From: Meade Paravane Is it ok to require that the texture be full perm? Yes, that's correct, it will need to be.
|
Draven Ceriano
Registered User
Join date: 12 Oct 2008
Posts: 7
|
Hmmmm, looks like it should work.
07-30-2009 11:19
On reading the code, it looks like it should work. Unfortunately, it's not. And, yes, on touch would be best.  Thank you.
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
07-30-2009 11:57
/me will take a look at it later, when she can get in-world. Unless somebody beats me to it...
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
Draven Ceriano
Registered User
Join date: 12 Oct 2008
Posts: 7
|
07-30-2009 11:58
From: Meade Paravane /me will take a look at it later, when she can get in-world. Unless somebody beats me to it... Excellent, thank you. I'll be tinkering myself!
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
07-30-2009 12:14
From: Draven Ceriano Excellent, thank you. I'll be tinkering myself! In that case, put llOwnerSay calls in the 1st scripts timer, inside the 'if' statement to see if it ever picks up the texture change. In the 2nd script, put one in the listen callback to see if the 2nd script is hearing the first one. These are well within 20m of each other and in different objects, yes? If it's two prims in the same object, link messages would be the thing to do. If they may not be within 20m of each other, llRegionSay is the way to go instead of llSay..
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
|
07-30-2009 12:24
These scripts do nothing to check ownership or validity of the textures. If the texture is full perm they function as they're supposed to. This first script goes into the 'preview' object, which needs to be called 'SOURCE'. From: someone
integer channel() { return (integer)("0x"+llGetSubString((string)llGetOwner(),-8,-1))*-1; }
default { changed(integer change) { if (change & CHANGED_TEXTURE) { string textures; integer i; for (i = 0; i < llGetNumberOfSides(); ++i) { textures += (string)llGetTexture(i) + "|"; } llRegionSay(channel(), textures); } } }
The second script goes in all the slave objects. They only listen to 'SOURCE'. From: someone
integer channel() { return (integer)("0x"+llGetSubString((string)llGetOwner(),-8,-1))*-1; }
default { state_entry() { llListen(channel(), "SOURCE", "", ""); }
listen( integer chan, string name, key id, string message) { list textures = llParseString2List(message, ["|"], []); integer i; for (i = 0; i < llGetNumberOfSides(); ++i) { llSetTexture(llList2Key(textures, i), i); } } }
The textures of the slave objects become the same as the SOURCEs textures when the latter change. The scripts probably need some more work. You can use them as a basis if you like.
|
Draven Ceriano
Registered User
Join date: 12 Oct 2008
Posts: 7
|
07-30-2009 22:19
Ok, I have it working, sort of. MY copy works perfect. However, when I transfer the item, it doesn't work at all for the new owner. What did I miss?
|
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
|
07-31-2009 02:58
Just wondering, have you set the right 'next owner perms' before you gave the object away? Edited to add: If you have set the perms using 'Bulk Permissions' you should be aware of a nasty bug. See: http://nalates.wordpress.com/2009/07/22/second-life-bulk-permissions-disaster/
|
jeaniesing Trilling
Loves to animate & script
Join date: 21 Oct 2006
Posts: 61
|
07-31-2009 05:07
From: Draven Ceriano Ok, I have it working, sort of. MY copy works perfect. However, when I transfer the item, it doesn't work at all for the new owner. What did I miss? I'm betting that one of the scripts is still seeing you as the owner and listening on the wrong channel.... reset both scripts and try again? or add on_rez(integer itsalive) { llResetScript(); } somewhere in there
_____________________
  Pinastri/113/171/30
|
Draven Ceriano
Registered User
Join date: 12 Oct 2008
Posts: 7
|
07-31-2009 08:17
Thank you all very much for all your help. /facepalm! Sometime the littlest things make all the difference. Once i got the rights corrected, all is well.
|