Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Texture from other prim

Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
04-29-2008 18:10
I'm trying to get a texture from another prim in the linkset and can't work out how to fix the type mismatch errors. Because I don't know what that means.
Can anyone see whats wrong and how to fix it please? Or why it's mismatched?
CODE

default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}

touch_start(integer total_number)
{
key texture;
texture = llMessageLinked(1,0, (llGetInventoryName(INVENTORY_TEXTURE,0)),NULL_KEY);
llSetPrimitiveParams([PRIM_TEXTURE, ALL_SIDES, texture,<1,1,1>, <1,1,1>, 0]);
}
}
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-29-2008 20:04
Well, it's ALL wrong.

llMessageLinked is what sends info and it looks like you are trying to get info from it. You also don't need to enclose the following because it is outputting a string which you need there anyway:

(llGetInventoryName(INVENTORY_TEXTURE,0))

should just be:

llGetInventoryName(INVENTORY_TEXTURE,0)

I guess people get kind of scared with link messages at first but it is really as simple as llSays and listen events and here is where you can start off on the right foot:

http://lslwiki.net/lslwiki/wakka.php?wakka=ExampleLinkMessage
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-29-2008 20:13
And forgot that you might want to look here also:

http://lslwiki.net/lslwiki/wakka.php?wakka=llSetLinkTexture

After looking at that, you might want to start over and tell us exactly what you are trying to do and we will be glad to walk you through it.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
04-29-2008 22:11
Thanks for that but I'm not scared I just cant figure out the sequence of commands I need to achieve it. Posing the question is just as hard as doing it. I've searched several times and wrote to scripters for help so here I am.

The main script already works I want to add funtionality as I go.
It is for walls and windows in builds.

Each prim has it's own script and can set textures that are inside the prim with variables read from a notecard.

I want to put a set of textures into one prim (Area Control) in a link set and use those instead of putting them into each prim. ( I also want to do this with access control but that's another matter.)

So the sequence goes:
Ask for texture with linkmessage in prim 1.
llMessageLinked(1,0, gettexture,NULL_KEY );

Reply with texture info
if (message=="gettexture";) llGetInventoryName(INVENTORY_TEXTURE,0);
llMessageLinked(?, 0, textureis,NULL_KEY );
How do I know which prim asked for the texture?

Listen for texture info
linkmessage
if (message=="textureis";) settexture()

Apply texture info

key textureis;
settexture() llSetPrimitiveParams([PRIM_TEXTURE, ALL_SIDES, textureis,<1,1,1>, <1,1,1>, 0]);

If I post the whole script you would go mad because it's messy.
Just some tips might help me...please?
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
04-30-2008 03:48
well the main place you've gone wrong is that with link_message the default for the string is "string str" and not message. Messages are for listens not link messages to help keep things easier to understand when debugging.

Also are you setting up textureis as a variable such as:

CODE

string textureis = llGetInventoryName(INVENTORY_TEXTURE,0);


The prim sender number is sent to the link_message(integer sender_num, integer num, string str, key id);

Therefor you would end up with something like;

CODE

if (str=="gettexture")

string textureis = llGetInventoryName(INVENTORY_TEXTURE,0);

llMessageLinked(sender_num, 0, textureis, NULL_KEY );


The key here is "integer sender_num"

so you could have;

CODE

if (str=="gettexture" && sender_num == 5)

string textureis = llGetInventoryName(INVENTORY_TEXTURE,0);

llMessageLinked(sender_num, 0, textureis,NULL_KEY );


to check that it was the link number 5 prim that sent the "gettexture" message.

Your llMessageLinked would be

CODE

llMessageLinked(sender_num, 0, textureis, NULL_KEY);


to send back to link number 5.

The key with link messages is knowing which prim is which link number.

CODE

default
{
state_entry()
{
llOwnerSay("My link number is " + (string)llGetLinkNumber());
}
}


will help you there if you want to hard code the link number. Drop script into prim you want link number of and it will spit it out in chat.

I am also wondering why you are using the llGetInventoryName() as I'm pretty sure llSetTexture() uses a UUID key by default so wouldn't it be simpler just to get and send the key using:

CODE

llGetInventoryKey(INVENTORY_TEXTURE,0);


Hope that helps some :)
_____________________
Tread softly upon the Earth for you walk on my face.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-30-2008 03:55
I'll give it a try this evening.


EDIT: Hey nice explanation Django!
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Shyan Graves
Registered User
Join date: 10 Feb 2007
Posts: 52
04-30-2008 04:00
From: Kornscope Komachi
...

So the sequence goes:
Ask for texture with linkmessage in prim 1.
llMessageLinked(1,0, gettexture,NULL_KEY );

