But if you're that skilled, you might as well store the text on a web service and get the text snippet count and text snippets from there. Be warned that changing the contents of the notecard and saving, stores the new content under a different UUID. If you know the UUID of the notecard, you can read from it as long as it's transferable (and not deleted). The notecard you are reading from does not necessarily have to be in the same prim. NcReqId = llGetNotecardLine(ncName, (integer)llFrand(numOfLines)) LlSay(PUBLIC_CHANNEL, "~!~ Unconfigured, check notecard ~!~") PUBLIC_CHANNEL has the integer value 0 NcNumOfLinesReqId = llGetNumberOfNotecardLines(ncName) If (change & (CHANGED_OWNER | CHANGED_INVENTORY)) this script will grab and chat a random line from the. With that notecard present, the following script will read and chat a random line from the card each time the prim is touched. For this example, Im using one named 'colors' with the following contents: red blue green yellow orange purple. CHANGED_INVENTORY has the integer value 0x01 (1) First, as you mention, you need a notecard. CHANGED_OWNER has the integer value 0x80 (128) reset script to make sure you have the current number of lines Put the name of your notecard as in the prim's inventory here. in this example from a notecard named "colors" SCRIPT within the same prim: // this script reads from a notecard which is named whatever you set in init a user settable facelight with a HUD control script. If you create a notecard, then you can easily edit the notecard and save changes. Attach it to any HUD position and click it to control the face light. ![]() NOTECARD named colors or whatever you set in the script: blue This goes into a prim you can touch to get a menu. Following up on this second issue, why do you ask a question to get a random notecard line number and give an answer that provides a random within a range? And what will you do if the notecard changes? Change the code and the notecard? This seems to be redundant to me. ![]() The second issue with your code above is that you are not checking against CHANGED_INVENTORY and I'm not quite sure why you'd not do that. Integer random = llFrand((integer)(max/2)) + llFrand((integer)(max/2)) If you want to make sure you have a more random number as there are known issues with the randomness of llFrand you could do (without checking whether the number is even or odd): integer max It's not clear why you do such unnecessary math with adding one and then substracting it again later in the answer you give yourself above.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |