Jump to content

can someone help me with this script?


Maddox Deluxe
 Share

You are about to reply to a thread that has been inactive for 3658 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

// if you run this script with this list, it all works. but when you comment this list out and use make_test_list, it will not work.

list Themes = ["Fantasy Tiger","8f304cf2-7120-24e2-d1f1-db6b31bd6f6","false","Fantasy Car","517b2288-67ca-b14c-1de2-c5f5fdf5291f","false"];

// list Themes; // uncomment to use for make test list

// if you try and make the list this way, it does not find it. But the list format is the same.


Make_Test_list()
{
Themes = [];
string Menu_Button_Name = "Fantasy Tiger";
string Back_Drop_UUID ="8f304cf2-7120-24e2-d1f1-db6b31bd6f6";
string Floor_Drop_UUID = "false";
Themes = [Menu_Button_Name+","+Back_Drop_UUID+","+Floor_Drop_UUID];
}

integer IsButton(string name)
{
integer index = llListFindList(Themes, [name]);
if (~index)
{
list Found = llList2List(Themes, index, index + 2);

string i = llList2String(Found,0);
if (i == name)
llOwnerSay("Test Pass: "+(string)name);
// llOwnerSay("Debug Dump Test: "+llDumpList2String(Themes, ","));
return TRUE;
}
llOwnerSay("Not Found: "+(string)name);
// llOwnerSay("Debug Dump Test: "+llDumpList2String(Themes, ","));
return
FALSE;
}

FindButton(string name)
{
integer index = llListFindList(Themes, [name]);
if (~index)
{
list Found = llList2List(Themes, index, index + 2);

string BN = llList2String(Found,0);
string BD = llList2String(Found,1);
string FD = llList2String(Found,2);

llOwnerSay("Debug Button Name: "+(string)BN);
llOwnerSay("Debug Backdrop: "+(string)BD);
llOwnerSay("Debug floordrop: "+(string)FD);
llOwnerSay("Debug Dump Found Test: "+llDumpList2String(Found, ","));
 }
}
default
{
state_entry()
{

}
touch_start(integer num_detected)
{
// Make_Test_list();
//uncomment for make test list
// string Test_Search_String = "Fantasy Tiger";

string Test_Search_String = "Fantasy Car";
if(IsButton(Test_Search_String)==TRUE)
{
FindButton(Test_Search_String);
  }
 }
}

// Script default run test works and this is the output read out.

// output: Test Pass: Fantasy Car
// output: Debug Button Name: Fantasy Car
// output: Debug Backdrop: 517b2288-67ca-b14c-1de2-c5f5fdf5291f
// output: Debug floordrop: false
// output: Debug Dump Found Test: Fantasy Car,517b2288-67ca-b14c-1de2-c5f5fdf5291f,false

Link to comment
Share on other sites

When you put values into a variable in a user defined function, there are two ways you can pass them to the area of your script that called it: (1) You can place the values in a global function -- in this case a list -- or (2) you can assign a variable type to the UDF itself and then pass the values with a return statement.   If you choose option #1, as you have, then you have to call the global variable in your script to read the stored value.  You didn't do that.  You simply called Make_Test_list, which loaded the values.  So, you have to refer to Themes in your touch_start event. Either that, or define

list Make_Test_list(){    //  Load values into Themes, a non-global list    return Themes;}

 ETA, to be explicit --- And then in your touch_start event you call

list my_new_list = Make_Test_list();

and then work with my_new_list

 

Link to comment
Share on other sites

The big issue is in your Make_Test_list() function.  You are adding ONE string that is a concatenation of all three elements.

 

Try this instead for it:

Make_Test_list(){	Themes = [];	string Menu_Button_Name = "Fantasy Tiger";	string Back_Drop_UUID ="8f304cf2-7120-24e2-d1f1-db6b31bd6f6";	string Floor_Drop_UUID = "false";	Themes = [Menu_Button_Name,Back_Drop_UUID,Floor_Drop_UUID];}

 Then it will match up with the format it is expecting.

 

Link to comment
Share on other sites

but it is the same as this

list Themes = ["Fantasy Tiger","8f304cf2-7120-24e2-d1f1-db6b31bd6f6","false","Fantasy Car","517b2288-67ca-b14c-1de2-c5f5fdf5291f","false"];

 

the find list will match 3 elements to the search string, i even try what you said by making a return and moving the list into the new one. still does not work.

 

each find = Fantasy Tiger","8f304cf2-7120-24e2-d1f1-db6b31bd6f6","false.. if you run the test script and look at it, you will see it returns all 3 elements base on the button name search. so it is like every 3 elements.

 

Script test run return this as the output.

// output: Test Pass: Fantasy Car // our search string
// output: Debug Button Name: Fantasy Car
// output: Debug Backdrop: 517b2288-67ca-b14c-1de2-c5f5fdf5291f
// output: Debug floordrop: false
// output: Debug Dump Found Test: Fantasy Car,517b2288-67ca-b14c-1de2-c5f5fdf5291f,false

Link to comment
Share on other sites

You was right, all i had to do was pass the list into a new one, so all the menu buttons from the note cards now works, was just more easy to parse, but was not hard to switch the list for each thing. I been out of scripting in sl for so long, but things are coming back to me now. Thanks for the help again. I use to be master at list scripting, now i'm feeling little dumb since i got back at programming in sl.. lol

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3658 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...