Reply with texture info
if (message=="gettexture";) llGetInventoryName(INVENTORY_TEXTURE,0);
llMessageLinked(?, 0, textureis,NULL_KEY );
How do I know which prim asked for the texture?


Like it is explained in the WIKI http://lslwiki.net/lslwiki/wakka.php?wakka=link_message

link_message(integer sender_num, integer num, string str, key id)

sender_num is the link number of the sending object in the set.


Regards,
Shyan
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
04-30-2008 04:50
Thank you for your replies and help
The part that helps a lot is:
if (str=="gettexture" && sender_num == 5)
to do the check on what and where.
I would not have thought to use two &&'s or =='s either.

Seems I can only learn from examples.Even small ones.
I am a house painter not a coder so my brain works very differently.
Thanks ALL for your help. Ill be back if I cant make it work.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-30-2008 04:56
From: Django Yifu

CODE

llGetInventoryKey(INVENTORY_TEXTURE,0);



Unless its been changed while I was away this will fail (return the NULL KEY) unless the texture is full mod.I'd suggest using llSetLinkTexture as Jesse suggested earlier.

From: LSL Wiki
Sets the texture of linked prims. The ruleset is the same as used in llSetTexture.
When using a named texture, the texture in the calling prim's inventory is used.


Not sure if you will still run into problems with non mod / non copy textures.
_____________________
I'm back......
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
04-30-2008 07:53
If I use SetLinkTexture can I still set the variables from the notecard in the calling prim?

People will add their own textures which may be no mod.

So far I have this;
This part even compiles
CODE


//this prim is asking for texture 0 from the controller
integer sender_num; //
string str;
key texture_0_is;

default
{
state_entry()
{
}

touch_start(integer total_number)
{
llMessageLinked(LINK_SET,0, "gettexture0"+ (string)llGetLinkNumber(),NULL_KEY);
}
link_message(integer sender, integer num, string message, key id)
{
if (str=="texture_0_is" && sender_num == 2)
llSetPrimitiveParams([PRIM_TEXTURE, ALL_SIDES, texture_0_is,<1,1,1>, <1,1,1>, 0]);
}
}

But this part doesn't. I know it's all wrong but not why.
CODE

//Texture 0 is inside this prim, The Controller.
integer link_num;
string str;
string texture_0_is = llGetInventoryKey(INVENTORY_TEXTURE,0);

default
{
state_entry()
{
}

link_message(integer sender, integer num, string message, key id)
{


if (str=="gettexture0" + link_num ) llMessageLinked(link_num,0,texture_0_is, NULL_KEY);

}
}



off to sleep.
Kidd Krasner
Registered User
Join date: 1 Jan 2007
Posts: 1,938
04-30-2008 08:03
From: Kornscope Komachi

//Texture 0 is inside this prim, The Controller.
...
string texture_0_is = llGetInventoryKey(INVENTORY_TEXTURE,0);

You cannot call functions when you initialize globals. Change this to be simply
CODE

string texture_0_is;

and add the initialization to the state_entry event:
CODE

state_entry() {
texture_0_is = llGetInventoryKey(INVENTORY_TEXTURE,0);
...
}
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
04-30-2008 08:14
From: Newgate Ludd
Unless its been changed while I was away this will fail (return the NULL KEY) unless the texture is full mod.I'd suggest using llSetLinkTexture as Jesse suggested earlier.



Not sure if you will still run into problems with non mod / non copy textures.



Really? I'm sure I have used this in the past to access textures other builders have used. Of course I mean people I work with and not other random builders who's items I do not have the right to play with.

Come to think of it, I have used a similar principle in getting the texture applied to a prim not an inventory texture so ignore this post.

/me looks for delete ...oops that's post :)
_____________________
Tread softly upon the Earth for you walk on my face.
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
04-30-2008 16:41
Still battling..and about to give up. One more ask.
Tried using llSay to see if anything works.
CODE

//this prim is asking for texture 0 from the controller
integer sender_num;
string str;
key texture_0_is;

default
{
state_entry()
{
}

touch_start(integer total_number)
{
//llMessageLinked(LINK_SET,0, "gettexture0"+ (string)llGetLinkNumber(),NULL_KEY);
llSay(0,"gettexture0"+ (string)llGetLinkNumber());
}
link_message(integer sender, integer num, string message, key id)
{
if (str=="texture_0_is" && sender_num == 2)
llSay(0,(string)texture_0_is + (integer)sender_num);
//llSetPrimitiveParams([PRIM_TEXTURE, ALL_SIDES, texture_0_is,<1,1,1>, <1,1,1>, 0]);
}
}

And no, nothing does.
CODE

//Texture 0 is inside this prim, The Controller.
string link_num;//changed from integer to string
string str;
key texture_0_is;//adjusted and moved...
string link_number;

