Jump to content
  • 0
Sign in to follow this  
Void Singer

What's wrong with this script?

Question

I already know, this is just a test post to check various methods of posting code.
But feel free to speak up if you know the answer

integer  Range     = 40;
float    Arc       = 2 * PI;
float    Frequency = 10.0;
list     Previous;
integer  Search;
string   Target;

default{
     state_entry(){
          llSensorRepeat( "", "", AGENT, Range, Arc, Frequency );
     }
     
     sensor( integer Sensed ){
          do{
               Target = llDetectedKey( --Sensed );
               Search = llListFindList( Previous, Target );
               if (Search = -1){
                    Previous = Target + llList2List( Previous, 0, 78 ); llDialog( Target, "Message ", [], -42 );
               }
          }while (Sensed)
     }
}

Share this post


Link to post
Share on other sites

Recommended Posts

  • 0

Using ...

if (-1 = Search){

... at least spots the error.

PS: How do I generate these indented script boxes without pasting them?

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Ricky.Yates wrote:

PS: How do I generate these indented script boxes without pasting them?

LL turned on source code formatting so we would scream less! It is the >> button in the edit tool bar.  It is still the most easy if you paste code from a text editor but Shift+Enter can give a line break instead of a new paragraph if you want to enter code inline.

P.S. Void I am pleasantly surprised to see you here! I hope this place can work for you!

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Ricky gets a cookie, but not the prize, it should indeed be "==" instead of "=" there... good eye , but there's still more wrong here

 

ETA: @Cherise:

actually I've been here awhile in disguise, compiling a list of all the things that really need fixing... to make it actually useful... now I'm in "me" mode for reasons of documentation. PS you deserve a cookie to as spotting the code highlighting being enabled greatly ups the tolerability of this place.

Share this post


Link to post
Share on other sites
  • 0

Hey, I wanted to leave something for the others, too. But since you ask ...

llDetectedKey( --Sensed );

... is looking pretty fishy, too. Does this work when 'Sensed' has a value of -1?

Share this post


Link to post
Share on other sites
  • 0

Actually that part is valid, although some software writers would cry bad form depending on their style guide.


you can also get away with

llDetectedKey( Sensed -= Sensed );

or even

llDetectedKey( Sensed = Sensed - 1 );

but I say why waste compile space =)

although to give it a subtle error I could have gone with

llDetectedKey( Sensed-- );

 

part of the experiment of this post is to see how much attention it recieves, how quickly, and at what level of expertise. it's not perfect though, since some will obviously ignore since I said I know...

Share this post


Link to post
Share on other sites
  • 0

Void.Singer wrote:

part of the experiment of this post is to see how much attention it recieves, how quickly, and at what level of expertise. it's not perfect though, since some will obviously ignore since I said I know...

I only found this by accident because it happened to be at the top of the recent posts. I wouldn't have seen it otherwise. But I'm very glad you're here.

Share this post


Link to post
Share on other sites
  • 0

heh, guess I shouldn't be so nice as to keep posting and putting it back on top... but I have another related REAL question... at what point does a question get marked "possibly answered" ? is that in other peoples reply feedback, a matter of having awarded points for helpful, or is it just a matter of number of replies?

 

ETA:
well I know that posting back with not answered definitely changes it back... does any post to it push it into the "possibly" category? that seems kind stupid if you ask me...

Share this post


Link to post
Share on other sites
  • 0

If you post a question it goes to the 'not answered' column... if someone/anyone replies it goes to 'possibly answered'... if you mark it as correct it goes to 'recently answered'... and i believe you always have the option of putting it back in the 'not answered' column as you so desire based on the replies you get.

Yes, anyone replying puts it to being 'possibly answered', it's up to you if that is indeed the case and even as 'possibly answered' it doesn't stop others from continuing to reply if they have further to add.  Same with answered, they can get replied to forever too - barring the thread being locked by a moderator.

Share this post


Link to post
Share on other sites
  • 0

1TBS to rule them all =)


and in this tiny viewing space? it's an absolute blessing compared to the alternatives...


so nobody? really? :: sigh ::

Share this post


Link to post
Share on other sites
  • 0

no... don't nuke it, post the solution if you've got it... there is a point to all this rigamarole...


as it stands, if I make the corrections posted here the script won't even compile... think of the poor non-compiling script!!!

Share this post


Link to post
Share on other sites
  • 0
part of the experiment of this post is to see how much attention it recieves, how quickly, and at what level of expertise. it's not perfect though, since some will obviously ignore since I said I know...

/me nuked it because I saw this and have also wondered about such things.

Share this post


Link to post
Share on other sites
  • 0

but you're here, and it's only fair... if it'd been someone else would you have answered it? of course you would have. besides I'm betting no one gets a few of the non-obvious errors.


Share this post


Link to post
Share on other sites
  • 0

integer  Range     = 40;

float    Arc       = 2 * PI;

float    Frequency = 10.0;

list     Previous;

key      Target;

 

default

{     state_entry()

     {          llSensorRepeat( "", "", AGENT, Range, Arc, Frequency );     }     sensor( integer Sensed )

     {          do

          {

               Target = llDetectedKey( --Sensed );

               if (llListFindList(Previous, Target) == -1){

                    Previous += ;

                    llDialog( Target, "Message ", [], -42 );               }          }while (Sensed)     }}

 

That's what I found to change.  I havn't tried it in a compiler so no clue if it'd work But it looks fine to me.

Personally I would do the sensor event differently to begin with but that's just a matter of style as was the change I made of removing the need for the "Search" integer.

Share this post


Link to post
Share on other sites
  • 0

not bad, still doesn't compile though =)

the type change on "Target" is one of the subtle (but not harmful) errors...

I still count two compile errors


Share this post


Link to post
Share on other sites
  • 0

um... i could be WAY off here, since i'm not in-world or at a compiler to test, but here's two things i see:

1. range should be a float, not integer

2. the button list cannot be empty in the llDialog call

Please let me know if i'm wrong

Share this post


Link to post
Share on other sites
  • 0

check on the float (it won't prevent compile, compiler inserts a cast int the sensor repeat event)

though actually you can use an empty button list, and the viewer will insert an "OK" button.

still doesn't compile...

"oh won't someone please help newbie me fix this script?"


Share this post


Link to post
Share on other sites
  • 0

Ok, I found something else, that I'm certain causes a failure, because i keep forgetting this myself LOL

Hope this is PART of the answer:P

Search = llListFindList( Previous, Target );

shouldn't this be:

Search = llListFindList( Previous, );

Share this post


Link to post
Share on other sites
  • 0

yup that's part of it, still not compiling though... oh woe is me...=)

ETA:
I really need to remember to ad that horizontal rule at the bottom...

ETA2:
still not compiling Johan... what on earth could it be....


Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×