Jump to content

Syncing animated textures.


eseli
 Share

You are about to reply to a thread that has been inactive for 3216 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Ok... so... I have an item with multiple prims, each of which has a moving texture on them. The texture is designed to be seamless at the edges, however since I had to add the script to each individual piece, the textures are animated properly, but they are out of sync (which does produce very noticeable seams). They are already animated, so literally all I need to do is reset the x and y offsets on the textures of all faces on all prims of the linkset simultaneously (which I need a script for).

I know I can use llOffsetTexture to accomplish this for all sides of a single prim, but I do not know how to accomplish this for all prims in a linkset, anyone want to help? :matte-motes-smitten:

 

Link to comment
Share on other sites

Ok... so... after asking around, I had the idea to make a listen script that would change the offset of all sides of the prim it is in to 0, since the animation will be unaffected, this will sync them up if I put the script in every prim, and use the command 'Sync', then I can go and delete all the scripts once it is done

Unfortunately, the script, as i've written it so far, does not work: 

http://pastebin.com/8atsD5HH

if it isn't obvious... yes... I am a total scripting newbie.

Anyway, anyone see the error?

Link to comment
Share on other sites

You have to use llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_TEXTURE.....]).

This means you have to set the texture, repeats and rotation as well as the offset, which is rather inconvenient, but that's the way to do it.

You can also use PRIM_LINK_TARGET in conjunction with this if you want to affect several individual prims in the same call.

 

ETA: You wrote your second post while I was replying to the first.

I don't think doing it by individual scripts in each prim is a good solution, and neither do I think having a listener in every prim in the linkset is a good idea (we used to use link messages in that situation before llSetLinkPrimitiveParamsFast and llGetLinkPrimitiveParams came along).

However, since you ask, the problem is that you open two listeners (that is, start listening on two different channels, one of them calculated from the prim's key and one of them 0, the public channel.   Listening on 0 is very bad practice unless you've got a very good reason, but anyway...

Despite having opened two listeners you don't use either of them.   Instead you've put in a filter in your listen event that changes the texture offlets in response to messages on  channel 4426, which the script will never hear because it's not listening to that channel.

Furthermore, the first time it hears anyone say anything in public chat (channel 0) it responds by stopping listening to that channel.   So, in effect, all your script ever does is stop listening to channel 0 as soon as it hears anything.

This is the way to write your script, I think, but for heaven's sake don't put it in every prim in the linkset.

integer CHANNEL_LISTEN = 4426;string strMagicWord = "sync"; //note lowercasedefault{	state_entry()	{		llListen(CHANNEL_LISTEN,"",llGetOwner(),"");//listen on 4426 to messages from my owner	}	changed(integer change)	{ //something has changed		if (change & CHANGED_OWNER) {//it's my owner that's changed			llResetScript();//reset the script to make it reset the listener to listen to the new owner		}	}	listen(integer channel, string name, key id, string message)	{		if(llToLower(message)==strMagicWord){//convert message to lower case -- this is good practice if you're listening to messages from avatars//so it responds to "Sync", "SYNC", "sYnC" and so on, as well as "sync"			llOffsetTexture(0.0,0.0,ALL_SIDES);		}		else{			llOwnerSay("Invalid input");		}	}}

 

Link to comment
Share on other sites

You have no idea what you are up against;)
The animation at Miss Luna's viewer doesn't start until the texture is uploaded to her viewer
and upload doesn't start until the object is in view (except if the texture is in the cache from a resent viewing)
Mr. Brown arrives later and the story repeats itself with another starting time and another viewer.
In short: what people see is out of sync.

When your viewer upload animated textures at different times the show will be out of sync.

This implicate that uploading at the same time will synchronize the show.
In fact this is true, when I log in to my shop and I have a number of signs with animated textures in view, they are nicely synchronized.

In your case you may well succeed making your animations synchronize the way Rolig outlined, but you stand by and have all textures uploaded and ready for use in your viewer.
For a newly arrived resident it will look differently.

Not very helpful I'm afraid

:smileysurprised::):smileyvery-happy:

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3216 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...