Jump to content

testgenord1

Resident
  • Posts

    146
  • Joined

  • Last visited

Everything posted by testgenord1

  1. I may have found the answer myself now. I've replaced the part string animationcurrent = (string)(llGetAnimation(player)); with animationcurrent = animation; (the old "animation" becomes the new "animationcurrent" and is then stopped at the beginning of the next timer interval: if(seconds % 5 == 0) { ianimation = ianimation + 1; animation = llList2String(animations,ianimation); osAvatarStopAnimation(player, animationcurrent); osAvatarPlayAnimation(player, animation); animationcurrent = animation; ... } Apparently, the operation string animationcurrent = (string)(llGetAnimation(player)); takes too long to be finished before it can be used to stop the current animation.
  2. Hi! I've got a script that is supposed to automatically play a number of animations in a sequence, using a timer. The animations are in the object's inventory and sequentially numbered ("1animation", "2animation" ...). Additionally, the user is supposed to be able to deliberately choose any of the animations from a dialog menu. For example, when after the automatic "2animation", "5animation" is selected from the menu by the user, "5animation" is played (instead of "3animation"). Then, the sequence is supposed to be automatically adjusted, so that after "5animation", "6animation" follows (instead of the original "3animation"). - The animations selected by the menu always work - The first automatic animations work the way they should. - The counter always chooses the correct sequence (after "1animation", "2animation" follows etc.), also when a different animation is selected from the menu (after "5animation" then "6animation" follows etc.). However, here is a problem with the automatic animations: After the first animations have been played correctly, the later animations are no more played reliably, i.e., some animations are omitted in between. (I'm not sure whether this is an actual script problem or rather a general animation-playing issue.) Maybe you guys have some ideas? Thank you very much in advance! Here is the script: integer seconds; list animations = []; string animation; integer ianimation; string animationcurrent; key player; key player2; integer ichannel; integer ilisten; string nplayer; string nplayer2; integer inumber; integer on; vector sitpos = <-0.6,0.0,0.85>; default { state_entry() { llSetClickAction(CLICK_ACTION_SIT); llSitTarget(sitpos, ZERO_ROTATION); inumber = llGetInventoryNumber(INVENTORY_ANIMATION); integer i; do { animations += llGetInventoryName(INVENTORY_ANIMATION, i); } while (++i < inumber); } changed(integer change) { if(change & CHANGED_LINK) { player = llAvatarOnSitTarget(); if(player != NULL_KEY) { if(on == FALSE) { //osAvatarStopAnimation(player,"sit");//OpenSim-version llStopAnimation("sit"); ichannel = -1 -(integer)("0x" + llGetSubString( (string)player, -7, -1)); ilisten = llListen(ichannel, "", player, ""); animation = llGetInventoryName(INVENTORY_ANIMATION,0);//First animation in inventory is selected. llSetClickAction(CLICK_ACTION_TOUCH); //osAvatarPlayAnimation(player, animation);//OpenSim-version llStartAnimation(animation);//On OpenSim, it is possible to start animations without asking for permission first. llRegionSayTo(player,PUBLIC_CHANNEL,"\n \n \n" + animation + "\n \n \n"); llSetTimerEvent(1.0); } else { player2 = llDetectedKey(0); nplayer2 = llDetectedName(0); llRegionSayTo(player2,PUBLIC_CHANNEL,"\n \n \n" + nplayer + " is playing. Please wait.\n \n \n"); } } else { on = FALSE; llStopAnimation(animation); llUnSit(player); llSetTimerEvent(0.0); llResetScript(); } } else if (change & CHANGED_REGION_RESTART) { llResetScript(); } else if (change & CHANGED_REGION_START) { llResetScript(); } } listen(integer channel, string name, key id, string message) { llStopAnimation(animation); seconds = 0; animation = message;//Current animation is replaced by animation selected in menu. ianimation = llListFindList(animations,animation); llStartAnimation(animation); llRegionSayTo(player,PUBLIC_CHANNEL,"\n \n \n" + animation + "\n \n \n"); } timer() { ++seconds; if(seconds % 5 == 0) { string animationcurrent = (string)(llGetAnimation(player)); llStopAnimation( animationcurrent); ianimation = ianimation + 1; animation = llList2String(animations,ianimation); //llOwnerSay("ianimation = " + ianimation); //llOwnerSay("animation = " + animation); llStartAnimation(animation); llRegionSayTo(player,PUBLIC_CHANNEL,"\n \n \n" + animation + "\n \n \n"); if(ianimation == inumber) { //llOwnerSay("end of animations"); llStopAnimation( animationcurrent); llUnSit(player); llResetScript(); } } } touch_start(integer num) { llDialog(player, "Choose animation\n \n \n:", animations, ichannel); } }
  3. Hm, looks like you just solved it. I tested it using you idea, and the issue has not occured, since. So, I assume it's gone now. I'm posting the latest version using your input below. Thank you so much!🙏👍🙂 integer ichannelgerman = -1291; integer ichannelenglish = -1292; integer ichannelmaths = -1293; integer ichannelscience = -1294; integer ichannelsocialscience = -1295; integer ichannelreligion = -1296; integer ichannelart = -1297; integer ichannelmusic = -1298; string quizname; key player; string nameplayer; integer ilisten; integer time = 30; integer ttime; integer seconds; integer ichannel; integer index; integer dividend; integer divisor; float quotient; integer iquotient; list choices; list choicesrand; string distractor1; string distractor2; string question; float range = 10.0; list lSounds = [ "6e517cde-066f-455e-8c6b-f1c33be90dea", "611c9470-507e-4471-8ce2-5ed0962e4c85", "b1e78aa1-52b7-482f-a48a-57e3ddff81fc", "7b978d05-b3bd-4e6f-892f-92dc4845ddd8", "64319812-dab1-4e89-b1ca-5fc937b8d94a", "720ff3dd-8fc6-4523-9670-139df57527f3"]; integer quizlength = 10; integer questionnumber = 1; mathproblem() { quotient = (integer)llFrand(range)+1; iquotient = (integer)quotient; divisor = (integer)llFrand(range)+1; dividend = iquotient * divisor; //llOwnerSay("dividend = " + (string)dividend + " divisor = " + (string)divisor + " modulus = " + (string)(dividend%divisor)); distractor1 = (string)((integer)llFrand(quotient*2)+1); //llOwnerSay("distractor1 = " + distractor1); distractor2 = (string)((integer)llFrand(quotient*2)+1); //llOwnerSay("distractor2 = " + distractor2); if(dividend % divisor == 0 ) { if(distractor1 != (string)((integer)quotient) && distractor2 != (string)((integer)quotient) && distractor1 != distractor2)//distractors and correct answer ("quotient") must be different. { question = "\n \n \nWas ergibt diese Rechnung?\n \n \n" + " " + (string)dividend + " : " + (string)divisor; choices = [(string)((integer)quotient), distractor1, distractor2]; choicesrand = llListRandomize(choices,1); llDialog(player,question,choicesrand,ichannel); //llRegionSayTo(player,0,"Was ergibt " + (string)divident + " geteilt durch " + (string)divisor + "?"); ilisten=llListen(ichannel, "", NULL_KEY, ""); // listen for dialog answers (from multiple users) //llRegionSayTo(player,0,"\n \nHallo,\n \n"+ (string)llDetectedName(0) + "!\n \n \nDas Quiz beginnt in 5 Sekunden ...\n \n \nDu hast 30 Sekunden Zeit.\n \n \n"); llSetClickAction(8); llSetTimerEvent(1.0); } else { mathproblem(); } } } default { state_entry () { quizname = llGetObjectName(); llSetText("Klicke auf diese Fläche, um das Quiz zu beginnen.", <1.0, 1.0, 1.0>, 1.0); ichannel = (integer)llFrand(9999999999.0); llSetClickAction(CLICK_ACTION_TOUCH); } touch_start (integer num) { player = llDetectedKey(0); nameplayer = llDetectedName(0); mathproblem(); } timer() { ++seconds; ttime=time-seconds; llSetText("übrige Zeit (in Sekunden): "+(string)ttime, <1.0, 1.0, 1.0>, 1.0); if(ttime == 7) { llRegionSayTo(player,PUBLIC_CHANNEL, "\n \nKlicke auf eine Antwort," + nameplayer + "!\n \n \n"); } if(ttime == 0) { llRegionSayTo(player,PUBLIC_CHANNEL, "\n \nDeine Zeit ist abgelaufen!\n \n \n"); llResetScript(); } } listen(integer channel, string name, key id, string message) { if(message == quotient) { llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c ",1.0); llSleep(1.0); llRegionSayTo(player,PUBLIC_CHANNEL, "\n \n \nDas ist richtig, " + name + "!" + "\n \n \nPunkte: " + (string)questionnumber +"/" + (string)quizlength + "\n \n \n \n \n \n"); ++questionnumber; seconds = 0; if (questionnumber - 1 == quizlength) { llListenRemove(ilisten); //llPlaySound(llGetInventoryName(INVENTORY_SOUND,0),1); llSetText(nameplayer + " hat das Quiz gewonnen!", <1.0, 1.0, 1.0>, 1.0); llRegionSay(ichannelscience,"Aufgabe " + quizname + ":" + " " + nameplayer); // Hier sendet das Script den Namen des Spielers bei erfolgreicher Bearbeitung an das Counter-Script. llDialog( id, "\n \nHerzlichen Glückwunsch, " + name + "!\n \n \nDu hast gewonnen!", ["OK"], ichannel); llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c",1.0); llRegionSayTo(player,PUBLIC_CHANNEL, "\n \n \nDies ist deine Medaille.\n \nKlicke auf die Medaille,\n \num sie zu behalten.\n \n \n"); llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT, 0), llGetPos() + <0.0,0.0,4.0>,ZERO_VECTOR,llEuler2Rot(<90.0,0.0,180.0> * DEG_TO_RAD)*llGetRot(),0); llResetScript(); } else { mathproblem(); } } else { integer iWhichOne = (integer) llFrand( llGetListLength( lSounds ) ); llPlaySound( llList2String(lSounds, iWhichOne), 1.0); llSetText("übrige Zeit (in Sekunden): " + (string)time, <1.0, 1.0, 1.0>, 1.0); llRegionSayTo(player,PUBLIC_CHANNEL, "\n \nDas ist falsch. \n \nDu hast verloren, "+nameplayer+".\n \nBeginne das Quiz erneut.\n \n \n"); llResetScript(); } } }
  4. Thank you!👍 I've changed it now in the script above.
  5. This certainly solves the 'division by 0' issue. So, thank you very much for this helpful trick.👍🙂 I'm posting the latest version of the script using this. I still couldn't figure out this issue: if(distractor1 != (integer)quotient && distractor2 != (integer)quotient && distractor1 != distractor2)//distractors and correct answer ("quotient") must be different. I'm leaving this part out now, which in turn sometimes leads to the distractor and the correct answer "quotient" being the same number, which is confusing, but doesn't make it impossible to play. So, in case any of you has further ideas regarding this issue, you're welcom to comment more. Again, thank you all very much for your help!🙂 integer ichannelgerman = -1291; integer ichannelenglish = -1292; integer ichannelmaths = -1293; integer ichannelscience = -1294; integer ichannelsocialscience = -1295; integer ichannelreligion = -1296; integer ichannelart = -1297; integer ichannelmusic = -1298; string quizname; key player; string nameplayer; integer ilisten; integer time = 30; integer ttime; integer seconds; integer ichannel; integer index; integer dividend; integer divisor; float quotient; integer iquotient; list choices; list choicesrand; string distractor1; string distractor2; string question; float range = 10.0; list lSounds = [ "6e517cde-066f-455e-8c6b-f1c33be90dea", "611c9470-507e-4471-8ce2-5ed0962e4c85", "b1e78aa1-52b7-482f-a48a-57e3ddff81fc", "7b978d05-b3bd-4e6f-892f-92dc4845ddd8", "64319812-dab1-4e89-b1ca-5fc937b8d94a", "720ff3dd-8fc6-4523-9670-139df57527f3"]; integer quizlength = 10; integer questionnumber = 1; mathproblem() { quotient = (integer)llFrand(range)+1; iquotient = (integer)quotient; divisor = (integer)llFrand(range)+1; dividend = iquotient * divisor; //llOwnerSay("dividend = " + (string)dividend + " divisor = " + (string)divisor + " modulus = " + (string)(dividend%divisor)); distractor1 = (string)((integer)llFrand(quotient*2)); //llOwnerSay("distractor1 = " + distractor1); distractor2 = (string)((integer)llFrand(quotient*2)); //llOwnerSay("distractor2 = " + distractor2); if(dividend % divisor == 0 ) { question = "Was ergibt " + (string)dividend + " geteilt durch " + (string)divisor + "?"; choices = [(string)((integer)quotient), distractor1, distractor2]; choicesrand = llListRandomize(choices,1); llDialog(player,question,choicesrand,ichannel); //llRegionSayTo(player,0,"Was ergibt " + (string)divident + " geteilt durch " + (string)divisor + "?"); ilisten=llListen(ichannel, "", NULL_KEY, ""); // listen for dialog answers (from multiple users) //llRegionSayTo(player,0,"\n \nHallo,\n \n"+ (string)llDetectedName(0) + "!\n \n \nDas Quiz beginnt in 5 Sekunden ...\n \n \nDu hast 30 Sekunden Zeit.\n \n \n"); llSetClickAction(8); llSetTimerEvent(1.0); } } default { state_entry () { quizname = llGetObjectName(); llSetText("Klicke auf diese Fläche, um das Quiz zu beginnen.", <1.0, 1.0, 1.0>, 1.0); ichannel = (integer)llFrand(9999999999.0); llSetClickAction(CLICK_ACTION_TOUCH); } touch_start (integer num) { player = llDetectedKey(0); nameplayer = llDetectedName(0); mathproblem(); } timer() { ++seconds; ttime=time-seconds; llSetText("übrige Zeit (in Sekunden): "+(string)ttime, <1.0, 1.0, 1.0>, 1.0); if(ttime == 7) { llRegionSayTo(player,PUBLIC_CHANNEL, "\n \nKlicke auf eine Antwort," + nameplayer + "!\n \n \n"); } if(ttime == 0) { llRegionSayTo(player,PUBLIC_CHANNEL, "\n \nDeine Zeit ist abgelaufen!\n \n \n"); llResetScript(); } } listen(integer channel, string name, key id, string message) { if(message == iquotient) { llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c ",1.0); llSleep(1.0); llRegionSayTo(player,PUBLIC_CHANNEL, "\n \n \nDas ist richtig, " + name + "!" + "\n \n \nPunkte: " + (string)questionnumber +"/" + (string)quizlength + "\n \n \n \n \n \n"); ++questionnumber; seconds = 0; if (questionnumber == quizlength) { llListenRemove(ilisten); //llPlaySound(llGetInventoryName(INVENTORY_SOUND,0),1); llSetText(nameplayer + " hat das Quiz gewonnen!", <1.0, 1.0, 1.0>, 1.0); llRegionSay(ichannelscience,"Aufgabe " + quizname + ":" + " " + nameplayer); // Hier sendet das Script den Namen des Spielers bei erfolgreicher Bearbeitung an das Counter-Script. llDialog( id, "\n \nHerzlichen Glückwunsch, " + name + "!\n \n \nDu hast gewonnen!", ["OK"], ichannel); llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c",1.0); llRegionSayTo(player,PUBLIC_CHANNEL, "\n \n \nDies ist deine Medaille.\n \nKlicke auf die Medaille,\n \num sie zu behalten.\n \n \n"); llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT, 0), llGetPos() + <0.0,0.0,4.0>,ZERO_VECTOR,llEuler2Rot(<90.0,0.0,180.0> * DEG_TO_RAD)*llGetRot(),0); llResetScript(); } else { mathproblem(); } } else { integer iWhichOne = (integer) llFrand( llGetListLength( lSounds ) ); llPlaySound( llList2String(lSounds, iWhichOne), 1.0); llSetText("übrige Zeit (in Sekunden): " + (string)time, <1.0, 1.0, 1.0>, 1.0); llRegionSayTo(player,PUBLIC_CHANNEL, "\n \nDas ist falsch. \n \nDu hast verloren, "+nameplayer+".\n \nBeginne das Quiz erneut.\n \n \n"); llResetScript(); } } }
  6. Thank you. Sorry about that. Forgot to Take it out here 🙈 It‘s Not in the issue, though, I tested that.
  7. Okay, so here is the script. Translated into English. Be careful, though, I got into an endless loop occasionally, which made my region crash just now. So I couldn't test it right now for other errors. Here it is: string quizname; key player; string nameplayer; integer ilisten; integer time = 30; integer ttime; integer seconds; integer ichannel; integer index; integer dividend; integer divisor; float quotient; string question; string answer; list choices; list choicesrand; string distractor1; string distractor2; string distractor3; string distractor4; list lSounds = [ "6e517cde-066f-455e-8c6b-f1c33be90dea", "611c9470-507e-4471-8ce2-5ed0962e4c85", "b1e78aa1-52b7-482f-a48a-57e3ddff81fc", "7b978d05-b3bd-4e6f-892f-92dc4845ddd8", "64319812-dab1-4e89-b1ca-5fc937b8d94a", "720ff3dd-8fc6-4523-9670-139df57527f3"]; integer quiz_length; integer questionnumber; mathproblem() { integer dividend = (integer)llFrand(11)+1; integer divisor = (integer)llFrand(11)+1; //llOwnerSay("dividend1 = " + (string)dividend + " divisor1 = " + (string)divisor + " modulus1 = " + (string)(dividend%divisor)); if(divisor != 0) { //llOwnerSay("dividend = " + (string)dividend + " divisor = " + (string)divisor + " modulus = " + (string)(dividend%divisor)); quotient = dividend/divisor; //llOwnerSay("quotient = " + (string)quotient); distractor1 = (string)((integer)llFrand(dividend+divisor)); distractor2 = (string)((integer)llFrand(dividend+divisor)); if((dividend % divisor) == 0) { if(distractor1 != (integer)quotient && distractor2 != (integer)quotient && distractor1 != distractor2) { question = "What is " + (string)dividend + " divided by " + (string)divisor + "?"; choices = [(string)dividend, (string)divisor, distractor1, distractor2]; choicesrand = llListRandomize(choices,1); llDialog(player,question,choicesrand,ichannel); ilisten=llListen(ichannel, "", NULL_KEY, ""); // listen for dialog answers (from multiple users) llSetClickAction(8); llSetTimerEvent(1.0); } else { mathproblem(); //llOwnerSay("distractor or quotient issue"); } } else { mathproblem(); //llOwnerSay("divide by 0 (1)"); } } else { llOwnerSay("divide by 0"); //mathproblem(); } } default { state_entry () { quizname = llGetObjectName(); ichannel = (integer)llFrand(9999999999.0); quiz_length = 10; llSetClickAction(CLICK_ACTION_TOUCH); } touch_start (integer num) { player = llDetectedKey(0); nameplayer = llDetectedName(0); mathproblem(); } timer() { ++seconds; ttime=time-seconds; llSetText("time left (in seconds): "+(string)ttime, <1.0, 1.0, 1.0>, 1.0); if(ttime == 0) { llSay(0, "\n \nYour time is up!\n \n \n"); llResetScript(); } } listen(integer channel, string name, key id, string message) { if(message == quotient) { llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c ",1.0); llSleep(1.0); llRegionSayTo(player,PUBLIC_CHANNEL, "\n \n \nCorrect, " + name + "!" + "\n \n \n"); llResetScript(); if (questionnumber == quiz_length) { llListenRemove(ilisten); llPlaySound(llGetInventoryName(INVENTORY_SOUND,0),1); } else { ++questionnumber; } } else { integer iWhichOne = (integer) llFrand( llGetListLength( lSounds ) ); llPlaySound( llList2String(lSounds, iWhichOne), 1.0); llRegionSayTo(player,PUBLIC_CHANNEL, "\n \nWrong.\n \n \n"); llResetScript(); } } }
  8. Thank you, too, for your idea. I tried if(divisor != 0) but that didn't help. dividend = 0 shouldn't be a problem, should it? Is there another way of doing this, maybe?
  9. Thank you very much for your quick reply, too. I had tried that out, but it also didn't help. Still, thank you for your input.👍🙂
  10. Thank you very much for your help. I forgot to change that in the version posted here. I had tried "&&" but it didn't solve the issue, either.
  11. Hi! I have a script that is supposed to create random maths problems for people to solve. It is started by touch_start. The operation itself is a 'function'. The issue is that I sometimes get an error message claiming that an illegal division by 0 has happened. I tried to exclude the possibility of that happening, but it keeps giving the same error message. Maybe you have an idea what causes the issue? Thank you very much in advance! integer dividend; integer divisor; float quotient; string distractor1; string distractor2; mathproblem() { integer dividend = (integer)llFrand(11);//Dividend between 0 and 11 is created. integer divisor = (integer)llFrand(11);//Divisor between 0 and 11 is created. if(divisor != 0)//Divisor must not be 0 to prevent illegal operation. Here seems to lie one of the issues. { quotient = dividend/divisor; distractor1 = (string)((integer)llFrand(dividend+divisor));//two distractors for the dialog are created distractor2 = (string)((integer)llFrand(dividend+divisor)); if(dividend % divisor == 0)//Division must create an complete number. { if(distractor1 != (integer)quotient & distractor2 != (integer)quotient & distractor1 != distractor2)//distractors and correct answer ("quotient") must be different. Here seems to lie a second issue. { ask maths division question in dialog } else { mathproblem();//In case condition is not fulfilled, start operation again. } else { mathproblem();//In case condition is not fulfilled, start operation again. } } else { mathproblem();//In case condition is not fulfilled, start operation again. } }
  12. Thank you very much for your quick reply. I couldn't find the scripts you mentioned through search terms here. Do you maybe remember the approximate topic / title of the threat? Thank you!
  13. Hi! I've got a script that works as follows: - When the object is touched, a timer event is started. - After a certain time span ("interval") the script is supposed to implement an action. - After a longer time span ("playingtime") the script is supposed to reset. - When the object is touched for a second time, a different action is supposed to be implemented. The timer is supposed to continue throughout. What happens is the following: When the object is touched twice in a row, everything works the way it is supposed to. However, when the object is touched just once, the timer keeps running until "interval", then performs the action associated with it, but then stops running afterwards, although "playingtime" has not been reached yet. The touch_start event is not responding any more, either. The problem seems to lie in the "interval" part, but I just can't figure it out. Maybe you have an idea of how to solve this issue? Thank you very much in advance! Here is the script: integer on; integer seconds; integer interval = 10; integer ttime; integer playingtime = 30; touch_start(integer number) { if(on == FALSE) { llSetTimerEvent(1.0); 'do something' on = TRUE; } else { 'do something else' on = FALSE; } } timer()//is only started when on == FALSE { ++seconds; ttime = playingtime - seconds; llSetText("time left (in seconds):\n \n " + (string)ttime, <1.0, 1.0, 1.0>, 1.0); if(seconds == interval) { 'do something else again'//This action is still implemented. But then the timer stops and touch_start does no longer respond. on = FALSE; } else if(ttime == 0) { llResetScript(); } }
  14. Thank you very much for your quick reply. I ended up writing the script once more from scratch and the problem seems to be solved. I still haven't found out why this occured, but I guess it was more caused by other parts of the script. Should I run into more trouble, I'll come back again. So far it's looking good. So, thank you very much, once again! 🙂
  15. Hi! I've got the following function: integer distance = 20; float move = 5.0; integer imove; integer way; integer count; step() { oldPosition = llGetPos(); llSetLinkPrimitiveParamsFast(1, [PRIM_POSITION, oldPosition + <move,0.0,0.0>]); ++count; llOwnerSay("count = " + (string)count); imove = (integer)move; llOwnerSay("imove = " + (string)imove); way = imove * count; llOwnerSay("way = " + (integer)count); if(way >= distance) { ... do something Each time the object moves forward in the x-direction, a counter counts this step ("count"). The integer "way" is supposed to be the distance the object is travelling ("move"/ "imove") multiplied by the number of steps ("count") . This means the function is supposed to measure the way the object has travelled from its starting point as follows: (integer imove is "5".) way = 5 * 1 = 5 (++count) way = 5 * 2 = 10 (++count) way = 5 * 3 = 15 When the "way" has reached a certain length ("distance"), something else is supposed to happen. However, for whatever reason, the result of "way = imove * count" always turns out to be: way = 1 * 1 = 1 (++count) way = 1 * 2 = 2 (++count) way = 1 * 3 = 3 I just can't find out why "imove" always turns out as equal to "1". Do you maybe have an idea? Thank you very much in advance!
  16. Hi! I would like to have a pose-ball script for a fashion-shop, which automatically rotates the avatar, so you automatically see him / her from all sides. This automatically works when the pose-stand itself is rotating. Unfortunately, as soon as you click on the rotating avatar, the camera also automatically starts rotating with the avatar (basically, you are rotating with the avatar while looking at him / her, like on a carousel). This cannot be stopped. I'm using the Firestorm Viewer. Is it possible to prevent the camera from rotating with the avatar when clicking on him / her? Here is the script: Thank you very much in advance! //Where user sits in relation to object. ( <X,Y,Z> ) vector offset=<0.0,0.0,1.0>; string anim; key avatar; default { state_entry() { llTargetOmega(<0.0,0.0,0.05>,TWO_PI,1.0); llSitTarget(offset,ZERO_ROTATION); anim = "turn_180"; llSetSitText("Pose"); } changed(integer change) { if(change & CHANGED_LINK) { avatar = llAvatarOnSitTarget(); if(avatar != NULL_KEY) { //SAT DOWN llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION); return; } else { //STOOD UP if (llGetPermissionsKey() != NULL_KEY) { llStopAnimation(anim); } return; } } if(change & CHANGED_INVENTORY) { llResetScript(); } if(change & CHANGED_OWNER) { llResetScript(); } } run_time_permissions(integer perm) { if(perm & PERMISSION_TRIGGER_ANIMATION) { llStopAnimation("sit"); llStartAnimation(anim); } } }
  17. Thank you very much for the explanations of the three of you!🙂 I think I have understood the difference. @Mollymews: Your idea was correct. I forgot to clearly define "detectedlinknumber" as a global variable, consequently setting it to ZERO in the touch_start event, automatically rendering the condition as false.🤦‍♂️ The bitwise and logical "AND" both work in the script now. I tried to apply your example to my script. Did I understand it correctly? (This is more theoretical now, so only reply if you feel like it.) resultA = detectedlinknumber <= listlength //if TRUE then the result would be "1", binary: 0001 resultB = detectedlinknumber != 1 //if TRUE then the result would be "1", binary: 0001 finalresult = resultB & resultA //comparing 0001 and 0001 = 0001, decimal: 1, Boolean: TRUE Is that how it works?
  18. Wow, thank you very much for your explanation, guys! I'll need some time to read through this in detail. I'll do that during the week. Thank you so much, again!👍🙂
  19. Thank you so much for your quick reply! I don't know why, but this still did not solve the problem (I tried both the logical and bitwise version). I ended up using the following version, which now works: if(detectedlinknumber != 1) { if(detectedlinknumber <= listlength) { ... In terms of programming logic, this should be exactly the same thing. I really don't understand why the versions using "&" do not work with me. Sometimes certain things just don't work on my region (Opensim), for whatever reason. So, just out of curiosity, in case you have more ideas, feel free to comment further. Besides: (If you feel like explaining it) what exactly is the difference between "logical" and "bitwise"?
  20. Hi! I have a script containing 2 conditions. The script is only supposed to start when both conditions are fulfilled: integer detectedlinknumber = llDetectedLinkNumber(0); list listx = ["one", "two", "three"]; //random example of a list integer listlength = llGetListLength(listx); //condition 1: if(detectedlinknumber != 1) //The link must not be the root prim (linknumber 1) AND //condition 2: if(detectedlinknumber <= listlength) //The linknumber must be smaller or equal to the number of entries on the list. I tried the following methods, which both failed: if(detectedlinknumber != 1 & detectedlinknumber <= listlength) if(detectedlinknumber != 1 && detectedlinknumber <= listlength) Do you maybe know how to do this right? Thank you very much in advance!
  21. Wow, that's interesting information I'm learning here. Thank you, guys! 🙂
  22. Thank you! So states take a bit more memory than resetting?
  23. Thank you so much for your help! This was a lot of new information for me. 👍 It seems to have solved both issues. 🙂 Maybe one more question: What advantage exactly is there in going back to state default compared to resetting the script? I guess the main advantage is that going back to state default is more memory / server friendly than resetting the script completely?
  24. Hi! I've had two issues with collision events that I couldn't figure out. Maybe you guys can help me with this. This is issue number 1: When an avatar flies through an object, an event is supposed to be triggered. However, the script first works for some time but then stops working with the particular avatar. I couldn't find out why. The script looks as follows (it's a standard script): default { state_entry() { llVolumeDetect(TRUE); // Starts llVolumeDetect } collision_start(integer total_number) { llSay(0, "Detected!"); // Tells you when something penetrates the prim } } I had to completeley get rid of llVolumeDetect to make it work. issue number 2: When an avatar walks or falls onto an object, the object is supposed to become alpha and phantom. The script works at first, but at the second collison with the same avatar, it doesn't work any more. This only seems to be the case with a "collision" event. "collision_start" doesn't seem to cause that issue. Do you maybe have some ideas of why this could be? (What is the difference between "collision" and "collision_start" anyway?) Thank you very much in advance! This is the script: float idle = 5.0; key user; string nplayer; default { state_entry() { llSetLinkPrimitiveParamsFast(2, [ PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 0.0>, 1.0, PRIM_PHANTOM, FALSE, PRIM_LINK_TARGET,1, PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0 ]); } collision(integer num_detected) { user = llDetectedKey(0); nplayer = llDetectedName(0); state phantom; } } state phantom { state_entry() { llRegionSayTo(user,0,"Hi, " + nplayer); llSetLinkPrimitiveParamsFast(2,[ PRIM_COLOR, ALL_SIDES, ZERO_VECTOR, 0.0, PRIM_PHANTOM,TRUE, PRIM_LINK_TARGET,1, PRIM_COLOR, ALL_SIDES, ZERO_VECTOR, 0.0]); llSleep(idle); llResetScript(); } }
  25. Thanks for your idea. I used that for a new version of the script and managed to make the buttons clicked "sink" in the console through that. I keep my fingers crossed that this was the solution. It looks good so far. So here is the new version: string region; key user; string nameuser; integer linknum; list tasks = [ <17.00,36.70,24.00>,"destination1", <29.00,10.00,24.00>,"destination2", <512.00,512.00,7938.00>,"destination3" ]; list positions; vector pos; vector lookat = <0.0,0.0,0.0>; integer listlength; integer linkstotal; integer seconds; integer interval = 180; list ltext; string stext; vector rotationAngle; rotation rot; default { state_entry() { llSetTimerEvent(1.0); rotationAngle = <0.0, 270.0, 0.0>* DEG_TO_RAD; rot = llEuler2Rot( rotationAngle ); linkstotal = llGetNumberOfPrims(); integer i; for(i=2; i<=linkstotal; ++i) llSetLinkPrimitiveParamsFast(i,[PRIM_ROT_LOCAL, rot, PRIM_SLICE,<0.0,0.05,0.0>]);//<-- This is the new part. ltext = llList2ListStrided(llDeleteSubList(tasks,0,0),0,-1,2); region = llGetRegionName(); positions = llList2ListStrided(tasks,0,-1,2); //llOwnerSay("listlength = " + (string)listlength); //llOwnerSay("linkstotal =" + (string)linkstotal); integer listlength = llGetListLength(positions); integer j; for(j=2; j<=listlength+1;++j) llSetLinkPrimitiveParamsFast(j,[PRIM_COLOR,ALL_SIDES,<1.0,1.0,1.0>,1.0, PRIM_SLICE,<0.0,1.0,0.0>]);//<-- This is the new part. } touch_start(integer num) { user = llDetectedKey(0); nameuser = llDetectedName(0); integer detectedlinknumber = llDetectedLinkNumber(0); //llOwnerSay("detectedlinknumber = " + (string) detectedlinknumber); linknum = detectedlinknumber - 1; stext = llList2String(ltext,linknum - 1); //llOwnerSay("linknumber = " + (string)linknum); pos = llList2Vector(positions,(linknum-1)); //llOwnerSay("vector = " + (string)pos); if(pos != ZERO_VECTOR) { if(detectedlinknumber != 1) { //llOwnerSay((string)pos); llPlaySound("4c8c3c77-de8d-bde2-b9b8-32635e0fd4a6",1.0); llSetLinkPrimitiveParamsFast(detectedlinknumber,[PRIM_SLICE,<0.0,0.05,0.0>, PRIM_TEXT,stext,<1.0,1.0,1.0>,1.0]);//<-- This is the new part. osTeleportAgent(user,region,pos,lookat); } } //else //{ //llOwnerSay("not on the list"); //} } timer() { ++seconds; if(seconds == interval) { llResetScript(); } } }
×
×
  • Create New...