linden scripting language - How can I read a random line from a notecard in LSL? -


I have a notecard on each line with a different word, and I can be able to select randomly from the lines Want to How can I do this?

First of all, as you say, you need a note card. For this example, I I am using a "color" name with the following content:

  red blue green yellow orange purple  

with that notecard,

  // This script will chat every time by holding the random line from "colors" and each time it touches, a random string with the following script card Will read and chat by reading. Prime touch is the string card = "color"; Key linecontact; Key linux; Integer linemax; Integer random_integer (integer minimum, integer maximum) {return min + (integer) (llFrand (max - min + 1)); } Default {state_entry () {// Get the number of notecord lines linecountid = llGetNumberOfNotecardLines (card); } Touch_start (integer_number_fix) {lineid = llGetNotecardLine (card, random_desktop (0, linemax)); } Dataset (Key ID, String Data) {if (id == linecountid) {linemax = (Integer) data - 1; } And if (id == linid) {llSay (0, data); }}}  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -