![](http://content.invisioncic.com/Mseclife/set_resources_8/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Yurtiel
-
Posts
26 -
Joined
-
Last visited
Content Type
Forums
Blogs
Knowledge Base
Posts posted by Yurtiel
-
-
default { changed(integer change) { if(change & CHANGED_OWNER) { llResetScript(); } } state_entry() { owner = llGetOwner(); llRequestPermissions(owner, PERMISSION_TRIGGER_ANIMATION); } run_time_permissions(integer perm) { if(perm & PERMISSION_TRIGGER_ANIMATION) { llSay(0, "Mmmm! Refreshing!"); integer cnt = 0; for(cnt = cnt; cnt <= cnt; ++cnt) { llStartAnimation(anim); llSleep(1.0); llPlaySound(sound, 0.5); llSleep(3.0); llStopSound(); } } } }
For some stupid reason this script absolutely refuses tow ork no matter how I do it, I've worked on it for about an hour now with absolutely no progress. This is the final result and it's one that should work, but for some reason it doesn't.
Whenever I wear the object this script is in, the object works fine, it plays the animation, plays the sound, doesn't give me any permission errors what so ever.
Whenever I give it to anyone else however it starts to give them script errors, I noticed it's because I wasn't having the object update when it got a new owner, so I decided to have it reset when it changed owners.
Originally the script was made with an attach() command but after reset the person would have to reattach it for it to work as it should which is a hassle I would like to prevent the customer from having.
So in my bid I sought to just make it play the animation and sound through a start_entry() block where the wearer of the attached prim could just give it permissions manually which is much less of a hassle, however for some reason the script seems intent to not do this and instead start screaming out PERMISSION_TRIGGER_ANIMATION permission not given errors at the wearer for as long as it's attached and the loop is executing.
This has frustrated me so much that I'm at the point I want to break something, and it's something I've done in prims thousands of times before in a similiar fashion. Does anyone know why this absolutely refuses to work now?
-
Ah I see, thanks a ton, you've helped me more in less than 30 minutes than others did in an entire three days.
I understand that, this was mainly just a way for me to experiment with data serve and take it in, it is rather ridiculous that script memory is limited so low, and that it breaks with such stupid reasons.
SL is about as poorly optimized as you'd expect though require a ton of byte data for something that should be stupidly simple to process.
Anyway, thank you for the help, it's much appreciated, and I gained a lot of new knowledge from it.
-
Oh wow, now that I look at it it seemed so obvious.
Isn't having the recursion in the translate function bad though? I was doing that before and it was causing it to have stack heap crashing errors.
-
(Sorry, I also removed the integer translate bit so it's back to translate(integer line) )
-
I see where the confusion coming in is at, I should have taken that out when I posted the script up, here's the original version I was using, it works fine, except for what I was explaining up there.
It won't place the "Word" into the sentence as it should when it doesn't find it in the list, instead it just completely cuts out and does nothing, but it will translate words that ARE in the list if yout ry to translate a sentence again with just those words, as I explained above.
integer Translate(integer line){ word = llList2String(PList, line); //take the word found = llListFindList(EnglishList, [word]); //Is that word in English vocabulary? found >=0 - if NOT found, found = -1 integer i; integer length = llGetListLength(EnglishList); for(i=0; i < length;i++) { if (found >=0) reqNC_Gorean = llGetNotecardLine("Gorean", found); //if English word is in vocabulary, find translation on G Notecard else if(found == -1) //English word is NOT in dictionary GSentence += word; //Add that to the G sentence }}
-
integer Translate(integer line)
{
word = llList2String(PList, line); //take the word
found = llListFindList(EnglishList, [word]); //Is that word in English vocabulary? found >=0 - if NOT found, found = -1
integer i;
integer length = llGetListLength(EnglishList);
for(i=0; i < length;i++)
{
if (found >=0)
{
reqNC_Gorean = llGetNotecardLine("Gorean", found);
++foundLine;
return;
} //if English word is in vocabulary, find translation on G Notecard
else if(found == -1) //English word is NOT in dictionary{
GSentence += word; //Add that to the G sentence
++foundLine;
return;
}
}}
still getting an error when that all paths are not returning a value.
-
This didn't help at all, changing it to integer translate actually started giving me a "Not all code paths return a vlue" error and won't let me save the script.
-
Thanks, and yeah I didn't even notice that screw up, it's supposed to be telling it to recognize when it's at the end of that particular string.
I'll change it integer translate and see how it works then post the results.
-
Been a while since I asked for help on here.
I have been working on a translator to help me learn the dataserve stuff, but I seem to be having a problem with a crucial aspect of my script.
As far as translating words that are in the notecard appropriately the script works fine.
I'll explain what works and how it's SUPPOSED to work first of all.
The script takes words that are put into channel 93, it then parses them to a list, takes out the punctuation and compares them to a notecard called "English" which has a list of words to be compared to and then fetches the equal line from another card labeled "Gorean" which is the word that it replaces the found word with.
As far as finding words on the list and translating them it works fine, if it finds the word it translates it appropriately and continues on with it's job as it should, the problem I am having comes with if it does NOT find the word on the list labeled "English".
What it should do in this instance, is add the word it couldn't find to the sentence and continue to translate the rest of the list before posting the sentence into chat, however the script isn't doing this, whenever it encounters a word that isn't in the list labeled "English" it instead seems to hiccup and completely forego's translating anything that's input.
Example:
When I put in the word above (A word in the list) it finds it and translates it correctly into Ia (Word in the translated word list). However if I put in the words above is or the word is by itself, nothing happens, and the script doesn't seem to be doing anything, I then have to reset the script before I can continue with the part that DOES translate.
Can someone help with this please? I've been at it for a long time now and it's driving me insane, the script is below.
list EnglishList = []; list Punctuation = [" ", "\"", "$", "(", ")", ".", ",", ";", ":", "-", "?", "!", "=", "*"]; //All Punctuation parsed away except ' and - These may be parts of English words string GSentence; //THIS will be the translated sentence in Gorean string word; //The Gorean word to be used in GSentence - will use XXXXX if word not in dictionary integer found; //The line in the Gorean notecard where the translation of the English word can be found integer foundLine= 0; //Counter on the number of wirds in the English sentence integer LL; //Length of parsed list generated from English sentence list PList; //The parsed list key reqNC_English; //Reading the English vocabulary into a list integer LineE = 0; //English NC line key reqNC_Gorean; //Reading the Gorean vocabulary, finding the right line integer LineG = 0; //Gorean NC line integer Consistency = FALSE; //Checking for same length of notecards key reqE_Length; //Finding the length of the E notecard key reqG_Length; //Finding the length of the G notecard integer ELength; integer GLength; integer limit = 64000; ParseMessage(string message) //Prsing the English sentence (said on /93) parsing away punctuations { PList = llParseString2List(message, Punctuation, []); LL = llGetListLength(PList); GSentence = ""; Translate(foundLine); //Go to translating the Parsed English sentence } Translate(integer line) { word = llList2String(PList, line); //take the word found = llListFindList(EnglishList, [word]); //Is that word in English vocabulary? found >=0 - if NOT found, found = -1 integer i; integer length = llGetListLength(EnglishList); for(i=0; i < length;i++) { if(found == -1 && word == llGetSubString(word, 0, -1)) //English word is NOT in dictionary { GSentence += word; //Add that to the G sentence ++foundLine; return line; } else if (found >=0) reqNC_Gorean = llGetNotecardLine("Gorean", found); //if English word is in vocabulary, find translation on G Notecard } } default { state_entry() { reqE_Length = llGetNumberOfNotecardLines("English"); //Get length of E notecard llSetMemoryLimit(limit); llScriptProfiler(PROFILE_SCRIPT_MEMORY); llScriptProfiler(PROFILE_NONE); } dataserver(key id, string data) { if(id == reqE_Length) //gets length of E notecard { ELength = (integer)data; reqG_Length = llGetNumberOfNotecardLines("Gorean"); //Now get length of G notecard } else if(id == reqG_Length) //Gets length of G notecard { GLength = (integer)data; if(GLength != ELength) //If they are NOT equally long (== inconsistent) { llOwnerSay("The Notecards do NOT have the same number of lines\n Fix that and try again!!"); } else if(GLength == ELength) //If they HAVE the same length { reqNC_English = llGetNotecardLine("English", LineE); //Get E notecard vocabulary into a list } } else if(id == reqNC_English) { if(data != EOF) //as long as we are NOT at the end of the NC { EnglishList += data; //add a new line ++LineE; // increase the line number reqNC_English = llGetNotecardLine("English", LineE); //and get that next line } else if(data == EOF) //If we are at the end of the E notecrd (all words are in our list now) { llListen(93, "", NULL_KEY, ""); //Open a listen on channel 93 } } else if(id == reqNC_Gorean) //THIS is the continuation of the above "Translate" function, when our E word had been on the list { //Find the Gorean translation and add a space to that word GSentence += data + " "; //Add the word to the Gorean sentence ++foundLine; //go to next English word in Parsed list if(foundLine < LL) //If there is another English word { Translate(foundLine); //translate that now } else if(foundLine == LL) //No more E word to translate { foundLine = 0; llSay(0,GSentence); //Say the Gorean Sentence llMessageLinked(LINK_THIS,0,GSentence,""); llResetScript(); } } } listen(integer channel, string name, key id, string message) //Listening on channel 93 { if(channel != 93 || id != llGetOwner()) return; else if(channel == 93 && id == llGetOwner()) //If said on correct channel { //llOwnerSay(message); ParseMessage(llToLower(message)); //Go parse that English sentence } } changed(integer change) { if(change & CHANGED_INVENTORY || change & CHANGED_OWNER) llResetScript(); //Reset if inventory is changed } }
-
AHA, I FIXED IT.
Thanks for everyone who was going to help or did : )
-
I already tried this, it didn't make any difference.
-
Main Menu Script:
integer sCh; integer totalPrims; integer i; integer gL; string nOwn; string gOwn; string dOwn; vector link_pos; key uSr; default { touch_start(integer ts) { vector vec = llDetectedTouchST(0); if(vec.x >= 0.6 && vec.x <= 1.0 && vec.y >= 0.64 && vec.y <= 0.8) { state st_men_pos; } else if (vec.x >= 0.6 && vec.x <= 1.0 && vec.y >= 0.489 && vec.y <= 0.633) { state it_men_pos; } else if (vec.x >= 0.6 && vec.x <= 1.0 && vec.y >= 0.33 && vec.y <= 0.47) { state eq_men_pos; } else if (vec.x >= 0.6 && vec.x <= 1.0 && vec.y >= 0.165 && vec.y <= 0.308) { integer roll = (integer)(llFrand(21)); if(roll == 0) { roll = 1; } if (roll == 1) { llSay(0, "Critical Fail! " + nOwn + " Rolled a D20 check of " + (string)roll); state default; } if (roll == 21) { roll = 20; } if (roll == 20) { llSay(0, "Critical Success! " + nOwn + " Rolled a D20 check of " + (string)roll); state default; } else { llSay(0, nOwn + " Rolled a D20 check of " + (string)roll); state default; } } } } state st_men_pos { state_entry() { totalPrims = llGetNumberOfPrims(); // refresh every time in case new added for(i=1; i < totalPrims+1; i++) { // refresh for each link_pos = llList2Vector(llGetLinkPrimitiveParams(i, [PRIM_POS_LOCAL]), 0); if(llGetLinkName(i) == "StatMenu" && link_pos.y == 0.3) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <0.0, -0.3, 0.0>]); } if (llGetLinkName(i) == "Strength" && link_pos.y == 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, -0.47530, 0.08252>]); } if (llGetLinkName(i) == "Dexterity" && link_pos.y == 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, -0.47530, 0.08252>]); } if (llGetLinkName(i) == "Magic" && link_pos.y == 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, -0.47530, 0.08252>]); } if (llGetLinkName(i) == "Vitality" && link_pos.y == 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, -0.47530, 0.08252>]); } if (llGetLinkName(i) == "Luck" && link_pos.y == 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, -0.47530, 0.08252>]); } if (llGetLinkName(i) == "Spirit" && link_pos.y == 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, -0.47530, 0.08252>]); } if (llGetLinkName(i) == "Pool" && link_pos.y == 0.25079) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, -0.47530, 0.08252>]); } else if (llGetLinkName(i) == "StatMenu" && link_pos.y != 0.3) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <0.0, 0.3, 0.0>]); } if (llGetLinkName(i) == "Strength" && link_pos.y != 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, 0.30905, 0.12671>]); } if (llGetLinkName(i) == "Dexterity" && link_pos.y != 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, 0.30905, 0.07813>]); } if (llGetLinkName(i) == "Magic" && link_pos.y != 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, 0.30905, 0.02832>]); } if (llGetLinkName(i) == "Vitality" && link_pos.y != 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, 0.30905, -0.02295>]); } if (llGetLinkName(i) == "Luck" && link_pos.y != 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, 0.30905, -0.07275>]); } if (llGetLinkName(i) == "Spirit" && link_pos.y != 0.30905) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, 0.30905, -0.12769>]); } if (llGetLinkName(i) == "Pool" && link_pos.y != 0.25079) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <-0.00636, 0.25079, -0.16455>]); } } state default; } } state it_men_pos { state_entry() { totalPrims = llGetNumberOfPrims(); // refresh every time in case new added for(i=1; i < totalPrims+1; i++) { // refresh for each link_pos = llList2Vector(llGetLinkPrimitiveParams(i, [PRIM_POS_LOCAL]), 0); if(llGetLinkName(i) == "ItemMenu" && link_pos.y == 0.3) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <0.0, -0.3, 0.4>]); state default; } else if (llGetLinkName(i) == "ItemMenu" && link_pos.y != 0.3) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <0.0, 0.3, 0.0>]); state default; } } } } state eq_men_pos { state_entry() { totalPrims = llGetNumberOfPrims(); // refresh every time in case new added for(i=1; i < totalPrims+1; i++) { // refresh for each link_pos = llList2Vector(llGetLinkPrimitiveParams(i, [PRIM_POS_LOCAL]), 0); if(llGetLinkName(i) == "EquipMenu" && link_pos.y == 0.3) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <0.0, -0.3, -0.4>]); state default; } else if (llGetLinkName(i) == "EquipMenu" && link_pos.y != 0.3) { llSetLinkPrimitiveParamsFast(i, [PRIM_POS_LOCAL, <0.0, 0.3, 0.0>]); state default; } } } }
This one works fine.
Stat Menu Script:
integer totalPrims; vector link_pos; vector vec; integer i; string lName; integer lNum; string dOwn; string nOwn; integer face; default { state_entry() { totalPrims = llGetNumberOfPrims(); vector vec = llDetectedTouchST(0); link_pos = llList2Vector(llGetLinkPrimitiveParams(i, [PRIM_POS_LOCAL]), 0); lName = llGetLinkName(i); lNum = llDetectedLinkNumber(i); dOwn = llDetectedKey(i); nOwn = llKey2Name(dOwn); face = llDetectedTouchFace(i); } touch_start(integer num_detected) { vector vec = llDetectedTouchST(0); for(i=1; i < totalPrims+1; i++) { } if(vec.x >= 0.78581 && vec.x <= 0.90754 && vec.y >= 0.88665 && vec.y <= 0.95054) { llMessageLinked(LINK_ALL_OTHERS, 0, "sinquiry", dOwn); state st_2men; } else if (vec.x>= 0.63341 && vec.x <= 0.74986 && vec.y >= 0.88481 &&vec.y <= 0.94738) { llMessageLinked(LINK_ALL_OTHERS, 0, "s2inquiry", dOwn); state st_2men; } if(vec.x >= 0.78581 && vec.x <= 0.90754 && vec.y >= 0.75020 && vec.y <= 0.81000) { llMessageLinked(LINK_ALL_OTHERS, 0, "dinquiry", dOwn); state st_2men; } else if (vec.x>= 0.63341 && vec.x <= 0.74986 && vec.y >= 0.74604 &&vec.y <= 0.80944) { llMessageLinked(LINK_ALL_OTHERS, 0, "d2inquiry", dOwn); state st_2men; } if(vec.x >= 0.78581 && vec.x <= 0.90754 && vec.y >= 0.60131 && vec.y <= 0.65875) { llMessageLinked(LINK_ALL_OTHERS, 0, "minquiry", dOwn); state st_2men; } else if (vec.x>= 0.63341 && vec.x <= 0.74986 && vec.y >= 0.59799 &&vec.y <= 0.65947) { llMessageLinked(LINK_ALL_OTHERS, 0, "m2inquiry", dOwn); state st_2men; } if(vec.x >= 0.78581 && vec.x <= 0.90754 && vec.y >= 0.44818 && vec.y <= 0.51979) { llMessageLinked(LINK_ALL_OTHERS, 0, "vinquiry", dOwn); state st_2men; } else if (vec.x>= 0.63341 && vec.x <= 0.74986 && vec.y >= 0.44635 &&vec.y <= 0.51735) { llMessageLinked(LINK_ALL_OTHERS, 0, "v2inquiry", dOwn); state st_2men; } if(vec.x >= 0.78581 && vec.x <= 0.90754 && vec.y >= 0.30436 && vec.y <= 0.38048) { llMessageLinked(LINK_ALL_OTHERS, 0, "linquiry", dOwn); state st_2men; } else if (vec.x>= 0.63341 && vec.x <= 0.74986 && vec.y >= 0.30615 &&vec.y <= 0.37517) { llMessageLinked(LINK_ALL_OTHERS, 0, "l2inquiry", dOwn); state st_2men; } if(vec.x >= 0.78581 && vec.x <= 0.90754 && vec.y >= 0.16449 && vec.y <= 0.23605) { llMessageLinked(LINK_ALL_OTHERS, 0, "spinquiry", dOwn); state st_2men; } else if (vec.x>= 0.63341 && vec.x <= 0.74986 && vec.y >= 0.16581 &&vec.y <= 0.23653) { llMessageLinked(LINK_ALL_OTHERS, 0, "sp2inquiry", dOwn); state st_2men; } } } state st_2men { state_entry() { totalPrims = llGetNumberOfPrims(); vector vec = llDetectedTouchST(0); link_pos = llList2Vector(llGetLinkPrimitiveParams(i, [PRIM_POS_LOCAL]), 0); lName = llGetLinkName(i); lNum = llDetectedLinkNumber(i); dOwn = llDetectedKey(i); nOwn = llKey2Name(dOwn); face = llDetectedTouchFace(i); } link_message(integer sender, integer num, string msg, key dOwn) { if(msg == "sinquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "sadd", dOwn); state st_3men; } else if (msg == "s2inquiryf") { llSay(0, nOwn + " Stat already at minimum"); state default; } else if (msg == "s2inquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "smin", dOwn); state st_3men; } if(msg == "dinquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "dadd", dOwn); state st_3men; } else if (msg == "d2inquiryf") { llSay(0, nOwn + " Stat already at minimum"); state default; } else if (msg == "d2inquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "dmin", dOwn); state st_3men; } if(msg == "minquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "madd", dOwn); state st_3men; } else if (msg == "m2inquiryf") { llSay(0, nOwn + " Stat already at minimum"); state default; } else if (msg == "m2inquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "mmin", dOwn); state st_3men; } if(msg == "vinquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "vadd", dOwn); state st_3men; } else if (msg == "v2inquiryf") { llSay(0, nOwn + " Stat already at minimum"); state default; } else if (msg == "v2inquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "vmin", dOwn); state st_3men; } if(msg == "linquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "ladd", dOwn); state st_3men; } else if (msg == "l2inquiryf") { llSay(0, nOwn + " Stat already at minimum"); state default; } else if (msg == "l2inquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "lmin", dOwn); state st_3men; } if(msg == "spinquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "spadd", dOwn); state st_3men; } else if (msg == "sp2inquiryf") { llSay(0, nOwn + " Stat already at minimum"); state default; } else if (msg == "sp2inquiryt") { llMessageLinked(LINK_ALL_OTHERS, 0, "spmin", dOwn); state st_3men; } } } state st_3men { state_entry() { totalPrims = llGetNumberOfPrims(); vector vec = llDetectedTouchST(0); link_pos = llList2Vector(llGetLinkPrimitiveParams(i, [PRIM_POS_LOCAL]), 0); lName = llGetLinkName(i); lNum = llDetectedLinkNumber(i); dOwn = llDetectedKey(i); nOwn = llKey2Name(dOwn); face = llDetectedTouchFace(i); } link_message(integer sender, integer num, string msg,key dOwn) { if(msg == "sYes") { llMessageLinked(LINK_ALL_OTHERS, 0, "stadd", dOwn); state default; } else if (msg == "sNo") { llMessageLinked(LINK_ALL_OTHERS, 0, "stmin", dOwn); state default; } if(msg == "dYes") { llMessageLinked(LINK_ALL_OTHERS, 0, "dexadd", dOwn); state default; } else if(msg =="dNo") { llMessageLinked(LINK_ALL_OTHERS, 0, "dexmin", dOwn); state default; } if(msg == "mYes") { llMessageLinked(LINK_ALL_OTHERS, 0, "magadd", dOwn); state default; } else if(msg == "mNo") { llMessageLinked(LINK_ALL_OTHERS, 0, "magmin", dOwn); state default; } if(msg == "vYes") { llMessageLinked(LINK_ALL_OTHERS, 0, "vitadd", dOwn); state default; } else if(msg == "vNo") { llMessageLinked(LINK_ALL_OTHERS, 0, "vitmin", dOwn); state default; } if(msg == "lYes") { llMessageLinked(LINK_ALL_OTHERS, 0, "luckadd", dOwn); state default; } else if(msg == "lNo") { llMessageLinked(LINK_ALL_OTHERS, 0, "luckmin", dOwn); state default; } if(msg == "spYes") { llMessageLinked(LINK_ALL_OTHERS, 0, "spiritadd", dOwn); state default; } else if(msg == "spNo") { llMessageLinked(LINK_ALL_OTHERS, 0, "spiritmin", dOwn); state default; } if (msg == "No") { llSay(0, nOwn + " You have no available stat points "); state default; } if (msg == "Max") { llSay(0, nOwn + " You have maximum free points available"); state default; } } }
This one worked fine until I added the "Inquiry" messages and created st_2men and st_3men. Now it's being treated as if it's not even running for some reason, the main menu script is overwriting it and whenever I click on the vectors specified it's treating them as the Main Menu vectors and moving stuff/dice rolling.
Strength Pool:
integer gcount = 0; integer totalPrims; vector link_pos; vector vec; integer i; string lName; integer lNum; string gOwn; string dOwn; integer face; default { state_entry() { totalPrims = llGetNumberOfPrims(); vector vec = llDetectedTouchST(0); link_pos = llList2Vector(llGetLinkPrimitiveParams(i, [PRIM_POS_LOCAL]), 0); lName = llGetLinkName(i); lNum = llDetectedLinkNumber(i); dOwn = llDetectedKey(i); face = llDetectedTouchFace(i); llSetText("+ " + (string)gcount, <1.0,1.0,1.0>, 1); } link_message(integer sender, integer num, string msg, key dOwn) { if (msg == "sinquiry" && gcount !=10) { llMessageLinked(LINK_ALL_OTHERS, 0, "sinquiryt", dOwn); state default; } else if (msg == "s2inquiry" && gcount == 0) { llMessageLinked(LINK_ALL_OTHERS, 0, "s2inquiryf", dOwn); state default; } else if (msg == "s2inquiry" && gcount !=0) { llMessageLinked(LINK_ALL_OTHERS, 0, "s2inquiryt", dOwn); state default; } if(msg == "stadd" && gcount != 10) { llSetText("+ " + (string)(++gcount), <1.0,1.0,1.0>, 1); state default; } if(msg == "stmin" && gcount == 0) { llMessageLinked(LINK_ALL_OTHERS, 0, "Min", dOwn); state default; } else if (msg == "stmin" && gcount !=0) { llSetText("+ " + (string)(--gcount), <1.0,1.0,1.0>, 1); state default; } } }
Added this so you can see what's going on, the script worked fine until I put in the Inquiry messages as mentioned in the stat menu section.
Free Stat Point Pool:
integer gcount = 10; integer totalPrims; vector link_pos; vector vec; integer i; string lName; integer lNum; string gOwn; string dOwn; integer face; default { state_entry() { llSetText((string)gcount, <1.0, 1.0, 1.0>, 1); totalPrims = llGetNumberOfPrims(); vector vec = llDetectedTouchST(0); link_pos = llList2Vector(llGetLinkPrimitiveParams(i, [PRIM_POS_LOCAL]), 0); lName = llGetLinkName(i); lNum = llDetectedLinkNumber(i); dOwn = llDetectedKey(i); face = llDetectedTouchFace(i); } link_message(integer send, integer num, string msg, key dOwn) { if(msg == "sadd" && gcount !=0) { llSetText((string)(--gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "sYes", dOwn); state default; } else if(msg == "sadd" && gcount == 0) { llMessageLinked(LINK_ALL_OTHERS, 0, "No", dOwn); state default; } if(msg == "dadd" && gcount !=0) { llSetText((string)(--gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "dYes", dOwn); state default; } else if(msg == "dadd" && gcount == 0) { llMessageLinked(LINK_ALL_OTHERS, 0, "No", dOwn); state default; } if(msg == "madd" && gcount !=0) { llSetText((string)(--gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "mYes", dOwn); state default; } else if(msg == "madd" && gcount ==0) { llMessageLinked(LINK_ALL_OTHERS, 0, "No", dOwn); state default; } if(msg == "vadd" && gcount !=0) { llSetText((string)(--gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "vYes", dOwn); state default; } else if(msg == "vadd" && gcount ==0) { llMessageLinked(LINK_ALL_OTHERS, 0, "No", dOwn); state default; } if(msg == "ladd" && gcount !=0) { llSetText((string)(--gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "lYes", dOwn); state default; } else if (msg == "ladd" && gcount ==0) { llMessageLinked(LINK_ALL_OTHERS, 0, "No", dOwn); state default; } if(msg == "spadd" && gcount !=0) { llSetText((string)(--gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "spYes", dOwn); state default; } else if (msg == "spadd" && gcount ==0) { llMessageLinked(LINK_ALL_OTHERS, 0, "No", dOwn); state default; } if(msg == "smin" && gcount != 10) { llSetText((string)(++gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "sNo", dOwn); state default; } else if (msg == "smin" && gcount == 10) { llMessageLinked(LINK_ALL_OTHERS, 0, "Max", dOwn); state default; } if (msg == "dmin" && gcount != 10) { llSetText((string)(++gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "dNo", dOwn); state default; } else if (msg == "dmin" && gcount == 10) { llMessageLinked(LINK_ALL_OTHERS, 0, "Max", dOwn); state default; } if (msg == "mmin" && gcount != 10) { llSetText((string)(++gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "mNo", dOwn); state default; } else if (msg == "mmin" && gcount == 10) { llMessageLinked(LINK_ALL_OTHERS, 0, "Max", dOwn); state default; } if (msg == "vmin" && gcount != 10) { llSetText((string)(++gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "vNo", dOwn); state default; } else if (msg == "vmin" && gcount == 10) { llMessageLinked(LINK_ALL_OTHERS, 0, "Max", dOwn); state default; } if (msg == "lmin" && gcount != 10) { llSetText((string)(++gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "lNo", dOwn); state default; } else if (msg == "lmin" && gcount == 10) { llMessageLinked(LINK_ALL_OTHERS, 0, "Max", dOwn); state default; } if (msg == "spmin" && gcount != 10) { llSetText((string)(++gcount), <1.0,1.0,1.0>, 1); llMessageLinked(LINK_ALL_OTHERS, 0, "spNo", dOwn); state default; } else if (msg == "spmin" && gcount == 10) { llMessageLinked(LINK_ALL_OTHERS, 0, "Max", dOwn); state default; } if(gcount < 0) { gcount = 0; } if (gcount > 10) { gcount = 10; } } }
This one says it's working fine, And it should be.
I've been going over this for three hours now, everything worked fine with a minor bug that when you would click to remove a stat point and the stat was already at 0 it would give the free points pool an extra stat anyway and cause it to go up, so I added the "Inquiry" messages to the code with the new st_2men and st_3men states. Now it seems that the main menu script is overwriting the stat menu script. Can you guys see something I'm apparently not?
-
I see, and is there a way to save that new number as a new integer, or would I have to define each number globally and define it within each IF statement.
-
Now for my last question (And should be the last one I need to ask for a while.)
I need to know how to set up a system where, when you click on a prim, it will have the default value of 0
It will then tick up to 1 when clicked.
And will then tick up to 2 when clicked again.
up to a max of 10
So on and so forth.
I then need to make it so that when another prim is clicked, it will take that value and subtract 1.
So on 1st click total = 9
2nd: total = 8
etc etc.
I don't want people to think that I'm just requesting a script I'm going to use, I just need examples of this because I can't seem to find any anywhere. And all the ones I see use it in a loop instance of num_detected ++i.However I'd like to refrain from using num_detected if at all possible because I'm not entirely sure if it will do the equations right that I need it too.
-
Innuza helped me with the problem, but yeah, when you have llDetectedTouchFace in the root prim it effects all child prims.
apparently this also overrides the child prims personal scripts as they started to work when I combined the scripts with the main script, or when I actually defined their keys.
-
-
nvm, for some reason it decided it was magically going to work now : /
Thanks for the script though, that will help me a lot later on I believe.
-
Thanks, Now I know that the LLmessagelinked is happening and it is sending "Touched" to the prim it needs to send it too, but I still don't know why it isn't executing
llsay(0,"Moving")
when it recieves the linked message.
-
I have hit a brick wall and can't figure out what's going on (Again).
integer sCh; integer gL; string nOwn; string gOwn; string dOwn; key uSr; default { state_entry() { sCh = -4000; dOwn = llDetectedKey(0); gOwn = llGetOwner(); nOwn = llKey2Name(gOwn); gL = llListen(sCh, "", gOwn, ""); llListenRemove(gL); } touch_end(integer ts) { vector vec = llDetectedTouchST(0); if(llDetectedTouchFace(0) == 4 && vec.x >= 0.6 && vec.x <= 1.0 && vec.y >= 0.64 && vec.y <= 0.8) llSay(0, "Stat Button Pressed"); llMessageLinked(2,0,"Touched",dOwn); } }
Okay, on here I'm u sing a single prim main area for the main menu of the HUD.
I get to the point where it detects if I'm touching on face 4, and if the vector is equal to or less than the X and Y of the "Stat Button" part of the prim.
It successfully says "Stat Button Pressed."
I assume it is then sending the llMessageLinked message of "Touched" to linked prim "2" which is the Stat Menu prim.
Stat Menu Prim Code:
integer sCh; integer gL; string nOwn; string gOwn; string dOwn; vector gPos; key uSr; default { state_entry() { sCh = -4000; dOwn = llDetectedKey(0); gOwn = llGetOwner(); nOwn = llKey2Name(gOwn); uSr = dOwn; gPos = llGetLocalPos(); gL = llListen(sCh, "", gOwn, ""); llListenRemove(gL); state st_menu; } } state st_menu { link_message(integer root, integer num, string msg, key dOwn) { if (msg == "Touched") llSay(0, "Moving"); } }
This is the part that's infuriating me.
The prim isn't doing the if command I tell it to from link_message, even when remove state st_menu and combine the link message if command block of code to the state entry it won't say anything.
It's as if it's either NOT sending the llMessageLinked from the root prim to the linked prim, or the linked prim's link_message simply isn't recieving the message that is being sent and I can't seem to figure it out for the life of me because it works exactly as it should in a different script for something else I did perfectly fine.
Oh great scripters of SL, show me what mine eyes apparently are fking blind too. -
NVM I figured it out good sir, you are indeed correct, thank you very much for the help.
I also had to add
if(msg == (string)
state (state integer)
in each state as well under the link_message.
Much thanks.
-
Sorry I think I'm missing something with that?
Why do I need one in each state if the first state is switching it to the other state and already has the link_message handle?
Also how would I even code that?
state sct_st
{
link_message(integer class, integer number, string msg, key id)
{}
touch start is apparently acceptable for the script but it leaves me with the same problem I've been having.
link_message(integer class, integer number, string msg, key id)
{
* if(msg == "Scout")
{
touch_start
gives me an error message at *.
-
Thanks I missed that part, I amended it but I'm still having the same problem.
[13:43] Lifestream Character Sheet HUD: Yurtiel Resident set class to Fighter
[13:43] Lifestream Character Sheet HUD: Yurtiel Resident Rolled a Str Check of 14 + 4 equaling 18^ This part is correct, that's how it's supposed to work when set to fighter.
[13:43] Lifestream Character Sheet HUD: Yurtiel Resident set class to Scout
[13:43] Lifestream Character Sheet HUD: Yurtiel Resident Rolled a Str Check of 2 + 4 equaling 6^ This is the part I'm having a headache over, when the class is set to scout (Via the Class prim/button) it's supposed to switch it to
"Yurtiel Resident rolled a Str check of (num) + 1 equalling (total)
But it doesn't seem to be switching the state to state sct_st when it recieves that message, and from what I see the code is perfect (With the addition of that extra equal sign that is) and it should switch between the two states and be fine.
But it's like it's getting the message from the llMessageLinked and instead of going throughif (msg=="Scout")
It's going
If(msg=="Fighter")
setting the state to fighter (When it's not supposed to)
and then won't go forward in the script.
Or like it's misinterpretting
if(msg=="Scout")
as
if(msg=="Fighter")
-
I don't know if I'm just being retarded and missing something super obvious or what but I seem to be having a problem in a dice roller I'm making that it won't switch states.
What I want to happen: The script recieves a message from a script in a linked prim (Via llmessagelinked and link_message)
When the message is recieved, I want it to run through the if's as listed, and then switch to the appropriate state for what the message might be, below is the code as I have it now, and yes I know it can be condensed but I did it this way because I can't figure this problem out and I was trying to get it to work.
What it is actually doing: It gets the message from the other script from the linked prim named "Class" it then rolls like it's supposed to for state ftr_st, however, if class is changed to "Scout" it is still rolling as if it were in state ftr_st.
Please if you know, what the hell am I missing? I've been at this for two hours now and it's getting infuriating.string nOwn; string gOwn; string dOwn; default { state_entry() { dOwn = llDetectedKey(0); gOwn = llGetOwner(); nOwn = llKey2Name(gOwn); } link_message(integer class, integer number, string msg, key id) { if (msg = "Fighter") { state ftr_st; return; } else if (msg = "Scout") { state sct_st; return; } } } state ftr_st { touch_start(integer ftr) { integer roll = (integer)(llFrand(21)); integer r = roll; integer ttl = r += 4; integer ttl2= r += 3; integer ttl3= r += 2; integer ttl4= r += 1; integer ttl5= r += 0; if (roll == 0) roll = 1; if (roll == 1) { llSay (0, "Critical Fail! " + nOwn + " Rolled a Str Check of " + (string)roll + " + 4 equaling " + (string)ttl); state ftr_st; } if (roll == 21) roll = 20; if (roll == 20) { llSay (0, "Critical Success! " + nOwn + " Rolled a Str Check of " + (string)roll + " + 4 equaling " + (string)ttl); state ftr_st; } else { llSay(0, nOwn + " Rolled a Str Check of " + (string)roll + " + 4 equaling " + (string)ttl); state ftr_st; } } } state sct_st { touch_start(integer sct) { integer roll = (integer)(llFrand(21)); integer r = roll; integer ttl = r += 4; integer ttl2= r += 3; integer ttl3= r += 2; integer ttl4= r += 1; integer ttl5= r += 0; if (roll == 0) roll = 1; if (roll == 1) { llSay (0, "Critical Fail! " + nOwn + " Rolled a Str Check of " + (string)roll + " + 1 equaling " + (string)ttl4); state sct_st; } if (roll == 21) roll = 20; if (roll == 20) { llSay (0, "Critical Success! " + nOwn + " Rolled a Str Check of " + (string)roll + " + 1 equaling " + (string)ttl4); state sct_st; } else { llSay(0, nOwn + " Rolled a Str Check of " + (string)roll + " + 1 equaling " + (string)ttl4); state sct_st; } } }
-
I have been steadily learning new scripting methods in an attempt to make a HUD/meter system and have run into a problem I can't seem to find any information on.
What I require to happen is that I would set up an in sim server system where a user (In this case a specific group) can go into the "Server" side of the system and be able to dynamically change the stat set up of the HUD, it will then send this information out to all adjacent receiving items (In this case the HUD) and will change the information of the script inside the object to mirror the information that has been put in.
My main question is how to make it so that the script in one object, can change the number information in another script and the script will remember the change (It would only be for number values, all other equations would be done by the HUD itself, but I want to set up a server side stat set up system.)
An added bonus of informational wealth if possible would also be how to use dialog boxes (Menus) to do this same thing but on a local scale.Any help would be appreciated please.
Permission Errors
in LSL Scripting
Posted
Thanks Rolig, Once again you've helped me greatly.
If I may though, is there any reason it was expecting me to reset it every time to use the for loop in it?
Originally I had it set so that it didn't have a changed state and used the for loop and the loop was only supposed to activate if they attached it and they were the owner.