default
{
state_entry()
{
texture_0_is = (key)llGetInventoryKey(INVENTORY_TEXTURE,0);//...moved here
link_number = (string)llGetLinkNumber();
}
touch_start(integer total_number)
{
llSay(0,texture_0_is + link_num );
}
link_message(integer sender, integer num, string message, key id)
{
if (str=="gettexture0" + link_num )
llSay(0,(string)texture_0_is + link_num );
//llMessageLinked(link_num,0,texture_0_is, NULL_KEY);//cursor stops at the N

}
}

Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-30-2008 17:44
Hey don't give up on us.

Let's start with the basics.
Create a prim and drop this script in:

CODE
default {
touch_start(integer n) {
string str = "I am a link msg from Link #";
llMessageLinked( LINK_SET, 0, str, NULL_KEY);
}
}

Create a second prim and put this in:
CODE
default {
link_message(integer sender_num, integer num, string str, key id) {
llOwnerSay(str + (string)sender_num);
}
}

Link both prims and touch one. Depending on which one you selected last when linking, it will return:

[17:38] Object: I am a link msg from Link #1

or

[17:39] Object: I am a link msg from Link #2

As you can see, you don't have to define the link #. The link_message event automatically gets the sender_num. So if the link message came from link 35 for example and you want to respond just to it then you would format the question/response like this:
CODE
default {
touch_start(integer n) {
string str = "texture-0";
llMessageLinked( LINK_SET, 0, str, NULL_KEY);
}
}

CODE
default {
link_message(integer sender_num, integer num, string str, key id) {
string reply =llGetInventoryKey(str);//looks for an inventory item named texture-0
llMessageLinked( sender_num, 0, reply, NULL_KEY);
}
}


Now the second script has sent the texture key in the form of a string. All you have to do is add a link_message event to the first script to recieve it and aplly the texture.


But the next question is; You are putting this in a house to control the textures on windows etc. Is the whole house just one linkset? If it isn't, then link messages won't work and you are going to have to use llRegionSay and listens.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
04-30-2008 20:00
I really appreciate anyone putting in time to help me.:) Thank you very much!
I won't bother anyone again.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-30-2008 20:06
From: Kornscope Komachi
I really appreciate anyone putting in time to help me.:) Thank you very much!
I won't bother anyone again.


OMG Kornscope! You had better bother us a whole bunch more! That's why we are here and we love for people to learn. Sounds like you are working on a pretty big project for someone new. Keep hitting us up with questions and we will get it worked out.

If it seems like too much at first then just back off and play with just parts of the script ie; like just the messaging part, then move onto the next part and work it seperately until it works. Eventually it will all come together.

Hopefully you have also discovered LSLeditor by now. It will make your life much, much easier.

EDIT: Plus I forgot to add that you will be surprised just how helpfull we can really be when someone like you is making a concerted effort to try, instead of just coming here asking for freebie scripts. If you get tired and discouraged then take a break and explain in full detail exactly how you want everything to work when you are done.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
05-01-2008 08:22
Thanks Jesse, I been workin on this script for over a year, Wasn't going to show it but may as well, it's really simple and 1 of about 11 scripts I have been making in the set. So far.
I bought a few commercial ones but they didnt do what I wanted. A lot of wasted lindens, I must say.
I'm just trying to make it easier for people to add their own textures into one prim instead of 20 or more. I thought It would be much easier.
It took me 3 months just to work out how to make the rotations work with degrees instead of radians in the notecard. Nobody wants to put in 1.35674633 or whatever it is to turn 90 deg.
It works, but I know it's messy and not efficient. it's just cobbled together.
And don't anybody waste any time on it. for me at least.

As for the addition of why Im here, Im still scratching my head on how to make it work, before I even contemplate how to implement it.
CODE

//



