Jump to content

Error report - need help to understand


Carbon Philter
 Share

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

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

Recommended Posts

Hi all. Still on the learning curve and need more assistance.

I'm trying to create a bird rezzer to generate a specified number of temp birds. I've got it functioning with a set number using a timer but wanted to add a touch triggered dialog to provide the option of choosing a particular number of birds at any one time. I added in what I thought was correct and now keep getting a fail error reporting 'Bounds Check Error'.

Can you good people explain where I've gone off the rails, please.

Thanks in anticipation

Carbon

Script follows:

integer randchan;
integer DIACHANNEL;
list Numberlist = ["1", "2", "3", "4", "5", "6"];
float Birdno;
key owner = llGetOwner;

birdrez()
    {
    llRezObject("Humbirdsculpt12Atemp", llGetPos() + <0, 0, 0>, ZERO_VECTOR, ZERO_ROTATION, randchan);
    }

default
{
    state_entry()
    {
        DIACHANNEL = (integer)llFrand(-50000.0);
        llListen(DIACHANNEL, "", owner, "");
        randchan = (integer)llFrand(-50000.0);
        llSay(randchan, (string)llGetKey());
        birdrez();
        llSetTimerEvent(Birdno);
        llOwnerSay ("Birdno is " + (string)Birdno);
    }
   
     touch_start(integer total_number)
     {
         llDialog(llDetectedKey(0), "How many birds?", Numberlist, DIACHANNEL);
         }
       
         listen(integer channel, string name, key id, string message)
        {
            if (message == "1")
            Birdno == 60;
            else if (message == "2")
            Birdno == 30;
            else if (message == "3")
            Birdno == 20;
            else if (message == "4")
            Birdno == 15;
            else if (message == "5")
            Birdno == 12;
            else if (message == "6")
            Birdno == 10;
        }
       
        timer()
        {
            birdrez();
            }

}


Link to comment
Share on other sites

Specifially, a bounds check error sems to be an all-purpose, "out of cheese" error message ("You" in this passage seems to be Babbage Linden):

[8:51]  Phantom Ninetails: Hard to decide what affected version to set..[8:51]  Cago Hax: what does mean 'bounds check error' anyway ?[8:52]  You: it's used whenever the LSL2 VM gets confused[8:52]  SLezzer_LSL2 [script:Menu_manager]: Script run-time error[8:52]  SLezzer_LSL2 [script:Menu_manager]: Bounds Check Error[8:52]  You: often it means that a register has started pointing outside a script[8:52]  Cago Hax: hum...[8:52]  You: but it is used as a general error when the VM state stops making sense

I most usually see it after I've tried to save a mono script and failed, because it won't compile and then forgot to compile it in Mono again after I've got it fixed.

Link to comment
Share on other sites

OK, update..........

Got synatx error as I just commented above so deleted that definition and just put the llGetOwner() directly into the llListen line.

Script now compiles and I get no further error reports but the Birdno variable is constantly being reported as 0 rather than the value I select in the dialog.

Is there something being missed or out of sequence?

Link to comment
Share on other sites

You can only call functions inside a state, so you would need to start something like this:

integer randchan;integer DIACHANNEL;list Numberlist = ["1", "2", "3", "4", "5", "6"];float Birdno;key owner;birdrez()    {    llRezObject("Humbirdsculpt12Atemp", llGetPos() + <0, 0, 0>, ZERO_VECTOR, ZERO_ROTATION, randchan);    }default{    state_entry()    {        owner = llGetOwner();        DIACHANNEL = (integer)llFrand(-50000.0);        llListen(DIACHANNEL, "", owner, "");        randchan = (integer)llFrand(-50000.0);        llSay(randchan, (string)llGetKey());        birdrez();        llSetTimerEvent(Birdno);        llOwnerSay ("Birdno is " + (string)Birdno);    }//and so on...}

 

Make sure you do something to reset the value of "owner" when the item is transferred, though.

Link to comment
Share on other sites

First of all, your listen() handler is using the comparison operator ("==") where you want assignment ("=").  So you want:

if (message == "1")    Birdno = 60;

 etc.

Also, you're starting out in state_entry with a zero-valued Birdno, and using that to clear the timer.  That's fine (albeit unnecessary) but as far as I can see, nothing ever sets the timer again.  I think you want to do that at the bottom of your listen() handler.

 

Link to comment
Share on other sites

Many thanks all. It's working - after a fashion.......... The dialog does change the number of birds but it waits until the end of the previous cycle before taking effect.

Not sure where exactly to put the on-rez resetscript command to ensure the owner change after transfer - still haven't quite got my head round determining the correct order for separate functions or how to sequence them (if that makes sense). Anyhow, I'll continue with my learning by trial and a lot of error.  :)

Two more queries..........

Qie, can you please briefly explain the zero-value thing. If I declare a variable such as Birdno in State_entry, does that always enter as zero unless I assign a value as part of the declaration?

If I want to turn the rezzer invisible once it's been placed where required, I am thinking of making it an off/on option as part of the dialog after selecting the number of birds. Does that sound sensible or would anyone have any alternative suggestions/recommendations?

Thanks again, people.

Link to comment
Share on other sites


... haven't quite got my head round determining the correct order for separate functions or how to sequence them...


Within a state (e.g., default), the sequence of event handlers (such as state_entry(), listen(), timer(), etc.) doesn't matter... just put them in whatever order you think will be easiest to find them when examining the code. 

You do need to define functions and variables before using them, so you'll generally have a section of global variables, followed by functions, followed by the state(s) and the event handlers they contain.

About initialization: Yes, declared variables that aren't explicitly initialized are set to a default value; 0 in the case of an integer, 0.0 for floats, "" for strings, [] for lists, etc.  (I think we're not supposed to know whether that default value is set at the time of declaration or when first referenced.)

How the on/off toggle should work probably depends on how often people will be adjusting the number of birds from that menu.  It may be difficult for some users to find the rezzer once it's been turned invisible, so one might even imagine listening for a chat command on some channel, as do many poseballs (a la "/1show" and "/1hide").  Obviously nicer to avoid those listens, though, if your users won't get lost.  Anyway, yeah, it seems fine to have either "hide" or "show" (whichever makes sense at the moment the menu is shown) be one of the menu options.  But that's "on/off" only in terms of showing and hiding the rezzer; you may also want 0 to be one of the bird count options, or somehow otherwise let the user turn off the rezzing altogether.

 

Link to comment
Share on other sites

you can confirm that it's set at initialization by running looped comparisons of initializing a variable then reading it's value, as opposed to initializing a variable and reading an existing value from a different variable in similar scope.

MONO has the potential to only place a default value at first read, but the speed vs size tradeoff argues heavily against it.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4134 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...