EztliLyre Posted October 22, 2016 Posted October 22, 2016 ive created a touch script that works 100% but the problem is it only works for me, if someone else clicks on something my characters wearing that has a touch script it doesnt work for them? been going over my code for a day and cant figure it out. did i do something wrong in my code? sorry if someone has already made a post on this when i searched i didnt see one. its gonna be a plugin for PA by caeilstring configurationNotecardName = "config"; key notecardQueryId; integer line; string papart; string partname; string arousal; string partnamea; string paparta; string arousala; key target; string tostring ; key yourname; string namea; string nameo; init() { // reset configuration values to default papart = "noanim"; partname = "mysterious object"; arousal = "10"; // make sure the file exists and is a notecard if(llGetInventoryType(configurationNotecardName) != INVENTORY_NOTECARD) { // notify owner of missing file llOwnerSay("Missing inventory notecard: " + configurationNotecardName); // don't do anything else return; } // initialize to start reading from first line (which is 0) line = 0; notecardQueryId = llGetNotecardLine(configurationNotecardName, line); } processConfiguration(string data) { // if we are at the end of the file if(data == EOF) { // notify the owner llOwnerSay("We are done reading the configuration"); // notify what was read llOwnerSay("The avatar papart is: " + papart); llOwnerSay("The partname is: " + partname); llOwnerSay("The arousal amount is: " + arousal); // do not do anything else return; } // if we are not working with a blank line if(data != "") { // if the line does not begin with a comment if(llSubStringIndex(data, "#") != 0) { // find first equal sign integer i = llSubStringIndex(data, "="); // if line contains equal sign if(i != -1) { // get name of name/value pair string name = llGetSubString(data, 0, i - 1); // get value of name/value pair string value = llGetSubString(data, i + 1, -1); // trim name list temp = llParseString2List(name, [" "], []); name = llDumpList2String(temp, " "); // make name lowercase (case insensitive) name = llToLower(name); // trim value temp = llParseString2List(value, [" "], []); value = llDumpList2String(temp, " "); // name if(name == "papart") papart = value; // color else if(name == "partname") partname = value; else if(name == "arousal") arousal = value; // unknown name else llOwnerSay("Unknown configuration value: " + name + " on line " + (string)line); } // line does not contain equal sign else { llOwnerSay("Configuration could not be read on line " + (string)line); } } } // read the next line notecardQueryId = llGetNotecardLine(configurationNotecardName, ++line); } default { on_rez(integer start_param) { init(); } changed(integer change) { if(change & (CHANGED_OWNER | CHANGED_INVENTORY)) init(); } state_entry() { llSetTouchText("Boop!"); init(); } dataserver(key request_id, string data) { if(request_id == notecardQueryId) processConfiguration(data); } touch_start(integer total_number) { string partnamea = partname; string paparta = papart; string arousala = arousal; key target = llDetectedKey(0); string tostring = (string) target; key yourname = llGetOwner(); string namea = llGetDisplayName(yourname); string nameo = llGetDisplayName(target); if (llDetectedKey(0) == llGetOwner()) { llMessageLinked(LINK_SET,0,"arousalSetText|"+tostring+"|"+"1"+"|"+nameo+" is booping their "+partnamea,""); llMessageLinked(LINK_SET,0,"caeilarousalup|"+tostring+"|"+arousala+""+paparta,""); } else { llMessageLinked(LINK_SET,0,"arousalSetText|"+tostring+"|"+"1"+"|"+namea+" is having their "+partnamea+" booped by "+nameo,""); llMessageLinked(LINK_SET,0,"caeilarousalup|"+tostring+"|"+arousala+""+paparta,""); } } }
Rolig Loon Posted October 22, 2016 Posted October 22, 2016 It's hard to guess without seeing the other scripts that this one is passing link messages to, so I can only assume that you are sending data in a format that the receiving scripts expect. I also assume that this script is either in the root prim of your link set or in whatever child prim you expect people to touch. If you're confident that those things are true, then I suggest peppering your scripts with diagnostic statements to find out what is actually happening as events are triggered.
EztliLyre Posted October 23, 2016 Author Posted October 23, 2016 i found the problem and i feel like a massive derp now in this part: llMessageLinked(LINK_SET,0,"arousalSetText|"+tostring+"|"+"1"+"|"+nameo+" is booping their "+partnamea,""); llMessageLinked(LINK_SET,0,"caeilarousalup|"+tostring+"|"+arousala+""+paparta,""); tostring is a variable i set to the person who is doing the clicking which is why it worked if i clicked it but not if someone else clicked it , to fix this i made another string variable called yournamea which is set as this: key yourname = llGetOwner(); string yournamea = (string) yourname; and i changed the final code to: if (llDetectedKey(0) == llGetOwner()) { llMessageLinked(LINK_SET,0,"arousalSetText|"+yournamea+"|"+"1"+"|"+nameo+" is booping their "+partnamea,""); llMessageLinked(LINK_SET,0,"caeilarousalup|"+yournamea+"|"+arousala+""+paparta,""); } and now it finally works :3 thanks for trying to help by the way ^ 3 ^ its appreciated
Recommended Posts
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