///
//
integer CHANNEL = -27001025; // Build#
string notecard = "config";
//-----------///Settings
float a1 = 1.0; //0 Percent ALPHA
float a2 = 0.75; //75
float a3 = 0.5; //50
float a4 = 0.25; //25
float a0 = 0.0; // 100 Percent
//----------//----------------------------------------------//---------->Interior Settings.
IntOne() {float rads1 = (rot1 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side1, (llGetInventoryName(INVENTORY_TEXTURE,0)), reps1, offs1, rads1,PRIM_COLOR, side1, col1, a1]);}
IntTwo() {float rads1 = (rot1 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side1, (llGetInventoryName(INVENTORY_TEXTURE,1)), reps1, offs1, rads1,PRIM_COLOR, side1, col1, a1]); return; }
IntThree() {float rads1 = (rot1 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side1, (llGetInventoryName(INVENTORY_TEXTURE,2)), reps1, offs1, rads1,PRIM_COLOR, side1, col1, a1]); return; }
IntFour() {float rads1 = (rot1 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side1, (llGetInventoryName(INVENTORY_TEXTURE,3)), reps1, offs1, rads1,PRIM_COLOR, side1, col1, a1]); return; }
IntFive() {float rads1 = (rot1 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side1,(llGetInventoryName(INVENTORY_TEXTURE,4)),reps1, offs1, rads1,PRIM_COLOR, side1, col1, a1]); return; }
IntSix() {float rads1 = (rot1 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side1, (llGetInventoryName(INVENTORY_TEXTURE,5)) ,reps1, offs1, rads1,PRIM_COLOR, side1, col1, a1]); return; }
IntCustom() {float rads1 = (rot1 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side1,llGetObjectDesc(),reps1, offs1,rads1,PRIM_COLOR, side1, col1,a1]); return;}
Int100(){llSetPrimitiveParams([PRIM_COLOR, side1, alphatint1, a1]);return; }
Int75(){llSetPrimitiveParams([PRIM_COLOR, side1, alphatint1, a2]);return; }
Int50(){llSetPrimitiveParams([PRIM_COLOR, side1, alphatint1, a3]);return; }
Int25(){llSetPrimitiveParams([PRIM_COLOR, side1, alphatint1, a4]);return; }
Int0(){llSetPrimitiveParams([PRIM_COLOR, side1, alphatint1, a0]);return; }
//-------//-----------------------------------------------------//------->Exterior settings
ExtOne() {float rads2 = (rot2 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side2, (llGetInventoryName(INVENTORY_TEXTURE,0)), reps2, offs2, rads2,PRIM_COLOR, side2, col1, a1]);return; }
ExtTwo() {float rads2 = (rot2 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side2, (llGetInventoryName(INVENTORY_TEXTURE,1)), reps2, offs2, rads2,PRIM_COLOR, side2, col1, a1]);return; }
ExtThree() {float rads2 = (rot2 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side2,(llGetInventoryName(INVENTORY_TEXTURE,2)), reps2, offs2, rads2,PRIM_COLOR, side2, col1, a1]);return; }
ExtFour() {float rads2 = (rot2 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side2, (llGetInventoryName(INVENTORY_TEXTURE,3)) ,reps2, offs2, rads2,PRIM_COLOR, side2, col1, a1]);return; }
ExtFive() {float rads2 = (rot2 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side2, (llGetInventoryName(INVENTORY_TEXTURE,4)) ,reps2, offs2, rads2,PRIM_COLOR, side2, col1, a1]);return; }
ExtSix() {float rads2 = (rot2 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side2, (llGetInventoryName(INVENTORY_TEXTURE,5)) ,reps2, offs2, rads2,PRIM_COLOR, side2, col1, a1]);return; }
ExtCustom() {float rads2 = (rot2 * DEG_TO_RAD);llSetPrimitiveParams([PRIM_TEXTURE, side2,llGetObjectDesc(), reps2, offs2, rads2, PRIM_COLOR, side2, col1,a1]); return;}
Ext100(){llSetPrimitiveParams([PRIM_COLOR, side2, alphatint2, a1]);return; }
Ext75(){llSetPrimitiveParams([PRIM_COLOR, side2, alphatint2, a2]);return; }
Ext50(){llSetPrimitiveParams([PRIM_COLOR, side2, alphatint2, a3]);return; }
Ext25(){llSetPrimitiveParams([PRIM_COLOR, side2, alphatint2, a4]);return; }
Ext0(){llSetPrimitiveParams([PRIM_COLOR, side2, alphatint2, a0]);return; }
//-----------//-------------------------------------------//-----------//MENUS
list MENU_INSIDE = ["Int_Four","Int_Five","Int_Six","Int_One","Int_Two","Int_Three","IntCustom","Alpha","Outside"];
list MENU_OUTSIDE = ["Ext_Four","Ext_Five","Ext_Six","Ext_One","Ext_Two","Ext_Three","ExtCustom","Alpha","Inside"];
list MENU_ALPHAS = ["Int_75","Int_50","Int_25","Ext_75","Ext_50","Ext_25","Ext_100","Ext_0","Int_0","Int_100","Inside","Outside"];
integer listen_handle;
integer noteline;
key kQuery;
string tex1;string tex2;string tex3;string tex4;string tex5;string tex6;vector col1;vector col2;
integer side1;integer side2;vector reps1;vector offs1;vector reps2;vector offs2; float rot1; float rot2;
string linkup;vector alphatint1;vector alphatint2;
///---------------// parameters are stored as name=data (item=value)in TexConfig notecard
GetParameters(string str){
list lsdata = llParseString2List(str, ["="], [""]);
string item = llList2String(lsdata,0);
string value = llList2String(lsdata,1);
integer intvalue = (integer)value;
llOwnerSay("Reading " + item + " is set at:" + value);
if ("tex1" == item) { tex1 = value;return; }
if ("tex2" == item) { tex2 = value;return; }
if ("tex3" == item) { tex3 = value;return; }
if ("tex4" == item) { tex4 = value;return; }
if ("tex5" == item) { tex5 = value;return; }
if ("tex6" == item) { tex6 = value;return; }
if ("side1" == item) { side1 = (integer)value;return; }
if ("reps1" == item) { reps1 = (vector )value;return; }
if ("offs1" == item) { offs1 = (vector )value;return; }
if ("side2" == item) { side2 = (integer)value;return; }
if ("reps2" == item) { reps2 = (vector )value;return; }
if ("offs2" == item) { offs2 = (vector )value;return; }
if ("rot1" == item) { rot1 = (float )value;return; }
if ("rot2" == item) { rot2 = (float )value;return; }
if ("col1" == item) { col1 = (vector )value;return; }
if ("col2" == item) { col2 = (vector )value;return; }
if ("alphatint1" == item){alphatint1 = (vector )value;return;}
if ("alphatint2" == item){alphatint2 = (vector )value;return;}
if ("linkup" == item) { linkup = (string )value;return; }
}
ChangedStatus(integer change){// Test for a changed inventory
if (change & CHANGED_INVENTORY) {
WarnOfTransfer() ;
}
else if (change & CHANGED_OWNER) {
WarnOfTransfer() ;
}
}
WarnOfTransfer()
{
key avkey = llGetOwner();
string avname = llKey2Name(avkey);
string creatorkey = llGetInventoryCreator(llGetScriptName());
string item = llGetScriptName();
integer nextPerms = llGetInventoryPermMask(item, MASK_NEXT);
if (nextPerms & PERM_TRANSFER ){
llOwnerSay(""+ avname + ", this script set to allow 'Transfer' \nTo avoid problems, please set these scripts to 'No Transfer' *BEFORE* copying to prims.\nTracing Keys... ScriptOwnerName2IM is," + avname + ",...Disabling script.\nIf you purchased this script legally, please read the instructions.\nIf not aquired legally "+ avname + " will be added to a list!");
llInstantMessage("1947705f-bca1-4480-881a-77ec4a00cb68", "ALERT: TTCS script being used transfer 'ON' Creatorkey is " + creatorkey + "," + llGetScriptName() + "," + avname + " is the detected owner " );
llOwnerSay( "Script disabled.");
llSetScriptState(item,FALSE); }
else if (nextPerms & PERM_COPY){
llOwnerSay("Permissions set ok.. continuing.");llResetScript(); }
}
//-----------//----------// Used only for initialisation//-----------//----------
default
{
state_entry()
{
state ReadConfig;
}
changed(integer change) { ChangedStatus(change); }
}
//-----------//----------//-Main State//-----------//----------
state Running
{
state_entry() { }
touch_start(integer total_number) {
CHANNEL = (integer) llFrand (1000000)+1;
listen_handle = llListen(CHANNEL, "",NULL_KEY, "");
if ((llDetectedKey(0) == llGetOwner()) || (llSameGroup(llDetectedKey(0)) == TRUE))
llDialog(llDetectedKey(0), "Inside Window Settings.", MENU_INSIDE, CHANNEL);
else if ((llDetectedKey(0) == llGetOwner()) || (llSameGroup(llDetectedKey(0)) == FALSE))
llWhisper(0,"Not Allowed, Ask the owner!");
llSetTimerEvent(30.0);
}
timer() {
llListenRemove(listen_handle); //Remove that dialog listener
llSetTimerEvent(0);}
//-------//-----------------------------------------------------//-------> LISTEN
listen(integer channel, string name, key id, string message) {
if (llListFindList(MENU_INSIDE + MENU_OUTSIDE + MENU_ALPHAS, [message]) != -1) {
if (message == "Outside"){llDialog(id, "Outside Window Settings!", MENU_OUTSIDE, CHANNEL);
llSetTimerEvent(30.0); }
else if (message == "Inside"){llDialog(id, "Inside Window Settings.", MENU_INSIDE, CHANNEL);
llSetTimerEvent(30.0); }
else if (message == "Alpha") { llDialog(id, "Alpha Values." , MENU_ALPHAS, CHANNEL);
llSetTimerEvent(30.0); }
//----------//----------------------------------------------//---------->Interior Settings.
if (message=="Int_One") { IntOne();llMessageLinked(LINK_SET, 0, "Int_One"+ linkup, NULL_KEY); }
if (message=="Int_Two") { IntTwo();llMessageLinked(LINK_SET, 0,"Int_Two"+ linkup, NULL_KEY); }
if (message=="Int_Three") { IntThree();llMessageLinked(LINK_SET, 0,"Int_Three"+ linkup, NULL_KEY);}
if (message=="Int_Four") { IntFour();llMessageLinked(LINK_SET, 0,"Int_Four"+ linkup, NULL_KEY);}
if (message=="Int_Five") { IntFive();llMessageLinked(LINK_SET, 0,"Int_Five"+ linkup, NULL_KEY); }
if (message=="Int_Six") { IntSix();llMessageLinked(LINK_SET, 0,"Int_Six"+ linkup, NULL_KEY); }
if (message=="IntCustom") { IntCustom();llMessageLinked(LINK_SET, 0,"IntCustom"+ linkup, NULL_KEY); }
if (message=="Int_100") { Int100();llMessageLinked(LINK_SET, 0,"Int_100"+ linkup,NULL_KEY); }
if (message=="Int_75") { Int75();llMessageLinked(LINK_SET, 0,"Int_75"+ linkup,NULL_KEY); }
if (message=="Int_50") { Int50();llMessageLinked(LINK_SET, 0,"Int_50"+ linkup,NULL_KEY); }
if (message=="Int_25") { Int25();llMessageLinked(LINK_SET, 0,"Int_25"+ linkup,NULL_KEY); }
if (message=="Int_0") { Int0();llMessageLinked(LINK_SET, 0,"Int_0"+ linkup,NULL_KEY); }
//-------//-------------------------------{----------------------//------->Exterior settings
if (message=="Ext_One") { ExtOne();llMessageLinked(LINK_SET, 0,"Ext_One"+ linkup, NULL_KEY); }
if (message=="Ext_Two") { ExtTwo();llMessageLinked(LINK_SET, 0,"Ext_Two"+ linkup, NULL_KEY); }
if (message=="Ext_Three") { ExtThree();llMessageLinked(LINK_SET, 0,"Ext_Three"+ linkup, NULL_KEY);}
if (message=="Ext_Four") { ExtFour();llMessageLinked(LINK_SET, 0,"Ext_Four"+ linkup, NULL_KEY); }
if (message=="Ext_Five") { ExtFive();llMessageLinked(LINK_SET, 0,"Ext_Five"+ linkup, NULL_KEY); }
if (message=="Ext_Six") { ExtSix();llMessageLinked(LINK_SET, 0,"Ext_Six"+ linkup, NULL_KEY); }
if (message=="ExtCustom") { ExtCustom();llMessageLinked(LINK_SET, 0,"ExtCustom"+ linkup, NULL_KEY); }
if (message=="Ext_100") { Ext100();llMessageLinked(LINK_SET, 0,"Ext_100"+ linkup,NULL_KEY); }
if (message=="Ext_75") { Ext75();llMessageLinked(LINK_SET, 0,"Ext_75"+ linkup,NULL_KEY); }
if (message=="Ext_50") { Ext50();llMessageLinked(LINK_SET, 0,"Ext_50"+ linkup,NULL_KEY); }
if (message=="Ext_25") { Ext25();llMessageLinked(LINK_SET, 0,"Ext_25"+ linkup,NULL_KEY); }
if (message=="Ext_0") { Ext0();llMessageLinked(LINK_SET, 0,"Ext_0"+ linkup,NULL_KEY); }
}
else llSay(0, name + " picked invalid option '" + llToLower(message) + "'.");}

link_message(integer sender, integer num, string message, key id) {
//----------//----------------------------------------------//---------->Interior Settings.
if (message=="Int_One") { IntOne();llMessageLinked(LINK_SET, 0, "Int_One"+ linkup, NULL_KEY); }
if (message=="Int_Two") { IntTwo();llMessageLinked(LINK_SET, 0,"Int_Two"+ linkup, NULL_KEY); }
if (message=="Int_Three") { IntThree();llMessageLinked(LINK_SET, 0,"Int_Three"+ linkup, NULL_KEY);}
if (message=="Int_Four") { IntFour();llMessageLinked(LINK_SET, 0,"Int_Four"+ linkup, NULL_KEY);}
if (message=="Int_Five") { IntFive();llMessageLinked(LINK_SET, 0,"Int_Five"+ linkup, NULL_KEY); }
if (message=="Int_Six") { IntSix();llMessageLinked(LINK_SET, 0,"Int_Six"+ linkup, NULL_KEY); }
if (message=="IntCustom") { IntCustom();llMessageLinked(LINK_SET, 0,"IntCustom"+ linkup, NULL_KEY); }
if (message=="Int_100") { Int100();llMessageLinked(LINK_SET, 0,"Int_100"+ linkup,NULL_KEY); }
if (message=="Int_75") { Int75();llMessageLinked(LINK_SET, 0,"Int_75"+ linkup,NULL_KEY); }
if (message=="Int_50") { Int50();llMessageLinked(LINK_SET, 0,"Int_50"+ linkup,NULL_KEY); }
if (message=="Int_25") { Int25();llMessageLinked(LINK_SET, 0,"Int_25"+ linkup,NULL_KEY); }
if (message=="Int_0") { Int0();llMessageLinked(LINK_SET, 0,"Int_0"+ linkup,NULL_KEY); }
//-------//-------------------------------{----------------------//------->Exterior settings
if (message=="Ext_One") { ExtOne();llMessageLinked(LINK_SET, 0,"Ext_One"+ linkup, NULL_KEY); }
if (message=="Ext_Two") { ExtTwo();llMessageLinked(LINK_SET, 0,"Ext_Two"+ linkup, NULL_KEY); }
if (message=="Ext_Three") { ExtThree();llMessageLinked(LINK_SET, 0,"Ext_Three"+ linkup, NULL_KEY);}
if (message=="Ext_Four") { ExtFour();llMessageLinked(LINK_SET, 0,"Ext_Four"+ linkup, NULL_KEY); }
if (message=="Ext_Five") { ExtFive();llMessageLinked(LINK_SET, 0,"Ext_Five"+ linkup, NULL_KEY); }
if (message=="Ext_Six") { ExtSix();llMessageLinked(LINK_SET, 0,"Ext_Six"+ linkup, NULL_KEY); }
if (message=="ExtCustom") { ExtCustom();llMessageLinked(LINK_SET, 0,"ExtCustom"+ linkup, NULL_KEY); }
if (message=="Ext_100") { Ext100();llMessageLinked(LINK_SET, 0,"Ext_100"+ linkup,NULL_KEY); }
if (message=="Ext_75") { Ext75();llMessageLinked(LINK_SET, 0,"Ext_75"+ linkup,NULL_KEY); }
if (message=="Ext_50") { Ext50();llMessageLinked(LINK_SET, 0,"Ext_50"+ linkup,NULL_KEY); }
if (message=="Ext_25") { Ext25();llMessageLinked(LINK_SET, 0,"Ext_25"+ linkup,NULL_KEY); }
if (message=="Ext_0") { Ext0();llMessageLinked(LINK_SET, 0,"Ext_0"+ linkup,NULL_KEY); }

}
changed(integer change) { ChangedStatus(change); }
on_rez(integer num) { WarnOfTransfer(); }
}
//--------------------------------------------------------------------------------
state ReadConfig
{
state_entry()
{
noteline = 0;
integer itemtype = llGetInventoryType(notecard);
if(INVENTORY_NOTECARD == itemtype)
{
kQuery = llGetNotecardLine(notecard, noteline);
llSetTimerEvent(10);
}
else {
llOwnerSay("Error - configuration notecard missing, Using defaults only!");
state Running; }
}
dataserver( key query_id, string sdata ) // read from the notecard
{
if(query_id == kQuery)
{ if (sdata != EOF){
if(llStringLength(sdata) > 3)
{
GetParameters(sdata);
} noteline++;
kQuery = llGetNotecardLine( notecard, noteline );}
else
{
llSetTimerEvent(0);
llOwnerSay("Data is read. Here's the output!");
state Running; }}
}
timer() {
llListenRemove(listen_handle);
llOwnerSay("ERROR - Dataserver time out! aborting");
llSetTimerEvent(0);
state Running;
}
on_rez(integer num) {WarnOfTransfer(); }
changed(integer change) { ChangedStatus(change); } // if something has been updated reset
}
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
05-17-2008 00:42
Been trying for many hours but can't do it. Will now ask for paid help. Thanks anyway.
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-18-2008 07:47
From: Kornscope Komachi
Been trying for many hours but can't do it. Will now ask for paid help. Thanks anyway.


