|
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. //
/// // 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
|
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 //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 //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 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 -----------------------------------------------------------------
|