Jump to content

Halp!


Alisha Matova
 Share

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

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

Recommended Posts

I'm stuck! On something rather simple.

I have a simple volume detect prim messaging the avatars uuid back to my main script. I need to take that uuid and insert it into one of the states functions.

Could someone please post a quick example that parses a uuid from a message into a function for me?

Thanks in advance!
Link to comment
Share on other sites

@Dora,

That ID from the listen event won't pass along the detected ID, that would be the UIID of the prim itself.

@Alisha

Two scripts, the first in the volume detect prim, the second in the prim you want to get the value

default{    state_entry()    {       llVolumeDetect(TRUE);    }    collision_start(integer num)    {        llWhisper(-12321,(string)llDetectedKey(0));    }}

 

key collider;default{    state_entry()    {        llListen(-12321,"","","");    }    listen(integer channel,string name,key id,string message)    {        collider = (key)message;        llSay(0,"UUID " + (string)collider + " hit me");    }        }

 The llSay line is in there just as an example of using the collider value.  You could instead switch states and then use the value as you need instead.

Edit to add: If you are using within one prim, better to use linked message instead of whisper and listen

  • Like 1
Link to comment
Share on other sites

Looks like a pinball machine, instead of using the key why not use the object name or both, then have all the object names in a list and then use llfidlistfind you give you an index and then use an IF else chain to do the function according to the index number of the object name, and don't use llwhisper, that takes longer, as you are using a large neg number use llregionsay, and if to have the key of the receiver then use llregionsayto.

Link to comment
Share on other sites


Yohan Roux wrote:

He seems to want a function to run for a given key, can't see how he could unless he had a list of all keys first, think he should use the object name myself but I could have misunderstood it.

The OP doesn't need a long list of saved keys.  He's already got the one he needs.  It's llDetectedKey(0) in his collision_start event.  All he wants to do is send it to another script and use it.  Talia's example does that just fine.  As she says, if the two scripts are in the same linkset it's even easier to use llMessageLinked

.

In the sending script ...

    key UUID = llDetectedKey(0);    llMessageLinked(LINK_SET,0,"",UUID);

 

in the receiving script ...

    link_message(integer link, integer num, string msg, key id)    {        key Av_ID = id;    }

 

  • Like 1
Link to comment
Share on other sites

Also, if the two scripts aren't in the same linkset, you may want to consider using llRegionSayTo  to transmit the avatar key rather than llSay or llWhisper, since it doesn't have a range restriction (as long as both objects are in the same sim of course), and won't interfere with other listeners if they happen to operate on the same channel.

Link to comment
Share on other sites

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