Jump to content

testgenord1

Resident
  • Posts

    146
  • Joined

  • Last visited

Everything posted by testgenord1

  1. Hi again! Thank you very much for your help, again. It worked better today without actually changing the script, but again not all the time. I'll do more experiments with it and write back to you next week. Thanks again!
  2. Thank you very much for your time and your help, guys. I really appreciate this. This is part of the memory game. The player has to gain 6 points to win. He / she only has 120 seconds to achieve this. After scoring a point, the player has 120 seconds time to find 5 more matches. After 120 seconds the point is subtracted again (the "-" part), so the player needs to hurry up to finish the game. I don't think this is where the problem lies, but maybe I'm missing something here. Thanks for your tip anyway!
  3. Thank you very much for your replies. The win state isn't reached when I use the script. I can't tell why. Maybe it's the messenger script and not the listener causing the problem. I'm posting the messenger script below, maybe it will give you some ideas. It's a memory game. The script sends a message when a matching memory game piece is clicked. This in turn is supposed to trigger the point counter: // KFM Vocabulary Memory Game Reciever v0.2 by djphil (CC-BY-NC-SA 4.0) //https://community.secondlife.com/forums/topic/434279-llsetkeyframedmotion-forward-and-back/ list KFMcommand;//changed original script here. integer canal = -123654789; integer tempo = 5; integer echo; integer count; integer power; string lang; string word; string trad; string prim; vector pos; rotation rot; rotation NormRot(rotation Q) { float MagQ = llSqrt(Q.x*Q.x + Q.y*Q.y +Q.z*Q.z + Q.s*Q.s); return <Q.x/MagQ, Q.y/MagQ, Q.z/MagQ, Q.s/MagQ>; } default { state_entry() { llSetClickAction(0); list buffer = llCSV2List(llGetObjectName()); if (llGetListLength(buffer) == 2) { lang = llStringTrim(llList2String(buffer, 0), STRING_TRIM); prim = llStringTrim(llList2String(buffer, 1), STRING_TRIM); } else { llOwnerSay("Error: Bad prim name detected"); return; } buffer = llCSV2List(llGetObjectDesc()); if (llGetListLength(buffer) == 2) { word = llStringTrim(llList2String(buffer, 0), STRING_TRIM); trad = llStringTrim(llList2String(buffer, 1), STRING_TRIM); } else { llOwnerSay("Error: Bad prim desc detected"); return; } //llSetText("state: ready", <1.0, 1.0, 1.0>, 1.0); llSetText("ready", <1.0, 1.0, 1.0>, 1.0); llSetLinkPrimitiveParamsFast(LINK_THIS, [ PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX ]); } touch_start(integer number) { llPlaySound(llGetInventoryName(INVENTORY_SOUND,0),1); llListenRemove(echo); count = 0; if (power =! power) { echo = llListen(canal, prim + "," + lang, NULL_KEY, ""); llSetTimerEvent(0.1); } else { llSetTimerEvent(0.0); } //llSetText("state: ready", <1.0, 1.0, 1.0>, 1.0); llSetText("ready", <1.0, 1.0, 1.0>, 1.0); } listen(integer channel, string name, key id, string message) { list buffer = llCSV2List(name); if (llGetListLength(buffer) == 2) { name = llList2String(buffer, 0); if (name == prim) { buffer = llCSV2List(message); if (llGetListLength(buffer) == 3) { message = llList2String(buffer, 0); pos = (vector)llList2String(buffer, 1); rot = llList2Rot(buffer, 1); if (message == trad) { llListenRemove(echo); power =! power; llShout(canal, message); state move; } } } } } timer() { llSetTimerEvent(1.0); llShout(canal, word + "," + (string)llGetPos() + "," + (string)llGetRot()); if (count > tempo) { llResetScript(); } llSetText("time left: " + (tempo - count), <1.0, 1.0, 1.0>, 1.0); ++count; } } state move { state_entry() { llSetClickAction(8); llShout(-1008,"+");// <----------------------------------Here the "plus" message is sent. llOwnerSay(llGetScriptName()+" in move state with pos = "+(string)pos); rotation spin = NormRot(llEuler2Rot(<90.0, 0.0, 0.0> * DEG_TO_RAD)); rotation spinz = NormRot(llEuler2Rot(<0.0, 180.0, 0.0> * DEG_TO_RAD)); KFMcommand = [ <0.0, 0.0, 1.0> * llGetRot(), ZERO_ROTATION, 0.5, pos - llGetPos(), ZERO_ROTATION, 1.0, ZERO_VECTOR, spin, 0.5, ZERO_VECTOR, spinz, 0.5, ZERO_VECTOR, spinz, 0.5, ZERO_VECTOR, ZERO_ROTATION, 120.0// hier bleibt es für 120 Sekunden stehen. ]; llSetKeyframedMotion(KFMcommand, [KFM_MODE, KFM_FORWARD]); llSleep(5.0); llShout(canal, word + "," + (string)llGetPos() + "," + (string)llGetRot()); llSetKeyframedMotion(KFMcommand, [KFM_MODE, KFM_REVERSE]); llShout(canal, trad); //llSetText("lang: " + lang + "\nword: " + word + "\ntrad: " + trad, <1.0, 1.0, 1.0>, 1.0); llSetTimerEvent(120.0); } timer() { llShout(-1008,"-");// <----------------------------------Here the "minus" message is sent. llResetScript(); } }
  4. Hi once more! I'm trying to build a script, that is supposed to listen to two different messages. The first message ("+") is supposed to add one point to a counter, whereas the second ("-") is to subtract a point. Both messages are sent in a random sequence, for example, there could be two consecutive "+", and then one "-", and then three "+", etc. being sent to the listener script, randomly adding and subtracting points to / from the counter. Hence, the script must be able to add and subtract points at the same time. I guess it's not that difficult, but I just can't figure it out. Do you maybe have an idea? Any help will be appreciated. Thank you very much in advance. Here is the script: integer i; default { state_entry() { llListen(-1008,"",NULL_KEY,""); } listen(integer channel,string name,key id,string message) { if(message =="+") { ++i; } if(message =="-") { --i; } if(i==6) { state win; } } } state win { state_entry() { llSay(0, "\n \n \nCongratulations!\n \nYou've won!\n \n \n"); llResetScript(); } }
  5. Wow, that was fast. Thank you so much, Dargo! Your script works wonderfully. Amazing. Thank you very much again!😊
  6. Hi! I've got a script from somebody else which arranges linked prims in one line by the same distance to each other (for example for linking letters to a word in one regular line). I would like the script to be more automatic by adding a dialog offering a "+" and "-" choice. "+" would mean that the distance between the linked prims should increase by a given value, "-" should make the distance decrease. (You could also add "++" and "--" for double-steps etc.) The dialog menu should stay open until the user deliberately closes it, so that the user can add as many plus and/or minus can be added as he/she wishes. Unfortunately, this seems to be beyond my scripting skills. Does any of you maybe have an idea of how to do this? You can find the scripts below. //by djphil, 01/14/2020 default { state_entry() { vector size = llGetScale(); float distance = 1.0; integer i; integer n = llGetNumberOfPrims(); for (i = 1; i < n; ++i) llSetLinkPrimitiveParamsFast(i + 1, [PRIM_POS_LOCAL, <0.0, i * (size.y + distance), 0.0>]); } } The dialog could start like this: key user; default { touch_start(integer num) { user = llDetectedKey(0); llDialog(user , "Add as much distance between the prims as you like:" , ["+" , "-" ] , 0); llListen(0, "", user, ""); } listen(integer chan, string name, key id, string msg) { if (msg == "+") ... if (msg == "-") ... } Thank you very much in advance.
  7. Hi again! Thank you very much for your ideas. It looks as though I've been successful through your help. I'm posting the script below. The script does the following: With each correct answer a part of a transparent linkset is made visible, which serves as a victory podium. The linkset consists of 10 transparent childprims, and one non-transparent childprim as starting button (childprim 11). Once all childprims are visible, the user is teleported on top of the prim containing the script as a victory honoring. There is always room for improvement, so feel free to comment (for example, the 3 different particle systems are a bit clumsy). Here is the script: Thank you very much again! //https://community.secondlife.com/forums/topic/444235-quiz-using-dialog-menu/ integer gListen; integer time; integer seconds; key user; list lChildprims = [2,3,4,5,6,7,8,9,10,1]; integer iChildprim; integer total; integer countChildprims; integer count; integer gameover; integer CHANNEL = -808; integer index; string answer; 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"]; list quiz = [ // question answer picks (buttons) the pipe | is the delimiter "\n \nWho lives in Buckingham Palace?\n \n \n", "Queen", "Queen|Ministers|Lords", "\n \nThe White House:\n \nHere lives the President of ...?\n \n \n", "USA", "Britain|Australia|USA", "\n \nWhich country is the biggest?\n \n \n", "Canada", "USA|Canada|Britain", "\n \nWhere can you find the 'Statue of Liberty'?\n \n \n", "New York City", "Los Angeles|New York City|Washington", "\n \nWhich is the capital of the United States?\n \n \n", "Washington", "New York City|Los Angeles|Washington", "\n \nWhat was found in California in 1849?\n \n \n", "gold", "oil|gold|natural gas", "\n \nWhat did Levi Strauss invent?\n \n The first ...", "blue jeans", "car|computer|blue jeans", "\n \nWhich material are blue jeans made of?\n \n \n", "cotton", "wool|silk|cotton", "\n \nWhat is the name of the 'Freiheits-Statue' in English?\n \n The 'Statue of ...'\n \n", "Liberty", "Life|Light|Liberty", "\n \nWhat is the capital of Great Britain?\n \n \n", "London", "Washington|London|Sidney" ]; integer stride = 3; integer quiz_length; integer question_number; string correct_answer; // so it's available in the listen event when the user has made their choice confetti() { llParticleSystem([PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE , PSYS_PART_START_ALPHA,0.5, PSYS_PART_END_ALPHA,0.1, PSYS_PART_START_COLOR,<1,1,1> , PSYS_PART_END_COLOR,<1,1,1> , PSYS_PART_START_SCALE,<1,1,0>, PSYS_PART_END_SCALE,<1,1,0>, PSYS_PART_MAX_AGE,4.0, PSYS_SRC_MAX_AGE,1.0, PSYS_SRC_ACCEL,<0.10,-0.5,-5>, PSYS_SRC_BURST_PART_COUNT,1000, PSYS_SRC_BURST_RADIUS,1, PSYS_SRC_BURST_RATE,5.0, PSYS_SRC_BURST_SPEED_MIN,5, PSYS_SRC_BURST_SPEED_MAX,15, PSYS_SRC_ANGLE_BEGIN,PI, PSYS_SRC_ANGLE_END,PI, PSYS_SRC_OMEGA,<0,0,0>, PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 0), PSYS_SRC_TARGET_KEY, NULL_KEY ]); } confetti1() { llParticleSystem([PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE , PSYS_PART_START_ALPHA,0.5, PSYS_PART_END_ALPHA,0.1, PSYS_PART_START_COLOR,<1,1,1> , PSYS_PART_END_COLOR,<1,1,1> , PSYS_PART_START_SCALE,<1,1,0>, PSYS_PART_END_SCALE,<1,1,0>, PSYS_PART_MAX_AGE,4.0, PSYS_SRC_MAX_AGE,1.0, PSYS_SRC_ACCEL,<0.10,-0.5,-5>, PSYS_SRC_BURST_PART_COUNT,1000, PSYS_SRC_BURST_RADIUS,1, PSYS_SRC_BURST_RATE,5.0, PSYS_SRC_BURST_SPEED_MIN,5, PSYS_SRC_BURST_SPEED_MAX,15, PSYS_SRC_ANGLE_BEGIN,PI, PSYS_SRC_ANGLE_END,PI, PSYS_SRC_OMEGA,<0,0,0>, PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 1), PSYS_SRC_TARGET_KEY, NULL_KEY ]); } confetti2() { llParticleSystem([PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE , PSYS_PART_START_ALPHA,0.5, PSYS_PART_END_ALPHA,0.1, PSYS_PART_START_COLOR,<1,1,1> , PSYS_PART_END_COLOR,<1,1,1> , PSYS_PART_START_SCALE,<1,1,0>, PSYS_PART_END_SCALE,<1,1,0>, PSYS_PART_MAX_AGE,4.0, PSYS_SRC_MAX_AGE,1.0, PSYS_SRC_ACCEL,<0.10,-0.5,-5>, PSYS_SRC_BURST_PART_COUNT,1000, PSYS_SRC_BURST_RADIUS,1, PSYS_SRC_BURST_RATE,5.0, PSYS_SRC_BURST_SPEED_MIN,5, PSYS_SRC_BURST_SPEED_MAX,15, PSYS_SRC_ANGLE_BEGIN,PI, PSYS_SRC_ANGLE_END,PI, PSYS_SRC_OMEGA,<0,0,0>, PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 2), PSYS_SRC_TARGET_KEY, NULL_KEY ]); } default { state_entry () { quiz = llListRandomize (quiz, stride); quiz_length = llGetListLength (quiz); llSetClickAction(CLICK_ACTION_TOUCH); llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>,0.0,PRIM_PHANTOM,TRUE]); llSetLinkPrimitiveParamsFast(11, [PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0]); //count = llGetListLength(quiz) / 3; } touch_start (integer num) { gListen=llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users) user = llDetectedKey(0); llRegionSayTo(user,0,"Hello, "+ (string)llDetectedName(0) + "!"); llSetClickAction(8); if (llDetectedKey(0) == user) // ignore touches from people not the player { //index = (index + 1 + (integer)llFrand(count)) % count * 3; //} llSetTimerEvent(1.0); string question = llList2String (quiz, question_number * stride); correct_answer = llList2String (quiz, question_number * stride + 1); list choices = llParseString2List (llList2String (quiz, question_number * stride + 2), ["|"], []); llDialog (llDetectedKey (0), question, choices, CHANNEL); ++question_number; } } timer() { ++seconds; time=60-seconds; llSetText("time left (seconds): "+(string)time, <1.0, 1.0, 1.0>, 1.0); if(time == 0) { llSay(0, "\n \nYour time is up!\n \n \n"); llResetScript(); } } listen(integer channel, string name, key id, string message) { if (message == correct_answer) { llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c ",1.0); llSay(0, "\nThat's correct, " + name + "!" + "\n \n \n"); total = llGetListLength(lChildprims); integer iChildprim=llList2Integer(lChildprims,countChildprims++); llSetLinkPrimitiveParamsFast(iChildprim, [PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0,PRIM_PHANTOM,TRUE]); //if (question_number * stride == quiz_length) if (countChildprims == total) { llListenRemove(gListen); countChildprims = 0; llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_PHANTOM,FALSE]); llSetText(name + " has won the quiz!", <1.0, 1.0, 1.0>, 1.0); llDialog( id, "\n \nGlückwunsch! Du hast gewonnen!", ["OK"], CHANNEL); //llDialog (id, "\n\nThat's all, folks!", ["OK"], CHANNEL); //llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT, 0), llGetPos() + <-8.0,5.0,-2.0>,ZERO_VECTOR,llEuler2Rot(<90,0,0> * DEG_TO_RAD)*llGetRot(),0); llGiveInventory(id,llGetInventoryName(INVENTORY_OBJECT,0)); llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c ",1.0); llSay(0, "\n \nDies ist deine Medaille. \n \n Klicke auf 'Behalten', um sie zu behalten.\n \n \n"); //llSay(0, "\n \nDu hast das Quiz gewonnen, " +name+ ".\n \n \nBerühre die Statue."); vector det_pos = llGetPos(); llSleep(5.0); llTeleportAgent(user,"", det_pos+<0.0,0.0,1.5>, <0.0,1.0,0.0>); llSleep(3.0); llPlaySound("cheer-hooter-01",1.0); llSleep(2.0); confetti(); llSleep(3.0); llPlaySound("cheer-hooter-01",1.0); llSleep(2.0); confetti1(); llSleep(3.0); llPlaySound("cheer-hooter-01",1.0); llSleep(2.0); confetti2(); llSleep(10.0); llParticleSystem([]); llResetScript(); } else { string question = llList2String (quiz, question_number * stride); correct_answer = llList2String (quiz, question_number * stride + 1); list choices = llParseString2List (llList2String (quiz, question_number * stride + 2), ["|"], []); llDialog (id, question, choices, CHANNEL); ++question_number; } } else { llSetText("time left (seconds): 60", <1.0, 1.0, 1.0>, 1.0); llSay(0, "\n \nThat's wrong. \n \nYou lose, "+name+".\n \nStart the quiz again.\n \n \n"); integer iWhichOne = (integer) llFrand( llGetListLength( lSounds ) ); llPlaySound( llList2String(lSounds, iWhichOne), 1.0); llResetScript(); } } }
  8. Thank you very much for your reply. I really like the idea, and I tried to implement it in the script. Unfortunatly, I haven't been able to find out how to sequentially go through the new list. Do you maybe have a idea how to do that? Thank you very much in advance!
  9. Hi again. Thank you all again for your support in building this script, which I'm still using. There is just one little addition I would like to implement, which is, I would like to make sure the random questions in the dialog are only asked once in one round of playing, so that the same questions don't show up again and again in the same round. Somebody in a different forum suggested the following method, which probably makes a lot of sense, but I haven't been able to integrate it into the original script. Do you maybe know how this could be done? Thank you very much in advance. Here is the suggestion from the other user: list questions = ["a", "b", "c", "d", "e"]; // The list "questions" is called "quiz" in the original script. default { state_entry() { llOwnerSay("Initialisation ..."); } touch_start(integer number) { integer len = llGetListLength(questions); // see above. if (len <= 0) llResetScript(); integer random = llRound(llFrand(len)) - 1; // The integer "random" seems to be similar to "count" in the original script. string question = llList2String(questions, random);. questions = llDeleteSubList(questions, random, random);. } }
  10. Thank you very much for your explanations. I used them and through trial and error ended up with the following script version, which works. What I don't understand is the fact that the second version below does not work, i.e. no matter how you change the numbers (8 and 7 etc.), either one child-prim remains non-alpha, or all become alpha, but then the script does not reset any more. Do you maybe have an idea why this is the case? Thanks in advance. working version: //linkset has 14 child-prims + root-prim = 15 prims. integer i; integer j; integer n; default { state_entry() { llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>,1.0]); } touch_start(integer num) { n= llGetNumberOfPrims(); i++; j--; llSetLinkPrimitiveParamsFast(i+1,[PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>,0.0,//1 being the root prim, this starts with first child-prim, 2. PRIM_LINK_TARGET,(n+1)+j, PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>,0.0]);//In order to imply childprim 15, it starts counting downwards from 16. if (i > 7) { //integer i = 0; llResetScript(); } } } not-working version: //linkset has 14 child-prims + root-prim = 15 prims. integer i; integer j; default { state_entry() { llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>,1.0]); } touch_start(integer num) { n= llGetNumberOfPrims(); i++; j++; llSetLinkPrimitiveParamsFast(i,[PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>,0.0, PRIM_LINK_TARGET,j+8, PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>,0.0]); if (i >= 8) { //i = 0; //j = 0; llResetScript(); } } }
  11. I've found a work-around myself now, maybe not the most elegant solution, though. I just split the list into to lists and now the process is started with each of the two shorter lists seperately, thus taking half the time. If you happen to have a more elegant solution or you have other ideas of improvement, feel free to comment. list lChildprims = [2,3,4,5,6,7,8]; //1 being the root prim, here remaining alpha throughout. list lChildprims1 = [9,10,11,12,13,14,15]; integer iChildprim; integer total; integer countChildprims; integer iChildprim1; integer total1; integer countChildprims1; integer tick; default { state_entry() { llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>,0.0,PRIM_PHANTOM,TRUE]); } touch_start(integer num) { total = llGetListLength(lChildprims); if (countChildprims >= total) countChildprims = 0; integer iChildprim=llList2Integer(lChildprims,countChildprims++); llSetLinkPrimitiveParamsFast(iChildprim, [PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0,PRIM_PHANTOM,TRUE]); total1 = llGetListLength(lChildprims1); if (countChildprims1 >= total1) countChildprims1 = 0; integer iChildprim1=llList2Integer(lChildprims1,countChildprims1++); llSetLinkPrimitiveParamsFast(iChildprim1, [PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0,PRIM_PHANTOM,TRUE]); ++tick; if (tick > 14) { //tick = 0; llResetScript(); } } }
  12. Hi again! I've made a script that turns childprims from alpha to non-alpha according to their position in the linkset, starting from the first childprim, going through to the last, and then turn them all alpha again. What I would like to do is the following: In order to shorten this process, I would like to have more than one childprim turn non-alpha in one go (here by one touch), so that childprim 2and3, 4and5, 6and7 ... become non-alpha in one go at the same time. Which part of the script do I have to change? Do you maybe have an idea? I'm posting a simplified version of the script below. Thank you very much for your help in advance. list lChildprims = [2,3,4,5,6,7,8,9,10,11,12,13,14,15]; //1 is the root prim, which thus remains alpha throughout. integer iChildprim; integer total; integer countChildprims; integer tick; default { state_entry() { llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>,0.0,PRIM_PHANTOM,TRUE]); } touch_start(integer num) { total = llGetListLength(lChildprims); if (countChildprims >= total) countChildprims = 0; integer iChildprim=llList2Integer(lChildprims,countChildprims++); llSetLinkPrimitiveParamsFast(iChildprim, [PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0,PRIM_PHANTOM,TRUE]); ++tick; if (tick > 14) { //tick = 0; llResetScript(); } } }
  13. Thank you very much for your ideas. I certainly learned a lot today. @Qie Niangao: I'm on Opensim mostly, and that does not seem to be a problem here. Is this maybe more a Second Life issue? @Rolig Loon: For whatever reason, the toggle switch works in other script versions I tried, but not in this one. This seems to have to do with the fact that it's an attachment. Does an attachment maybe count as an implicit touch_start? So I ended up using Profaitchikenz Haiku's idea. The script only reacts to the new owner. If it's not the owner touching it, the script is reset, and so the owner has to touch again, which is a bit clumsy. So if you have better ideas, you're welcome to comment. The script has worked so far. I'm posting it below. There is always room for improvement, so feel free to comment further. Thank you very much again! // Target Sensor Teleporter v0.1 by djphil (CC-BY-NC-SA 4.0) key user; string message; default { attach(key id) { if (id) // is a valid key and not NULL_KEY { //llSetClickAction( CLICK_ACTION_TOUCH ); llRegionSayTo(id,0,"You have 15 minutes time.\n \n Click on the teleporter in your hand."); llSetTimerEvent(900.0); } } touch_start(integer num) { user = llDetectedKey(0); if(llGetOwner()==user) { llRegionSayTo(user,0,"\n \n Write the number of your destination station into the chat and press 'enter'."); llListen(PUBLIC_CHANNEL, "", user, ""); } else { llResetScript(); } } listen(integer channel, string name, key id, string message) { message = llStringTrim(message, STRING_TRIM); if(message) { llSensor ("station "+message,"",PASSIVE | ACTIVE,96.0,PI); } } sensor(integer number) { vector det_pos = llDetectedPos(0)+<0.0,-5.0,-2.0>; llTeleportAgent(user,"", det_pos, <0.0,1.0,0.0>); } timer() { llRegionSayTo(user,0,"Your time is up."); llSetTimerEvent(0); llSetScriptState(llGetScriptName(),FALSE); } }
  14. Hi! I've made a script enabling the user to teleport to different stations according to the name of the particular station. For example, when you write the number "1" into the chat, you are teleported to "station 1" etc. The script is in an object the user has to attach to him/herself. It listens for the numbers and uses them for the respective teleport destinations. After a certain time the script is switched off entirely, to prevent that teleporting option from being infinite. There is one problem I couldn't solve, though, and that is, in theory, a second avatar could touch the attachment and type a number into the chat. Thereby the avatar wearing the attachment would be teleported to the respective undesired destination. So there is the possibility of griefing in this. I tried llSetClickAction(8); to disable the clicking of the attachment which has worked in other examples but not in this one. Do you maybe see how that possibility could be stopped? I'm posting the script below. I'm sure it contains some more flaws, so feel free to make any kind of suggestions of improvement. Thank you very much in advance. key user; key caller; string message; default { attach(key id) { if (id) // is a valid key and not NULL_KEY { llSetClickAction( CLICK_ACTION_TOUCH ); llSay(0,"Click the attachment at your hand."); } } touch_start(integer number) { llSetClickAction(8); user = llDetectedKey(0); llRegionSayTo(user,0,"You have 15 minutes time."); llSetTimerEvent(900.0); } timer() { llRegionSayTo(user,0,"Your time is up."); llSetTimerEvent(0); llSetScriptState(llGetScriptName(),FALSE); } touch_end(integer num_detected) { caller = llDetectedKey(0); llListen(PUBLIC_CHANNEL, "", caller, ""); } listen(integer channel, string name, key id, string message) { message = llStringTrim(message, STRING_TRIM); if(message) { llSensor ("station "+message,"",PASSIVE | ACTIVE,96.0,PI); } } sensor(integer number) { vector det_pos = llDetectedPos(0)+<0.0,-5.0,-2.0>; llTeleportAgent(user,"", det_pos, <0.0,1.0,0.0>); } }
  15. Thank you very much for your help. I also thought this cannot be right. No idea how this happened. Nova Convair's suggestion seems to have solved the problem. I learned something new today. Thank you very much again!
  16. Hi! I have a script that causes an object to attach as a HUD: First the object containing the script is rezzed by a different object through touch_start. That rezzing object then sends the key of the avatar touching it over channel -10001 to the rezzed object containing the script. This now, in turn, on listening, attaches as a HUD to the touching avatar having that key. When I use the constant ATTACH_HUD_CENTER_1 as the attachment point in the script below, it produces the following error: When I use the number value (35) instead, the script works. Do you maybe have an idea why this is the case? Or is my script faulty? Thank you very much in advance. Here is the script: default { state_entry() { llListen(-10001,"",NULL_KEY,""); } listen(integer channel, string name, key id, string message) { key toucher = (key)message; llRequestPermissions(toucher , PERMISSION_ATTACH | PERMISSION_TRIGGER_ANIMATION); } run_time_permissions( integer vBitPermissions ) { if( vBitPermissions & PERMISSION_ATTACH | PERMISSION_TRIGGER_ANIMATION ) { llAttachToAvatarTemp( 35 ); llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0)); llSleep(15); llDetachFromAvatar( ); } else { llOwnerSay( "Permission to attach denied" ); } } on_rez(integer rez) { if(!llGetAttached()) { //reset the script if it's not attached. llResetScript(); } } }
  17. Hi! In the Firestorm Viewer, when I click "ignore" on a menu started by a script, the object remains blocked permanently. That is, when you click the object again, the dialog never shows up again, even after resetting the script. (This is not the case in the Singularity Viewer. In Singularity, re-clicking the object makes the dialog menu appear again.) I've looked through all settings but could not change this. Do you have any idea how to do this? Thank you very much in advance.
  18. Hi again! Sorry about the late reply, but I've only found time today to check again. It looks as though the Youtube settings combined with the prim texture media settings are sufficient. Here are some ideas I've got from somebody on OSGrid (djphil): In addition, I changed some of the settings in the "texture" tab of the prim (Singularity Viewer): Edit - select face - texture - Media - Choose - Customize - *uncheck* show control bar - Security - *check* Only allow Access to specified URL patterns - Add - *paste URL from 'General' tab* - OK This seems to work. No other links have been accessible so far and no scripts were necessary. If you have more ideas or still see some problems, feel free to comment. Thank you very much for your help, once again!
  19. In order to clear the screen after finishing the video, I tried LlClearLinkMedia, but after that the video could not be started again. Hence, the only work-around I could come up with is to auto-delete the entire Prim after some time and have it rezzed again through clicking a button. After rezzing, there is going to be a transparent screen in front of it to block users from clicking links on the webpage. I'm really not satisfied with this, so if anyone has a more elegant solution, please let me know. Thanks!
  20. Thank you for your quick reply. This is a good idea, however, the main problem is the links to the other videos on the web page, which can simply be clicked on, changing the video. Thank you for your idea, anyway.
  21. Hi! I would like to build a prim presenting a streaming Youtube video. This, as such, is easy. However, I would like to arrange the video in such a way that, once the video has started, the person watching it cannot click on the other video links in the browser, i.e. he/she only has the option to watch this one video, or no video at all. I've tried several methods, but they all have the same problem, which lies in the fact that the video must be started by clicking on the screen once, or otherwise you cannot watch at all. If you allow that, you automatically allow clicking on other videos, too. I cannot seem to find a work-around solution. The only hack solultion I could come up with is to rez an alpha screen-sized object in front of the screen after a few seconds, stopping the person watching from clicking the screen, but this is quite clumsy. Do you have any idea how this could be done? Here's the script I've tried, it works in general, but, with the problem described above: default { touch_start(integer num) { llSetLinkMedia( 0, 1, [PRIM_MEDIA_CURRENT_URL,"www.youtube.com/watch?v=...", PRIM_MEDIA_AUTO_PLAY,TRUE]); } } Thank you very much in advance.
  22. Thank you so much for your quick reply and explanations. I'll try that out. Thanks a lot, again.😊
  23. Thank you very much! Here's what I ended up with: integer length; list visitors =[]; default { state_entry() { llListen(0, "", NULL_KEY, ""); // listen for dialog answers (from multiple users) } listen(integer channel, string name, key id, string message) { if (message == "correct answer") { visitors=visitors+name; length = llGetListLength(visitors); integer i; for (i=0;i<length;++i) llSetText(llDumpList2String(visitors,","), <0,1,0>, 1); } } } There are two things I couldn't figure out: - The list above somehow double-records itself before you get the output, which means you do not only get the updated list, but the old list in addition. - llList2String didn't seem to work. Is it necessary to use llDumpList2String? Why can you not just use llList2String? Do you have an idea why this is the case? Thank you.
  24. Hi again! I have made a quiz. After solving the quiz, the players' names are supposed to be displayed in a floating text above the quiz prim. I can already display the name of one successful player (see script excerpt below). What I would like to do, though, is to display the names of more than one succesful player (let's say the last 5 succesful players' names). There is certainly a way to do this, but I just cannot figure it out. Any help will be appreciated. Thank you very much in advance. the script excerpt mentioned above: llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users) } listen(integer channel, string name, key id, string message) { if (message == correct_answer) { llSetText(name+" has solved the quiz!",<1.0, 1.0, 1.0>,1.0); }
  25. Hi again. I implemented Molly's and Roligloon's ideas. I also added more questions. This time it's a vocabulary quiz German - English and so it's partly German. I'm posting it below. Ideas of improvement, as always, are welcome. Thanks again. //by Mollymews, 10/16/2019 integer gameover; key player; integer counter; list quiz = [ // question answer picks (buttons) the pipe | is the delimiter "\n\nWas heißt auf Englisch \n\n\n'weil'", "because", "now|also|but|because", "\n\nWas heißt auf Englisch \n\n\n'obwohl'", "although", "although|now|but|because", "\n\nWas heißt auf Englisch \n\n\n'auch'", "also", "although|also|but|because", "\n\nWas heißt auf Englisch \n\n\n'aber'", "but", "although|now|but|because", "\n\nWas heißt auf Englisch \n\n\n'jetzt'", "now", "although|also|now|because", "\n\nWas heißt auf Englisch \n\n\n'heute'", "today", "yesterday|tomorrow|now|today", "\n\nWas heißt auf Englisch \n\n\n'morgen'", "tomorrow", "yesterday|tomorrow|now|today", "\n\nWas heißt auf Englisch \n\n\n'gestern'", "yesterday", "yesterday|tomorrow|now|today", "\n\nWas heißt auf Englisch \n\n\n'immer'", "always", "always|also|although|again", "\n\nWas heißt auf Englisch \n\n\n'wieder'", "again", "always|also|although|again" ]; integer CHANNEL = -202; integer index; integer count; string answer; default { state_entry() { count = llGetListLength(quiz) / 3; llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users) } touch_start(integer num) { key player = llDetectedKey(0); if (gameover) { gameover = FALSE; } if (llDetectedKey(0) == player) // ignore touches from people not the player { index = (index + 1 + (integer)llFrand(count)) % count * 3; // get the question string question = llList2String(quiz, index); answer = llList2String(quiz, index + 1); string picks = llList2String(quiz, index + 2); list buttons = llParseString2List(picks, ["|"], []); llSetTimerEvent(60.0); llDialog(llDetectedKey(0), question, buttons, CHANNEL); } } timer() { gameover = TRUE; llSay(0, "\n\nGame Over!\n\n\n"); llResetScript(); } listen(integer channel, string name, key id, string message) { if (message == answer) { llSay(0, "\n\nThat's correct, "+name+".\n\n\n"); index = (index + 1 + (integer)llFrand(count)) % count * 3; string question = llList2String(quiz, index); answer = llList2String(quiz, index + 1); string picks = llList2String(quiz, index + 2); list buttons = llParseString2List(picks, ["|"], []); counter ++; if(counter < 10) { llDialog(id, question, buttons, CHANNEL); } if(counter == 10) { gameover = TRUE; llDialog( id, "\n\nCongratulations! You win!", ["OK"], CHANNEL); //llDialog( id, "Congratulations! You won!\n\n\nUm das Menü zu schließen, klicke auf den Feldern auf 'ignore' ", buttons, CHANNEL); llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c ",1.0); llSay(0, "\n\nYou have won the quiz, " +name+ ".\n\n\n"); llSetText(name+" has solved the quiz!",<1.0, 1.0, 1.0>,1.0); llSleep(4.0); llSay(0, "\n\nDies ist deine Medaille, " +name+ ".\n\n Klicke auf 'behalten'\n\n\n"); llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT, 1), llGetPos() + <1.0,3.0,1.0>,ZERO_VECTOR,llEuler2Rot(<0,90,0> * DEG_TO_RAD)*llGetRot(),0); llSleep(2.0); llGiveInventory(id,llGetInventoryName(INVENTORY_OBJECT, 0)); llSleep(4.0); llSay(0, "\n\nHier ist der Basketball, " +name+ ".\n\n Klicke im Menü auf 'ja'\n\n\n"); llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT, 0), llGetPos() + <1.0,3.0,-1.0>,ZERO_VECTOR,llEuler2Rot(<0,0,0> * DEG_TO_RAD)*llGetRot(),0); llResetScript(); } } else { llSay(0, "\n\nYou lose, "+name+".\n\nStart again.\n\n\n"); llResetScript(); } } }
×
×
  • Create New...