Rather than ask for paid help post some of your code with the results you obtained (or not!). Its far easier to help you if we have code to play with.

The following is a very minimial script to swap textures on a linked prim.

CODE

list textures = [ "29e3578a-1b35-4ada-93db-a89f85d866e7","70ffd5af-6afc-0dbe-0053-81ff47d921b8" ];

integer index = 0;
integer length = 1;
default
{
state_entry()
{
llSetTimerEvent(0.0);
}

touch_start(integer total_number)
{
llSay(0, "Touched.");
state Running;
}
}

state Running
{
state_entry()
{
llSetTimerEvent(3.0);
}

timer()
{
// Set my texture
llSetTexture(llList2String(textures,index), ALL_SIDES);
// Set another prims texture
llSetLinkTexture(1,llList2String(textures,index), ALL_SIDES);
++index;
if(index >length)
{
index = 0;
}
}

touch_start(integer total_number)
{
state default;
}
}
_____________________
I'm back......
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
badly written question
06-09-2008 02:46
Removed... badly scripted examples, again.
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
Try again...
06-09-2008 06:19
Try again...
Still going on this.. I hired a scriptor 3 weeks ago who I haven't heard back from after giving half of 16k for the job. There was more than this though.

So I have tried to complete this part of my project and I am stuck on the same thing. just can't seem to even fluke getting the correct syntax or code whatever in the right place.

