Jump to content

placing script with different channels in many prims


Bouttime Whybrow
 Share

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

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

Recommended Posts

hi, i need to place a script into about 200 prims, plus each itteration of the script has to have it's listening channel bump up by one number.

for example, you have script that does something, you set it to listen on channel 189 and drop it in a prim, then you take that same script and change the channel to 190 and drop it in another prim. you then change the listening channel to 191 and drop it in another script.......and so on. i have to do that a few hundred times.

is there a way to automate this task?

 

any pointers or suggestions very much appreciated.

Link to comment
Share on other sites

Must the channel number really be coded in the script explicitly, or can the script discover it by querying some "channel number server" that doles them out sequentially?

And where are these prims being populated with the sequentially-channel-stamped scripts? That is, if this all happens in a single region, that "server" can be real simple, but if the prims should be populated from anywhere on the grid it gets more difficult.

Link to comment
Share on other sites

hi Qie, thanks for replying.

here is what i am trying to do, i have an character avatar that i have sliced into parts so i can make sections invisible using a HUD, basically the same as mesh avatars like slink and such.

to do that i'm using a receiver script and a transmitter script. each HUD button(prim) has a transmitter script and each mesh part has a receive script. bumping the channels is so each part has has it's own unique channel so when a particular button is pushed the right part gets set to alpha and not all of them.

this just the way i thought of doing it, but i am open to doing it anyway that makes the most sense.

Link to comment
Share on other sites

The parts of this avatar that go visible and invisible are presumably different faces of different linked parts of a Mesh assembly, so there might be a single receiver script that listens (on one channel) to the HUD transmitter script and controls all those sides of all those links. There can be just the one HUD transmitter script, too, that knows what part is touched by the llDetectedTouchFace() of the llDetectedLinkNumber() in the touch_end() handler. There just needs to be a consistent mapping from the HUD's links and faces to those of the avatar assembly, so the message is coherent to the receiver script.

Link to comment
Share on other sites

i kind of understand the logic, not that i could do the scripting though.  the receiver script would know what face was touched but how would it know which of the faces of the mesh is in fact that face?

 

the thinking going through my head is, a mesh is an irregular object with an arbitrary number of faces, mine has almost 200 parts, how would the script know that the finger nail on the right forefinger is face 173?

if it doesn't have a script in it the only way i can think of is by it's name, and if that is the case then i would have to name each part, that would take as much work as doing it the original way.....although their would be a ton less scripts, which of course is a benefit.

i'm not good with scripting, i just need to get this done so i can go forward with the rest of the project. i thought i had found the solution and was hoping there was a way of propagating the scripts instead of doing it by hand.

 

would you be able to help me through this? if you can i would be glad to do something for you or pay it forward in a way you suggest, do a good turn for others in return for your help.

 

Link to comment
Share on other sites


would you be able to help me through this?

No, sorry, that wouldn't be appropriate, especially not from contact in this forum. Ideally, somebody will know of an existing open source implementation that would help you out. Otherwise you may need to take your request to the Wanted forum or to get a scripter to create a custom solution, the Inworld Employment forum.

Link to comment
Share on other sites

I think you have come up with a logical but way overly complicated solution to a common problem.  You don't need a couple hundred comm channels.  All you need is a way to send signals uniquely to a couple hundred objects.  The easier solution is to have all of your objects listen on the same channel but only pay attention to messages meant for them specifically.  You could manage that in several ways.  One that generally works looks like this in the sending script:

 

SendCommand(integer button_number){    llRegionSay(Master_Channel,"Move~"+(string)button_number);    // Or if this is an avatar or a multiprim object that you will be wearing ...    // llRegionSayTo(llGetOwner(),0,"Move~"+(string)button_number);}

 

Then in the receiving script in each component ....

 

listen(integer channel, string name, key id, string message){    string filter;    list temp = llParseString2List(message,["~"],[]);    if (llList2String(temp,0) == "Move")    {        filter = llList2String(temp,1);        if (filter == my_part_name)        {            //move the part        }    }}

You just need to keep your button numbers/names matched to the same names in your various parts.  You can obviously do many different varitions on this theme, with different levels of intricacy, but the idea is to make your scripts do the job of filtering commands either on the sending or receiving end, rather than telling the region servers to monitor a large number of comm channels. 

 

Link to comment
Share on other sites

I may have misread your OP, but I assumed that you were already putting a separate script in each component.  To accomplish what I was describing as a general approach, those individual scripts would need some unique identifier so that it could listen to a general broadcast message and say, "That one's for me!  Its message has my name in it."  The easiest way to do that is to give each of your components a unique name. That way, if the main script says, "Move~RLeg", the right leg is the only component that will end up moving.

There's rarely any reason to put a separate sending script in each button for something like this.  In fact, it's often unnecessary to waste prims by using a separate prim for each button. Just make an image with all your buttons on it, slap it on a prim, and use llDetectedTouchST to identify which spot on it that the user clicked.  If you really need to use individual prim buttons for some reason, give them unique names, link them, and use llGetLinkName(llDetectedLinkNumber(0)) to tell which one the user clicked.  Either way, you do all the button handling and message sending from a single central script.

Link to comment
Share on other sites

thanks for the info Rolig, it's appreciated.

i ended up going with a paid solution. it works pretty much as you desribe. it uses only two scripts, one for the HUD and one for the linkset.

setting it up allowed me to understand the process much better. i realize i can do it myself next time.

thanks again to both of you.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2731 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...