Jump to content
Sign in to follow this  
Amphei Jierdon

Calling a Function in Another Script

Recommended Posts

Hi Gurus, 

 

maybe some of you can help me?

 

I have a script that does a lot of things, and I want to give away this script as "modify", so everybody can read it... 

On a certain point in this script, I want to use an UUID and this UUID should not be displayed open. Actually I want to do something like this:
 

llSetTexture("64571f69-8830-c670-c194-cb718ab56286", 2); 

So I had the Idea to put this code into another script wich is "no modify" and call it from my first script. This sounds easy, but somehow I seem to be to stupid to get it work...

 

So what I want is a second script in a prim, and this second script contains a function like

mySecretFunction()  
    {
		llSetTexture("64571f69-8830-c670-c194-cb718ab56286", 2); 
			}

and this function should be called from the first script at a certain point by a call like this:

mySecretFunction();

Can anybody tell me, what is the easiest way to do this?

 

Thanks :) 

 

 

Share this post


Link to post
Share on other sites

you can try a linkset message, script a sends a linkset message ands script b runs the 'secret function' when it gets the message, thats a fairly common way of passing data from one script to another or initiating functions in another.
 

  • Like 1

Share this post


Link to post
Share on other sites

If the two scripts are in the same object, then you could trigger the texture change by having the first script use llMessageLinked to send a message to the no-mod script.    The message can contain any arbitrary integer (as its second parameter) or word (as its third parameter), and the no-mod receiving script, in its link_message event  decides what to do about the message, either using  if ... else if ... logic or simply by looking up the code-word or -number in a strided list and seeing what texture it means. 

Edited by Innula Zenovka
  • Like 1

Share this post


Link to post
Share on other sites

llMessageLinked is the way to go. Just be aware there is nothing secret about it. A script in the same prim that has the destination script can pick up the full message including prim number, number, message and key

  • Like 1

Share this post


Link to post
Share on other sites

But if the receiver script has a strided list of texture names and uuids, the sender can send it the name of the texture to use and the receiver can use that to find the uuid to apply without the texture's uuid ever being exposed (there's other ways to do it, of course).

Share this post


Link to post
Share on other sites

This is good information to have; I've been in the habit of simply having my scripts blurp out and listen to chat commands, this looks way cleaner, saves running unnecessary listening events and all kinds of other bulldoodoo.

To the OP, thanks for asking this, it made it possible for me to read the answers and learn something!

And thanks to the others for answering!

Edited by Berksey
Adding a thank-you.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...