Jump to content

Calling a Function in Another Script


Amphei Jierdon
 Share

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

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

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 :) 

 

 

Link to comment
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
Link to comment
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
Link to comment
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.
Link to comment
Share on other sites

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