Jump to content

syntax


dustty
 Share

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

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

Recommended Posts

What is wrong with this sc ript?

 

 

default
{
    state_entry()
    {
        llSensorRepeat ("", NULL_KEY, SCRIPTED, RadarRange, PI, ScanRate);
    }

    sensor(integer total)
    {
        integer i;
        for(i=0;i<total;++i)
        {
           
            list z=llListen(-456733,"", NULL_KEY, "");
            list stats=llParseString2List(llList2String(z,2),[":"],[":"]);
           
            if(llList2String(stats,1)==[key])
            {

            {
                 llSay(0,"cat");
    }


Link to comment
Share on other sites

Hm? Dunno if it does what you want, but, it has a chance of compiling. (o.O)

 

float RadarRange = //insert range constant here;
float ScanRate = //insert rate constant here;
key ExpectedKey = //insert key constant here;

default
{
    state_entry()
    {
        llSensorRepeat("",NULL_KEY,SCRIPTED,RadarRange,PI,ScanRate);
    }
   
    sensor(integer detected)
    {
        integer loop_iterator = 0;
        for(;loop_iterator<detected;loop_iterator++)
        {
            if(llGetDetectedKey(loop_iterator) == ExpectedKey )
            {
                llSay(0,"cat");
            }
        }
    }
}


Link to comment
Share on other sites

ok in this i get a syntax error on the list z= line

 

default
{

    state_entry() {
        llListen(-456733, NULL_KEY ,"",  "");
    }

   listen(integer channel, string name, key id, string message)
{   list z=(string);
     list stats=llParseString2List(llList2String(z,2),[":"],[":"]);
    if(llList2String(stats,1)=="Settings info")
{
      llSay(0,"cat");
       }

   }
}

Link to comment
Share on other sites

That's because list z =(string) doesn't mean anything.  My guess is that you meant to grab the message and create a list with it as the sole element.  If so , then what you really meant was list z = [message];   I don't understand what you are trying to do with it after it's in list z, though.  It looks as if you expect the message to consist of a set of values separated by colons.  If so, you don't need this list z business at all.  You already almost have it in the next line .........

list stats = llParseString2List(message,[":"],[]);

Then you can go ahead and ask if (llList2String(stats,1) == "Settings info")....blah blah blah....

Incidentally, you know that stats,1 is the second element in the list, right?  stats,0 is the first one.

Link to comment
Share on other sites

It might be easier if you explain what you want the script to do, because it's a bit hard to figure that out from the code as it is.

You're scanning for scripted objects -- pets, maybe? -- and it looks as if, when you find one, you're trying to find out something about it.    But I can't really get much further and, to my mind, it's better if you explain what it's supposed to do rather than us take guesses.

Link to comment
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...