Reply
Honored Resident
Soca McConnell
Posts: 4
0 Kudos

particles menu script help please! :(

Hi all:

First of all scuse my english if it is a bit limited.

Im trying to script a particle menu that would have a 1st script (main script) where is the menu that sends the orders by llMessageLinked() to the children this way :

 1ST script:


 
   
integer CHANNEL =67754;
key OWNER;
list MENU_MAIN = ["Blink RATE","Blink SIZE"];

list MENU_BLINK_RATE=["LOW","2","3","4","5","6","7","8","HIGH","MAIN MENU","<< back"];

list MENU_BLINK_SIZE=["#1","#2","#3","#4","#5","MAIN MENU"];


integer rateLOW=1;
integer rate2=2;
integer rate3=3;
integer rate4=4;
integer rate5=5;
integer rate6=6;
integer rate7=7;
integer rate8=8;
integer rateHIGH=9;

string size1="<1,1,0>";
string size2="<2,2,0>";
string size3="<3,3,0>";
string size4="<4,4,0>";
string size5="<5,5,0>";


default


   

state_entry()
 
   {
       OWNER= llGetOwner();
    
  llListen(0, "", OWNER, "");
      
   } 
 
listen(integer CHANNEL, string name, key id, string message)
 
   {
 
     if (message == "x")
      llDialog(OWNER, "MENU", MENU_MAIN, CHANNEL);
    //enter menu by typing "x" on public chat for testing
  {
if (llListFindList(MENU_MAIN+MENU_BLINK_RATE+MENU_BLINK_SIZE, [message]) != -1)
  
  
  if(message == "Blink RATE")  
  llDialog(OWNER, "BLINK RATE MENU", MENU_BLINK_RATE, CHANNEL);
   
    {
  
   if (message=="LOW")
     
      {
         llMessageLinked(LINK_SET,0, "9","");
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
      }
     if (message=="2")
      {
        llMessageLinked(LINK_SET,0, "8", NULL_KEY);
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
      }
     if (message=="3")
      {
        llMessageLinked(LINK_SET,0, "7","");
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
      }
     if (message=="4")
      {
        llMessageLinked(LINK_SET, 0, "6", "");
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
      }
     if (message=="5")
      {
        llMessageLinked(LINK_SET, 0, "5", "");
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
      }
     if (message=="6")
      {
        llMessageLinked(LINK_SET,0, "4", "");
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
      }
     if (message=="7")
      {
        llMessageLinked(LINK_SET,0, "3", "");
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
      }
     if (message=="8")
      {
        llMessageLinked(LINK_SET, 0, "2", "");
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
      }
     if (message=="HIGH")
      {
        llMessageLinked(LINK_SET, 0, "1", "");
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
      }

    }  
      
 
  {
   
    if(message == "Blink SIZE")
    llDialog(OWNER, "BLINK SIZE MENU", MENU_BLINK_SIZE, CHANNEL); 
      {
     if (message=="1#")
      {
        llMessageLinked(LINK_SET, 0, "1#",(string )size1);
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_SIZE, CHANNEL);
      }
     if (message=="2#")
      {
        llMessageLinked(LINK_SET, 0, "2#", (string )size2);
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_SIZE, CHANNEL);
      }
     if (message=="3#")
      {
        llMessageLinked(LINK_SET, 0, "3#", (string )size3);
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_SIZE, CHANNEL);
      }
     if (message=="4#")
      {
        llMessageLinked(LINK_SET, 0, "4#", (string )size4);
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_SIZE, CHANNEL);
      }
     if (message=="5#")
      {
        llMessageLinked(LINK_SET, 0, "5#", (string )size5);
        llDialog(OWNER, "BLINK MENU", MENU_BLINK_SIZE, CHANNEL);
      }
     }
if(message == "<< back") llDialog(OWNER, "BLINK MENU",MENU_MAIN, CHANNEL);

   }
  }
 }
}
and would like that the receiver script could have the particles script  and if the main script sends for example a string with the wanted rate of the particles could change it,i did it but the problem is when i want to combine it and if I send the order to emit  the particles every 3 seconds and now you want to change the start size of the particles from <1.0,1.0,0.0> to <5.0,5.0,0.0> but still keep the rate ordered before (every 3 seconds)

I got like a mounth investigating and trying to get the solution,looking the LSL wiki,asking people,viewing examples,but I am learning scripting by myself with the help of the lsl and im already stucked and don't know how could I come to get the fix for it.

hope any good soul could help me with this headbroke for me.

thanks all

 





Darkie Minotaur
Posts: 1,605
Topics: 8
Kudos: 152
Blog Posts: 0
Registered: ‎02-23-2010

