Jump to content

Leander Tyles

Resident
  • Posts

    75
  • Joined

  • Last visited

Everything posted by Leander Tyles

  1. thanks that fixed that particular hiccup, but it only leads to further complications because USERID was used for everything.... like in the ban state it was used to ensure the user wasnt stupid enough to ban himself for example. cant use ID thier because its not defined within scope ill post the complete code, but i know the problem is with that tiny snippet i posted earlier COMPLETE CODE integer secretchannel = -1000;key USERID;string housename;integer houserange = 40;integer notifyowner = TRUE;list buttons = ["Ban","Eject","Unsit","TP Home","Cancel"];list victims;integer listenvar;integer menu_handler; integer menu_channel;list order_buttons(list buttons){ return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);}default{ on_rez(integer start_param) { llResetScript(); housename = llGetObjectName(); } state_exit() { llSetTimerEvent(0.0); // unneccasery precuation } state_entry() { llSetObjectName(housename); if (USERID == NULL_KEY) llListen(secretchannel, "", "", "" ); else llListen(secretchannel, "", USERID, "" ); } timer() { llSetObjectName("SECURITY"); llSay(0,"took to long, timed-out"); llSetObjectName(housename); llSetTimerEvent(0.0); state default; } listen(integer channel, string name, key id, string message) { list data = llParseStringKeepNulls(message, ["|"], []); message = llList2String(data, 0); USERID = (key)llList2String(data, 1); if (channel == secretchannel) { if (message == "request:Security") { llSetObjectName("SECURITY MENU"); llDialog(USERID,"\nSECURITY MENU:\n\n* you have 60 seconds to make a choice.\n* issue cmds within chatrange.\n* if only 1 person nearby they autotargetted.\n* doesnt work on yourself",order_buttons(buttons),secretchannel); llSetObjectName(housename); // llSetTimerEvent(60); ALWAYS LISTENING ANYWAY } else if(message == "Eject") { state eject; } else if(message == "TP Home") { state tp_home; } else if(message == "Unsit") { state unsit; } else if(message == "Cancel") { state cancel; } else if(message == "Ban" && id == llGetOwner()) { state ban; } else if(message == "Ban" && id != llGetOwner()) { llSay(0,(string)USERID); llSetObjectName("SECURITY"); llSay(0,"sorry this is a owner only function."); llSetObjectName(housename); state default; }}}}// ALL CODE BELOW IS REPETITIVE //// TODO// * (localchatmsg) if avatar not llovermyland//-----------------state eject { on_rez(integer start_param) { llResetScript(); } state_entry() { llSensor("","",AGENT,houserange,PI); } state_exit() { llSetTimerEvent(0.0); } timer() { llSetObjectName("SECURITY"); llSay(0,"took to long, timed-out"); llSetObjectName(housename); llSetTimerEvent(0.0); listenvar = llListen(-11,"",USERID,""); llListenRemove(listenvar); state default; } sensor(integer num_detected) { if(num_detected > 1) { victims = []; integer i; for(i=0;i < num_detected;i++) { if(llDetectedKey(i) != USERID) { victims = victims + llDetectedName(i); } } if(i == num_detected) { llListen(-11,"",USERID,""); llDialog(USERID,"\nChoose Your Target",victims,-11); } } if(num_detected == 1 && llDetectedName(0) != llKey2Name(USERID)) { llSay(0,llDetectedName(0) + " has been ejected from parcel"); llEjectFromLand(llDetectedKey(0)); if (notifyowner == TRUE) { llSetObjectName("SECURITY CONTROL"); llInstantMessage(llGetOwner(),llKey2Name(USERID) + " [Ejected] " +llDetectedName(0)); llSetObjectName(housename); state default; } } if(num_detected == 1 && llDetectedName(0) == llKey2Name(USERID)) { state default; }} listen(integer channel,string name,key id,string message) { llSensor(message,"",AGENT,houserange,PI); } no_sensor() { llSay(0,"Nobody detected within " + (string)houserange +"m"); state default; } } state ban { on_rez(integer start_param) { llResetScript(); } state_entry() { llSensor("","",AGENT,houserange,PI); } state_exit() { llSetTimerEvent(0.0); // unneccasery precuation } timer() { llSetObjectName("SECURITY"); llSay(0,"took to long, timed-out"); llSetObjectName(housename); llSetTimerEvent(0.0); listenvar = llListen(-11,"",USERID,""); llListenRemove(listenvar); // unneccasery but good practise state default; } sensor(integer num_detected) { if(num_detected > 1) { victims = []; integer i; for(i=0;i < num_detected;i++) { if(llDetectedKey(i) != USERID) { victims = victims + llDetectedName(i); } } if(i == num_detected) { llListen(-11,"",USERID,""); llDialog(USERID,"\nChoose Your Target",victims,-11); } } if(num_detected == 1 && llDetectedName(0) != llKey2Name(USERID)) { llSay(0,llDetectedName(0) + " has been banned from parcel"); llAddToLandBanList(llDetectedKey(0),0); state default; // owner only feature so a pointless notification // if (notifyowner == TRUE) { // llSetObjectName("SECURITY CONTROL"); // llInstantMessage(llGetOwner(),llKey2Name(USERID) + " [banned] " +llDetectedName(0)); } if(num_detected == 1 && llDetectedName(0) == llKey2Name(USERID)) { state default; }} listen(integer channel,string name,key id,string message) { llSensor(message,"",AGENT,houserange,PI); } no_sensor() { llSay(0,"Nobody detected within " + (string)houserange +"m"); state default; } } state tp_home { on_rez(integer start_param) { llResetScript(); } state_entry() { llSensor("","",AGENT,houserange,PI); } state_exit() { llSetTimerEvent(0.0); } timer() { llSetObjectName("SECURITY"); llSay(0,"took to long, timed-out"); llSetObjectName(housename); llSetTimerEvent(0.0); llListenRemove(listenvar); state default; } sensor(integer num_detected) { if(num_detected > 1) { victims = []; integer i; for(i=0;i < num_detected;i++) { if(llDetectedKey(i) != USERID) { victims = victims + llDetectedName(i); } } if(i == num_detected) { listenvar = llListen(-11,"",USERID,""); llDialog(USERID,"\nChoose Your Target",victims,-11); llSetTimerEvent(60); } } if(num_detected == 1 && llDetectedName(0) != llKey2Name(USERID)) { llSay(0,llDetectedName(0) + " has been sent home"); llTeleportAgentHome(llDetectedKey(0)); if (notifyowner == TRUE) { llSetObjectName("SECURITY CONTROL"); llInstantMessage(llGetOwner(),llKey2Name(USERID) + " [sent Home] " +llDetectedName(0)); llSetObjectName(housename); state default; } } if(num_detected == 1 && llDetectedName(0) == llKey2Name(USERID)) { state default; }} listen(integer channel,string name,key id,string message) { llSensor(message,"",AGENT,houserange,PI); } no_sensor() { llSay(0,"Nobody detected within " + (string)houserange +"m"); state default; } } state unsit { on_rez(integer start_param) { llResetScript(); } state_entry() { llSensor("","",AGENT,houserange,PI); } state_exit() { llSetTimerEvent(0.0); } timer() { llSetObjectName("SECURITY"); llSay(0,"took to long, timed-out"); llSetObjectName(housename); llSetTimerEvent(0.0); llListenRemove(listenvar); state default; } sensor(integer num_detected) { if(num_detected > 1) { victims = []; integer i; for(i=0;i < num_detected;i++) { if(llDetectedKey(i) != USERID) { victims = victims + llDetectedName(i); } } if(i == num_detected) { listenvar = llListen(-11,"",USERID,""); llDialog(USERID,"\nChoose Your Target",victims,-11); llSetTimerEvent(60); } } if(num_detected == 1 && llDetectedName(0) != llKey2Name(USERID)) { llUnSit(llDetectedKey(0)); if (notifyowner == TRUE) { llSetObjectName("SECURITY CONTROL"); llInstantMessage(llGetOwner(),llKey2Name(USERID) + " [unsat] " +llDetectedName(0)); llSetObjectName(housename); state default; } } if(num_detected == 1 && llDetectedName(0) == llKey2Name(USERID)) { state default; }} listen(integer channel,string name,key id,string message) { llSensor(message,"",AGENT,houserange,PI); } no_sensor() { llSay(0,"Nobody detected within " + (string)houserange +"m"); state default; } } state cancel{ on_rez(integer start_param) { llResetScript(); } state_exit() { llSetTimerEvent(0.0); // unneccasery precuation } state_entry() { state default; }}
  2. thnx for the responce, but unfortunatly didnt fix it
  3. no matter what i do, i cant make this code work properly, long story short it says im not the owner but as you can see from the localchat below llGetOwner() and USERID both match. but then thiers blank lines for some reason so somethings wrong USERID is a global variable so i dont know what else i can do [15:20] : 3e777790-f352-4571-bb1e-460048a4d8fe [15:20] : 3e777790-f352-4571-bb1e-460048a4d8fe [15:20] : [15:20] : 3e777790-f352-4571-bb1e-460048a4d8fe [15:20] : [15:20] SECURITY: sorry this is a owner only function. the blankline looks like its forgetting the USERID listen(integer channel, string name, key id, string message) { list data = llParseStringKeepNulls(message, ["|"], []); message = llList2String(data, 0); USERID = llList2String(data, 1); llSay(0,(string)USERID); llSay(0,(string)llGetOwner()); if (channel == secretchannel) { if (message == "request:Security") { llSetObjectName("SECURITY MENU"); llDialog(USERID,"\nSECURITY MENU:\n\n* you have 60 seconds to make a choice.\n* issue cmds within chatrange.\n* if only 1 person nearby they autotargetted.\n* doesnt work on yourself",order_buttons(buttons),secretchannel); llSetObjectName(housename); // llSetTimerEvent(60); ALWAYS LISTENING ANYWAY } else if(message == "Eject") { state eject; } else if(message == "TP Home") { state tp_home; } else if(message == "Unsit") { state unsit; } else if(message == "Cancel") { state cancel; } else if(message == "Ban" && llGetOwner() == USERID) { state ban; } else if(message == "Ban" && llGetOwner() != USERID) { llSay(0,(string)USERID); llSetObjectName("SECURITY"); llSay(0,"sorry this is a owner only function."); llSetObjectName(housename); state default; } } } }
  4. well i got it working now, im listening on two channels but thats the only way im capable of doing it myself and only way i see even possible without further complications llListen(-5430, "", NULL_KEY, ""); llListen(-1000, "", NULL_KEY, ""); if it works it works i guess, not happy about it but you spotted even more problems hmm im sure i wont use -5430 channel for anything else however thier could be a problem if someone else in the sim did. very unlikely i know but yea.i guess i can also USERID == llKey2Name(name) in this situation llSay(secretchannel,"request:" +message+ "|" + (string)id); listen(integer channel, string name, key id, string message) { list data = llParseStringKeepNulls(message, ["|"], []); message = llList2String(data, 0); if (channel == -1000 && message == "request:Radio") { key USERID = llList2String(data, 1); llDialog(USERID, "\npick a station", _radioStations, -5430); } if (channel == -5430) { string newURL = llList2String(_radioURLs, llListFindList(_radioStations, [message])); llSay(0, message + " ---> " + newURL); llSetParcelMusicURL(newURL); }
  5. listen(integer channel, string name, key id, string message) { if (channel == -1000 && message == "request:Radio") { llDialog(id, "\npick a station", _radioStations, -5430); } if (channel == -5430) { string newURL = llList2String(_radioURLs, llListFindList(_radioStations, [message])); llSay(0, message + " ---> " + newURL); llSetParcelMusicURL(newURL); }}} ok, but how i do solve the dialog problem
  6. Hi, im trying to make a HOUSE CONTROLLER, for (doors/windows/security) that kind of thing but ive run into a problem with the radio script plugin llDialog(id, "\npick a station", _radioStations, -1000); ^ this line doesnt work because ID is the object key from the second snippet of code.... not an avatar so i dont recieve the dialog. after i fix that problem somehow, no doubt thier will be an issue with the listener...... im worried about what will happen when the radio script hears commands on -1000 which aint neccaserilly a request to change the station/url. wanna avoid using even more listeners/channels // send infomation regarding person who can control it touch_start(integer total_number) { llSay(-1000,"security " +(string)llDetectedKey(0)); } this is the main menu listening on channel 3 list buttons = ["Security","Radio","Textures","Cancel"]; integer secretchannel = -1000; integer tenantchannel = 3; key tenantkey = NULL_KEY; integer listen_handle; integer menu_handler; integer menu_channel; list order_buttons(list buttons) { return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10); } default { state_entry() { //llResetScript(); listen_handle = llListen(secretchannel, "", "", "" ); } on_rez(integer start_param) { llResetScript(); } listen(integer channel, string name, key id, string message) { // SETTING WHO CAN ACCESS if (channel == secretchannel && llGetOwnerKey(id) == llGetOwner()) { if (llGetSubString(message, 0, 7) == "security" && tenantkey == NULL_KEY) { tenantkey = llGetSubString(message, 9, -1); llListenRemove(listen_handle); listen_handle = llListen(tenantchannel, "", tenantkey, "" ); llSay(0,"Type /" +(string)tenantchannel+ "menu - for controls."); } } // TENANT CONTROLS else if (channel == tenantchannel && id == tenantkey) { if( llToLower(message) == "menu" ) { llDialog(id,"\nPlease Choose a Button",order_buttons(buttons),tenantchannel); llSetTimerEvent(60); } if (message == "Cancel") { } if( llToLower(message) != "menu" && llToLower(message) != "cancel" ) { llSay(secretchannel,"request:" +message); } } } } heres the problematic radio script plugin list _radioURLs; list _radioStations; integer _linenum = 0; string _notecard = "stations"; //----------------------- reset_radio() { _radioURLs = [ "" ]; _radioStations = [ "off" ]; _linenum = 0; llGetNotecardLine(_notecard, _linenum); } add_station(string line) { list words = llParseString2List(line, [" ", " ", "="], []); if (llGetListLength(words) < 2) { return; } string url = llList2String(words, llGetListLength(words) - 1); string station = ""; integer i; for (i=0; i<llGetListLength(words) - 1; i++) { if (llStringLength(station) > 0) { station += " "; } station += llList2String(words, i); } _radioURLs += [url]; _radioStations += [station]; } //----------------------- default { state_entry() { reset_radio(); } changed(integer change) { if (change & CHANGED_INVENTORY) { reset_radio(); } } dataserver(key query_id, string data) { if (llGetListLength(_radioURLs) > 11) { llSay(0, "only the first 10 stations are avaliable"); } else { if (data != EOF) { add_station(data); _linenum++; llGetNotecardLine(_notecard, _linenum); return; } } llListen(-1000, "", NULL_KEY, ""); llSay(0, "touch to change stations"); } listen(integer channel, string name, key id, string message) { if (message == "request:Radio") { llDialog(id, "\npick a station", _radioStations, -1000); } else { string newURL = llList2String(_radioURLs, llListFindList(_radioStations, [message])); llSay(0, message + " ---> " + newURL); llSetParcelMusicURL(newURL); } } }
  7. well i been at it longer than i care to admit, its almost perfect except it doesnt texture the first sqaure on any other linknumber very annoying integer i = 0;integer prim = 1;addTexture(){ integer face = (integer)llList2String( ["3","7","4","6","1"] ,i ); llSay(0,(string)i); // trying to figure out the problem if (i == 5) { // probally this llSetLinkTexture(prim, "The Race", face); i = 0; prim++;} if (i < 5) { llSetLinkTexture(prim, "The Race", face); i++;}}default{ touch_start(integer detected) { addTexture();}} :womansad:
  8. tried and tested, but i got two problems now ---------------------------------------------------------------------------------------------- * the code textures the board all at once < texturing all prisms at the same time starting from face 3 and ending on face 1 - what i wanted to do was add one texture, each time i touch the board so a function. ----- also wanted to do it by rows, i uploaded a picture for example after thiers no more blank spaces on the first green row which is linknumber 1, then move onto linknumber 2 then onto the row below.
  9. Hi, i have a prism shaped object, so its 1 prim but 5 faces. i used lldetectedtouchface to findout the faces are numbered, 3,7,4,6,1 ------------------------ my problem is...... when i have 20 prisms linked together i have twenty linknumbers as expected.. but they all share the same face numbers. ----------------------- long story short i want to display textures on the board, 1 sqaure at a time so cycle until i reach linknumber 20 and 1st face, then start from scratch again. ----------------------- im not much of a scriptor and ways of doing it i think up are confusing to say the least.
  10. Hi, im not realy a scriptor but i know what i wanna do. can somebody help me to find the x,y center of a peice of land using a script this working code below already finds the land borders, so what we need to do is find the point of intersection float gJumpAmount = 0.5; // ************************************************* // Find a land border by searching out from a // specific coordinate for a change in land ownership. // ************************************************* vector findBorder(string axis, vector start_vec, float jump_amount) { float x = 0; float y = 0; float z = 0; float num = 0; vector newVec = ZERO_VECTOR; vector lastVec = ZERO_VECTOR; key owner1 = NULL_KEY; key owner2 = NULL_KEY; // // Validate axis // if ((axis != "x") && (axis != "y")) { // llSay(0,"Invalid axis passed to findBorder()"); return ZERO_VECTOR; } // // Validate jump_amount // if ((integer)jump_amount >= 255) { // llSay(0,"Invalid jump amount"); return ZERO_VECTOR; } // // Validate start_vec // x = getVectorAxis(0,start_vec); y = getVectorAxis(1,start_vec); z = getVectorAxis(2,start_vec); if (x <= 0 || y <= 0 || z <= 0) { // llSay(0,"Invalid vector passed to findBorder()"); return ZERO_VECTOR; } if (x >= 255 || y >= 255 || z >= 255) { // llSay(0,"Invalid vector passed to findBorder()"); return ZERO_VECTOR; } // // Are we too close to a sim border? // if (axis == "x") { if ((x + jump_amount >= 255) ||(x + jump_amount <= 0)) { return ZERO_VECTOR; } } else { if ((y + jump_amount >= 255) ||(y + jump_amount <= 0)) { return ZERO_VECTOR; } } // // Get owner of land at start vector // owner1 = llGetLandOwnerAt(start_vec); if (owner1 == NULL_KEY) { // llSay(0,"Could not determine land owner at the location"); return ZERO_VECTOR; } // // Assign initial values // lastVec = start_vec; if (axis == "x") { num = x; } else { num = y; } // // Loop through until we find a different landowner // while ((num >= 0) && (num <= 255)) { if (axis == "x") { newVec = <num, y, z> + <jump_amount, 0, 0>; } else { newVec = <x, num, z> + <0, jump_amount, 0>; } owner2 = llGetLandOwnerAt(newVec); if ((owner2 == NULL_KEY) || (owner1 != owner2)) { return lastVec; } num += jump_amount; if ((num <= 0) || (num >= 255)) { return lastVec; } lastVec = newVec; } return ZERO_VECTOR; } // ************************************************* // Return a particular axis from a vector // ************************************************* float getVectorAxis(integer axis, vector vec) { if ((axis < 0) || (axis > 2)) { return -1; } list junk = llParseString2List((string)vec,[",","<",">"], []); if (llGetListLength(junk) != 3) { return -1; } return llList2Float(junk,axis); } // // default state starts here // default { state_entry() { llSay(0,"Touch the object to determine borders"); } touch_start(integer num_detected) { // Uncomment to disallow anyone but the owner to use it //if (llDetectedKey(0) != llGetOwner()) //{ // return; //} vector BOUND_EAST = ZERO_VECTOR; vector BOUND_NORTH = ZERO_VECTOR; vector BOUND_SOUTH = ZERO_VECTOR; vector BOUND_WEST = ZERO_VECTOR; vector HOME_POS = llGetPos(); // // Determine the northern boundary // BOUND_NORTH = findBorder("y",HOME_POS,gJumpAmount); if (BOUND_NORTH == ZERO_VECTOR) { llSay(0,"Failed to locate northern boundary"); llResetScript(); } // // Determine the southern boundary // BOUND_SOUTH = findBorder("y",HOME_POS,-gJumpAmount); if (BOUND_SOUTH == ZERO_VECTOR) { llSay(0,"Failed to locate southern boundary"); llResetScript(); } // // Determine the eastern boundary // BOUND_EAST = findBorder("x",HOME_POS,gJumpAmount); if (BOUND_EAST == ZERO_VECTOR) { llSay(0,"Failed to locate eastern boundary"); llResetScript(); } // // Determine the western boundary // BOUND_WEST = findBorder("x",HOME_POS,-gJumpAmount); if (BOUND_WEST == ZERO_VECTOR) { llSay(0,"Failed to locate western boundary"); llResetScript(); } // // Format some results for displaying // float borderNorth = getVectorAxis(1,BOUND_NORTH); float borderSouth = getVectorAxis(1,BOUND_SOUTH); float borderEast = getVectorAxis(0,BOUND_EAST); float borderWest = getVectorAxis(0,BOUND_WEST); float zCoord = getVectorAxis(2,HOME_POS); vector vectorNW = <borderNorth, borderWest, zCoord>; vector vectorNE = <borderNorth, borderEast, zCoord>; vector vectorSE = <borderSouth, borderEast, zCoord>; vector vectorSW = <borderSouth, borderWest, zCoord>; // // Display the results // llSay(0,""); llSay(0,"Northern Boundary Detected: " + (string)BOUND_NORTH); llSay(0,"Southern Boundary Detected: " + (string)BOUND_SOUTH); llSay(0,"Eastern Boudary Detected: " + (string)BOUND_EAST); llSay(0,"Western Boundary Detected: " + (string)BOUND_WEST); llSay(0,""); llSay(0,"Northern Border Line: " + (string)borderNorth); llSay(0,"Southern Border Line: " + (string)borderSouth); llSay(0,"Eastern Border Line: " + (string)borderEast); llSay(0,"Western Border Line: " + (string)borderWest); llSay(0,""); llSay(0,"Northwest Coords: " + (string)vectorNW); llSay(0,"Northeast Coords: " + (string)vectorNE); llSay(0,"Southeast Coords: " + (string)vectorSE); llSay(0,"Southwest Coords: " + (string)vectorSW); } on_rez(integer num) { llResetScript(); } } // end
  11. i see, i tried moving the object thier manually so i could see the problem with my own eyes since the warppos is so fast and yes half of the teleport beam sticks thru the platform which is why im having my problems. i will use your solution if thats the only way, im wondering if changing the size/shape of the prim during transportation will help, maybe i can even change sit target then change it back when tp returns
  12. cant realy raise the seat, the actual prim/teleporter is flat against the wall, it has the appearence\texture of a fake elevator. i could raise the sittarget which i presume is the problem in the firstplace, but then my animation wouldnt look right llSitTarget(<0.0, 0.0, 1.0>, ZERO_ROTATION); using this line puts my avatar at the center of the prim, but since the prims a large rectangular door placed flat against the wall, it looks stupid... im floating in the air feet not touching the ground so thats why i had to add a animation and change the sit target now when i goto SIT it looks asif my avatar is walking towards the elevator, with my feet placed nicely on the floor. but i got the problems i mentioned earlier ---------------------------------------------- i guess i have no choice but too change the z value to a height greater than expected, i was hoping for a better solution realy because if i ever move the platform then i have to calculate it all out again.
  13. Hi, i got trouble with my teleporter and dont know how to fix it. DEST = (<pos.x, pos.y + 12, 89>); // this takes me to my platform 89m up in the air the problem is if i add a custom animation which means changing the sittarget the teleporter or my avatar rather doesnt seem to reach the destination, im stuck slightly below the platform. --------------------------- i could just change the z value until i successfully land on my platform, but i rather fix the problem than cheat, its 89m up in the air so i shouldnt have to change it. anybody got advise for me?
×
×
  • Create New...