To test this, I have three prims (4 counting a neutral root prim) linked. Red, green and blue.
Green is the controller and holds the textures in it's contents. Blue is a slave and responds to green. Red responds to green also and up to here it's fine.

Red wants to control itself as well and get it's texture info from the green prim. This is what I can't get. I have tried many variations. I have even tried to draw images to try to see the flow as in a flow chart.
It seems i am not getting the return message correct or even sending the message correctly or if it's the right way to do it.

There will be many prims used in each project in differing shapes and sizes. I want to simply drop a set script in each prim and config the notecard as each prim will have it's own settings. This is the way I do it atm.
Not sure if I should be trying to get link_numbers or sender_numbers or if I do will the script become huge to match every prim.

Here are the scripts. If you can help, please do. Or just the idea I am missing.
green
CODE

//GreenCube=control
string tex0;
string int1;
default
{

state_entry()
{
llSay(0,"green ready");
llSetTexture("5748decc-f629-461c-9a36-a35a221fe21f",0);
int1 = llGetInventoryName(INVENTORY_TEXTURE,0);
}

touch_start(integer total_number)
{
llSay(0,"one");
llSay(0,llGetInventoryKey(tex0));
llMessageLinked(LINK_SET, 0,llGetInventoryKey(int1), NULL_KEY);
}


link_message(integer sender_num, integer num, string str, key id)
{
if (str=="int1") {
llMessageLinked(sender_num, 0,(llGetInventoryKey(tex0)), NULL_KEY);
llSay(0,tex0);}
llSetTexture(str,0);
}
}