Re: particles menu script help please! :(

[ Edited ]

Reply to Soca McConnell - view message

I hope I correctly understood your problem.

What you have to do is to get the sent information to a variable you use in the particle system. I made you a short example - the particle parameters may not make sense - I just wanted to show you the principle.

First, there is a shortend version of the sender script

integer CHANNEL =67754;
key OWNER;
list MENU_MAIN = ["Blink RATE","Blink SIZE"];

list MENU_BLINK_RATE=["LOW","2","3","4","5","6","7","8","HIGH","MAIN MENU","<< back"];

list MENU_BLINK_SIZE=["#1","#2","#3","#4","#5","MAIN MENU"];


integer rateLOW=1;
integer rate2=2;
integer rate3=3;
integer rate4=4;
integer rate5=5;
integer rate6=6;
integer rate7=7;
integer rate8=8;
integer rateHIGH=9;

string size1="<1,1,0>";
string size2="<2,2,0>";
string size3="<3,3,0>";
string size4="<4,4,0>";
string size5="<5,5,0>";


default

{ 


	state_entry()

	{
		OWNER= llGetOwner();

		llListen(0, "", OWNER, "");

	}

	listen(integer CHANNEL, string name, key id, string message) {
		if (message == "MAIN MENU" || message == "<< back") {
			llDialog(OWNER, "MENU", MENU_MAIN, CHANNEL);
			//enter menu by typing "x" on public chat for testing
		}
		//if (llListFindList(MENU_MAIN+MENU_BLINK_RATE+MENU_BLINK_SIZE, [message]) != -1)
		else if (message == "Blink RATE") {
			llDialog(OWNER, "BLINK RATE MENU", MENU_BLINK_RATE, CHANNEL);
		} else if ((message == "Blink SIZE") {
			llDialog(OWNER, "BLINK RATE MENU", MENU_BLINK_SIZE, CHANNEL);
		}else if (llListFindList(MENU_BLINK_RATE, [message] > -1) {
				if(message = "LOW") {
					llMessageLinked(LINK_SET,0, "rate9", NULL_KEY);
					llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
				} else if(message = "HIGH") {
						llMessageLinked(LINK_SET,0, "rate1", NULL_KEY);
					llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
				} else {
						llMessageLinked(LINK_SET,0, "rate" + message, NULL_KEY);
					llDialog(OWNER, "BLINK MENU", MENU_BLINK_RATE, CHANNEL);
				}


		} else if (llListFindList(MENU_BLINK_SIZE, [message] > -1) {
			llMessageLinked(LINK_SET, 0, "size" + messsage,"";
			llDialog(OWNER, "BLINK MENU", MENU_BLINK_SIZE, CHANNEL);
		}

	}
}

  And then an example of the receiver version:

float gfBurstRate = 1;
integer giBurstCount = 1;

default
{
	state_entry()
	{
		
	}

	link_message(integer sender_number, integer number, string message, key id)
	{
		if (llGetSubString(message, 0, 3) == "rate") {
			gfBurstRate = (float)llGetSubString(message, 4, -1);	
		} else if (llGetSubString(message, 0, 4) == "size#") {
			giBurstCount = gfBurstRate = (integer)llGetSubString(message, 5, -1);	
		}
		list particles  = [
			PSYS_PART_FLAGS,
			PSYS_PART_WIND_MASK | PSYS_PART_EMISSIVE_MASK,
			PSYS_SRC_PATTERN,
			PSYS_SRC_PATTERN_EXPLODE, 
			PSYS_PART_START_COLOR, <1.0, 0.0, 0.0>,
			PSYS_SRC_BURST_RATE, gfBurstRate,
			PSYS_SRC_BURST_PART_COUNT, giBurstCount
			];
		llParticleSystem(particles);
	}
}

 There may be some typos in it as welll - but I hope it's good enough to demonstrate the idea.

Kaluura Boa
Posts: 177
Registered: ‎03-09-2009

Re: particles menu script help please! :(

Reply to Soca McConnell - view message

Lot of things to say... Sorry if I lack of diplomacy sometimes but my first reaction when I saw your post was: What a mess!

First, you must use the special function of the editor to insert a script (The clipboard with a kind of square C.) or else things get messy.

Second, keep your curly brackets under control. Always use them even when not mandatory... but don't add superfluous ones. Any other approach is meant to lose yourself, the compiler or everybody else.

That was for the form. Next, the script.

Don't use LINK_SET unless that's what you really need. It targets all the scripts in the object unnecessarily.

You may want to look at the new function llLinkParticleSystem() that would eliminate all the link messages. So you can store your particles parameters in a list, change what you want and re-apply.

I didn't check if your script even compiles but I can already say it doesn't work. At least, the dialogs don't. They use a channel to which the script doesn't listen.

Next, when you start copying the same line over and over. It's time to think of a user function.

Any way... I made an agnostic script which deals only with the dialogs and the rate/size values. It's up to you to do what you want with them.



integer CHANNEL = -67754;
string SPC = " ";

list RATE_BUTTONS = ["LOW", "2", "3", "4", "5", "6", "7", "8", "HIGH"];
list SIZE_BUTTONS = ["1", "2", "3", "4"]; // Max particle size == 4m

string MAIN_TITLE = "MAIN MENU";
string SIZE_TITLE = "Blink SIZE";
string RATE_TITLE = "Blink RATE";

integer MAIN = 0;
integer SIZE = 1;
integer RATE = 2;

integer CurrentDialog;

key OwnerKey;

list uuReorderButtons(list buttons)
{
    integer i = (llGetListLength(buttons) % 3);
    // First, make sure we have only full lines of 3 buttons
    if (i)
    {
        i = 3 - i;
        for (; i > 0; --i)
        {
            buttons += SPC;
        }
    }
    // Next, invert the order of the lines
    i = llGetListLength(buttons);
    if (i > 3)
    {
        integer k = i / 3;
        i -= 3;
        for (; k > 0; --k)
        {
            buttons = llList2List(buttons, i, i +2) + llList2List(buttons, 0, i - 1);
        }
    }
    llOwnerSay(llDumpList2String(buttons, "|"));
    return buttons;
}

uuMainDialog()
{
    CurrentDialog = MAIN;
    llDialog(OwnerKey, MAIN_TITLE, [SIZE_TITLE, RATE_TITLE], CHANNEL);
}

uuSizeDialog()
{
    CurrentDialog = SIZE;
    llDialog(OwnerKey, SIZE_TITLE, [MAIN_TITLE, SPC, SPC] + uuReorderButtons(SIZE_BUTTONS), CHANNEL);
}

uuRateDialog()
{
    CurrentDialog = RATE;
    llDialog(OwnerKey, RATE_TITLE, [MAIN_TITLE, SPC, SPC] + uuReorderButtons(RATE_BUTTONS), CHANNEL);
}

uuLastDialog()
{
    if (CurrentDialog == MAIN) { uuMainDialog(); }
    else if (CurrentDialog == SIZE) { uuSizeDialog(); }
    else if (CurrentDialog == RATE) { uuRateDialog(); }
}

default
{ 
    state_entry()
    {
        OwnerKey = llGetOwner();
        llListen(0, "", OwnerKey, "x"); // Filter, plz!
        llListen(CHANNEL, "", OwnerKey, "");
    } 
 
    listen(integer channel, string name, key id, string msg)
    {
        if (channel == 0)
        {
            uuMainDialog();
            return; // Skip the rest!
        }
        if (channel == CHANNEL)
        {
            if (msg == SPC)
            {
                uuLastDialog(); //Re-open current dialog.
                return; // Skip the rest!
            }
            //
            // Navigation in the dialogs
            //
            if (msg == MAIN_TITLE)
            {
                uuMainDialog();
                return; // Skip the rest!
            }
            else if (msg == SIZE_TITLE)
            {
                uuSizeDialog();
                return; // Skip the rest!
            }
            else if (msg == RATE_TITLE)
            {
                uuRateDialog();
                return; // Skip the rest!
            }
            //
            // Real content of the dialogs
            //
            if (CurrentDialog == SIZE)
            {
                integer k = llListFindList(SIZE_BUTTONS, [msg]);
                if (k != -1)
                {
                    ++k;
                    vector size = <k, k, 0>;
                    // Do what you want from here...
                    llOwnerSay("Selected size: " + (string)size);
                }
            }
            else if (CurrentDialog == RATE)
            {
                integer k = llListFindList(RATE_BUTTONS, [msg]);
                if (k != -1)
                {
                    integer rate = 9 - k;
                    // Do what you want from here...
                    llOwnerSay("Selected rate: " + (string)rate);
                }
            }
        }
    }
}

 It compiles and works... but if it was my script, I'd re-open the main dialog after a selection and I'd add a close button.

 

Honored Resident
Soca McConnell
Posts: 4
0 Kudos

Re: particles menu script help please! :(

Reply to Kaluura Boa - view message

Thank you very much Darkie Minotaurand Kaluura Boa:

Darkie your scripts was so very very helpful,ive learned some new stuff about scripting also i fixed my "big" problem with the help of it ,thank you very much.

Kaluura yours was so helpful too about knowing things very interesting too, thank you very much.