Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Function returns FALSE when it shouldn't

Keiki Lemieux
I make HUDDLES
Join date: 8 Jul 2005
Posts: 1,490
11-10-2005 07:19
CODE
integer check_name( string this_name )
{
integer test = llListFindList( names, [this_name] );
if ( test == -1 ) { return( FALSE );}
return(TRUE);
}


So I'm using this little function to test if a particular name is found on a list of avatar names in my script. The problem in my tests is that it seems to always be returning FALSE. Does anyone see a problem in the function itself? Am I misunderstanding llListFindList?
_____________________
imakehuddles.com/wordpress/
Keiki Lemieux
I make HUDDLES
Join date: 8 Jul 2005
Posts: 1,490
11-10-2005 07:33
woot! found it. problem was in what I was passing to the function. :)
_____________________
imakehuddles.com/wordpress/
Daemon Speculaas
Gate Keeper
Join date: 2 Oct 2005
Posts: 14
Related Topic
01-19-2006 21:02
im haveing troble with a large prject im haveing the problem relats to typecasting im told so ill ask you all who are talking about it:


im trying to make a script say something like money = 40

then have a second script pick up that info by listening for money = and then adding in the missing value by detecting the first word (money =)

so....

script one: "money = 40"

script two: (listens for "money =" )
hears *money =* 40
adds 40 into integer money (defined by *money =*)
_____________________
Time dose not pass for the imortals.....
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
01-19-2006 22:11
this btw sheds off the money= part of the string, and spits out the integer alone, just add integer += output (instead of llSay)

CODE

string input = "money=40";

default
{
touch_start(integer total_number)
{
if (llGetSubString(input,0,4) == "money")
{
integer output = llList2Integer(llParseString2List(input,["="],[]),1);
llSay(0,(string)output);
}
}
}
}
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
01-20-2006 05:05
alternately...
CODE
if ( llGetSubString(input, 0, 5) == "money=" )
{
integer output = (integer)llGetSubString(input, 6, -1);
...
...
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
01-20-2006 07:14
Glad to see you found the problem.

I'd suggest tidying up the code a bit, you've got a bunch of unnecessary tests and variables, and your code is equivalent to:

CODE
integer check_name(string this_name)
{
return llListFindList(names, [this_name]) != -1;
}