red
CODE

//red cube = slave
string texname;
string str;
string tex0;
string int1;//wanted texture
key settex;

default
{
state_entry()
{
llSay(0,"red ready");
llSetTexture("5748decc-f629-461c-9a36-a35a221fe21f",0);
}

touch_start(integer total_number)
{
llSay(0, str);
llMessageLinked(LINK_SET, 0,"int1",NULL_KEY);
llSetTexture(str,0);
}

link_message(integer sender_num, integer num, string str, key id)
{
if (str==str) {
llSay(0,str);
llSetTexture(str,0);}
}


}


blue

CODE

default
{

state_entry()
{
llSay(0,"blue ready");
llSetTexture("5748decc-f629-461c-9a36-a35a221fe21f",0);
}
link_message(integer sender_num, integer num, string str, key id)
{
llSay(0,str);
llSetTexture(str,0);
}
}

_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
06-09-2008 08:05
Definitely no on here is considering it a bother, it's what the forum is for :) The one thing (besides the errors that others have already helped you with) that jumps out at me in your first example is how you were trying to cram everything together. No one liner contests to win here... when scripting, try to break everything down into smaller steps, and your scripts will be much easier to follow, not only for anyone else looking at them, but for yourself as well. :)


http://www.secondscripter.com/
_____________________
My tutes
http://www.youtube.com/johanlaurasia
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
06-09-2008 18:06
I don't understand how I am trying to cram everything together.
This is the best that I could make it. I broke it several times trying to make it as nice to see and formatted for other scriptors.
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
06-09-2008 18:57
See if this helps with the basics:

CODE
integer n;

default
{
touch_start(integer total_number)
{
integer link = llDetectedLinkNumber(n);
llOwnerSay((string)link);
llSetLinkTexture(link,llGetInventoryName(INVENTORY_TEXTURE,link - 1),ALL_SIDES);
}
}


Example: Link 4 prims and put 4 textures in the root prim along with this script. Touch the 1st prim and the 1st texture will be applied to it, 2nd prim = 2nd texture, etc.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
06-09-2008 19:17
From: Kornscope Komachi
touch_start(integer total_number)
{
llSay(0, str);
llMessageLinked(LINK_SET, 0,"int1",NULL_KEY);
llSetTexture(str,0);
}


What I presume you're thinking here is that after the llMessageLinked, the message will to go off to the green prim, which will then send its reply, and the reply will be picked up by the link_message event of the red prim which will load up the variable str.

Unfortunately, it doesn't work that way. :(

Only one event can be active at a time. So after the MessageLinked call, the message does go to the green prim, and it does indeed send its reply. Unfortunately, since the touch_start event in the red prim is in progress, the message waits until the touch_start event is done before arriving and triggering the link_message event. This means that the variable str isn't set by the time your "llSetTexture(str,0);" line runs.

The solution is to set the texture in the link_message event.
1 2