Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Bounds Check Error - Can someone help me figure out where I am going wrong?

Hol Alexander
Registered User
Join date: 16 Mar 2005
Posts: 17
10-17-2005 07:47
I have read the Wikki description on this error and being pretty new to scripting of any kind this description was about as clear as mud to me. I am putting my script here in the hopes that someone can tell me what I messed up and help me understand this error.

the parent prim gives the go message and other prims in the linked set give the notplaced message.


integer gemNum;

NextGem()
{
gemNum = llCeil(llFrand(6));
if (gemNum == 1)
{
llSetTexture("DA Blue.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 1, "notplaced", NULL_KEY);
}
else if (gemNum == 2)
{
llSetTexture("DA Green.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 2, "notplaced", NULL_KEY);
}
else if (gemNum == 3)
{
llSetTexture("DA Red.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 3, "notplaced", NULL_KEY);
}
else if (gemNum == 4)
{
llSetTexture("DA Violet.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 4, "notplaced", NULL_KEY);
}
else if (gemNum == 5)
{
llSetTexture("DA Yellow.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 5, "notplaced", NULL_KEY);
}
else if (gemNum == 6)
{
llSetTexture("DA White.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 6, "notplaced", NULL_KEY);
}
}


default
{
state_entry()
{
state waiting;
}
}

state waiting
{
state_entry()
{
llSetTexture("DA Blank.jpg",0);
}

link_message(integer sender_num,integer num, string str, key id)
{
if ((str == "placed";) || (str == "go";))//if piece has been placed set to blank texture and tell board blank is showing
{
llSetTexture("DA Blank.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN,0,"blank",NULL_KEY);
state nextPiece;
}
}
}

state nextPiece
{
state_entry()
{
}

touch_start(integer total_number)
{
NextGem();
state waiting;
}
}
Sapphire Bombay
Avatar
Join date: 8 Oct 2003
Posts: 341
10-17-2005 08:05
CODE
integer gemNum;

NextGem()
{
gemNum = llCeil(llFrand(6));
if (gemNum == 1)
{
llSetTexture("DA Blue.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 1, "notplaced", NULL_KEY);
}
else if (gemNum == 2)
{
llSetTexture("DA Green.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 2, "notplaced", NULL_KEY);
}
else if (gemNum == 3)
{
llSetTexture("DA Red.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 3, "notplaced", NULL_KEY);
}
else if (gemNum == 4)
{
llSetTexture("DA Violet.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 4, "notplaced", NULL_KEY);
}
else if (gemNum == 5)
{
llSetTexture("DA Yellow.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 5, "notplaced", NULL_KEY);
}
else if (gemNum == 6)
{
llSetTexture("DA White.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 6, "notplaced", NULL_KEY);
}
}


default
{
state_entry()
{
state waiting;
}
}

state waiting
{
state_entry()
{
llSetTexture("DA Blank.jpg",0);
}

link_message(integer sender_num,integer num, string str, key id)
{
if ((str == "placed") || (str == "go"))//if piece has been placed set to blank texture and tell board blank is showing
{
llSetTexture("DA Blank.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN,0,"blank",NULL_KEY);
state nextPiece;
}
}
}

state nextPiece
{
state_entry()
{
}

touch_start(integer total_number)
{
NextGem();
state waiting;
}
}
_____________________
Avatar: A temporary manifestation or aspect of a continuing entity.
Moaku Mostel
Registered User
Join date: 24 Aug 2005
Posts: 12
10-17-2005 08:07
I don't know if this'd be much help but it DID happen to me once.
When I cleared the list at one point, it stopped giving me that error.

If you're using temporaty lists, be sure to clear those.
_____________________
I love hyenas. Yes I do. Especially the fat, soft, squishy, and silly ones.
Hol Alexander
Registered User
Join date: 16 Mar 2005
Posts: 17
10-17-2005 08:36
From: Moaku Mostel

When I cleared the list at one point, it stopped giving me that error.

If you're using temporaty lists, be sure to clear those.


this is the entire script. Unfortunately I am a real beginner. I don't think I called any lists but its possible I did without knowing. Am I using a list here I don't know about?
Hol Alexander
Registered User
Join date: 16 Mar 2005
Posts: 17
10-17-2005 08:37
Thank you Sapphire for doing that with my code.

ummm (sheepish grin) how did you do it? Put my script in a scrioll box that is
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
10-17-2005 09:49
From: Hol Alexander
Thank you Sapphire for doing that with my code.

ummm (sheepish grin) how did you do it? Put my script in a scrioll box that is


Put it either within [*CODE] and [/*CODE] or [*PHP] and [/*PHP] (remove the stars).
==Chris
_____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-17-2005 09:52
Bounds Check Error - is that what you get when you try to compile the script? Run it? What exactly is going wrong?
Hol Alexander
Registered User
Join date: 16 Mar 2005
Posts: 17
10-17-2005 11:01
The scipt compiles fine but when I run it I get.

Script Run Time Error
Bounds Check
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-17-2005 11:16
Hmm... I can't see anything wrong, but of course I might be missing something. Is it possible that the error is being generated in a script in one of the child prims?
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
10-17-2005 12:37
From: Hol Alexander
The scipt compiles fine but when I run it I get.

Script Run Time Error
Bounds Check


"When you run it", as in right after you compile, or when it receives a link_message while in state waiting?
==Chris
_____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
10-17-2005 12:43
From: Sapphire Bombay
CODE
integer gemNum;
NextGem()
{
gemNum = llCeil(llFrand(6));
if (gemNum == 1)
{
llSetTexture("DA Blue.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 1, "notplaced", NULL_KEY);
}
else if (gemNum == 2)
{
llSetTexture("DA Green.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 2, "notplaced", NULL_KEY);
}
else if (gemNum == 3)
{
llSetTexture("DA Red.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 3, "notplaced", NULL_KEY);
}
else if (gemNum == 4)
{
llSetTexture("DA Violet.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 4, "notplaced", NULL_KEY);
}
else if (gemNum == 5)
{
llSetTexture("DA Yellow.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 5, "notplaced", NULL_KEY);
}
else if (gemNum == 6)
{
llSetTexture("DA White.jpg",0);
llMessageLinked(LINK_ALL_CHILDREN, 6, "notplaced", NULL_KEY);
}
}


Also, you can simplify that function:
CODE

NextGem()
{
list gemTextures = [
"DA Blue.jpg", "DA Green.jpg", "DA Red.jpg",
"DA Violet.jpg", "DA Yellow.jpg", "DA White.jpg"
];
integer gemNum = llCeil(llFrand(6));
llSetTexture(llList2String(gemTextures, gemNum - 1), 0);
llMessageLinked(LINK_ALL_CHILDREN, gemNum, "notplaced", NULL_KEY);
}


Does that help?
_____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
Hol Alexander
Registered User
Join date: 16 Mar 2005
Posts: 17
10-18-2005 06:23
CODE

NextGem()
{
list gemTextures = [
"DA Blue.jpg", "DA Green.jpg", "DA Red.jpg",
"DA Violet.jpg", "DA Yellow.jpg", "DA White.jpg"
];
integer gemNum = llCeil(llFrand(6));
llSetTexture(llList2String(gemTextures, gemNum - 1), 0);
llMessageLinked(LINK_ALL_CHILDREN, gemNum, "notplaced", NULL_KEY);
}


Lists are one of those things I am still wrapping my brains around. Would you mind letting me know if my reasoning on this is right?

In this we have 6 elements in the list which will be numbered 0-5 in order.
integer gemNum = llCeil(llFrand(6)) gets me a random number from 1-6.
in the SetTexture it has to be gemNum-1 because we need 0-5 not 1-6 but this does NOT change gemNum it is still 1-6 so it should in the llMessageLinked still give me a number 1-6

I know a complete beginner like me has to be frustrating to all of you. Unfortunately the only way I can really get a handle on much of this is to dissect it line by line and try to trace what is happening at each point and what is getting passed where. In particular what is passed where is fouling me up more than anything. I got rid of the out of Bounds error by removing a return in another script. Unfortunately now neither script is behaving as I wanted them to LOL. Back to painstaking line by line tracing for me. I will beat this thing into submission yet! I can't thank all of you enough. :)

one more small question
would I be smarter to reference the textures by key rather than name? Would this give an advantage in speed, memory use or lag?
RyeDin Meiji
Reluctant Entrepeneur
Join date: 15 Mar 2005
Posts: 124
10-18-2005 06:48
From: Hol Alexander

I know a complete beginner like me has to be frustrating to all of you. Unfortunately the only way I can really get a handle on much of this is to dissect it line by line and try to trace what is happening at each point and what is getting passed where....

...Back to painstaking line by line tracing for me. I will beat this thing into submission yet! I can't thank all of you enough. :)

one more small question
would I be smarter to reference the textures by key rather than name? Would this give an advantage in speed, memory use or lag?


Painstaking line by line tracing? Why, I think we have a programmer on our hands. Hol, that's just the attitude needed to learn how to script.

About referencing the textures by key... the only real advantage you get from using the UUID of the textures is you don't have to drop the textures themselves into the object. So it makes your script a little more portable. Speed is the same because it is still loading the same texture from the same asset server. Memory... well it should be negligable but I would actually think using the UUID uses more memory just because there are more characters being used in your script. I would not worry about that though.
_____________________
if (!you)
{
who();
}
Hol Alexander
Registered User
Join date: 16 Mar 2005
Posts: 17
10-18-2005 07:15
From: RyeDin Meiji
About referencing the textures by key... the only real advantage you get from using the UUID of the textures is you don't have to drop the textures themselves into the object.


ok this makes sense. This is actually a game I am trying to do. I will have 9 or 16 (need to get it working before I decide which number is better from a game play standpoint) spaces on the games board + 1 spinner (the code we have been talking about is the spinner). So potentially 17 prims each containing 7 textures. It just seemed to me that loading the contents of these prims would create quite a drain somewhere. Thats alot of stuff. LOL

**edit Lack of sleep and bad spelling seem to go together ;)
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-18-2005 08:26
From: someone
I got rid of the out of Bounds error by removing a return in another script.


I thought it might be something in a different script.

From: someone
Unfortunately now neither script is behaving as I wanted them to LOL.


I can understand not wanting to post all your scripts here if this is something you're developing, but it's difficult to help you in something like this without seeing the code :)

Here's a texture trick that I unfortunately learnt after I did my first game. You can make one big texture that's basically a 'patchwork quilt' of all your individual textures. Then you can use the texture scale and offset functions to move this patchwork texture around so only one of the smaller sub-textures shows on the prim. The advantage to this is that the client only has to load one texture one time, after that all the sub-textures are available. This can help if all your 17 prims need to cycle between the same set of gem textures. So to get blue, instead of loading the blue texture, you move the big texture to the position where blue would show up on the prim's face. It'll take some trial and error to get it to work right, but it could make the gameplay smoother.
Hol Alexander
Registered User
Join date: 16 Mar 2005
Posts: 17
10-18-2005 10:19
From: Ziggy Puff

I can understand not wanting to post all your scripts here if this is something you're developing, but it's difficult to help you in something like this without seeing the code :)


I thank you. It isn't an unwillingness to post it as much as it is an unwillingness to admit defeat before I have tried everything I can think of on my own to fix it first. Stubborn Man aren't I ;)

From: someone
Here's a texture trick that I unfortunately learnt after I did my first game. You can make one big texture that's basically a 'patchwork quilt' of all your individual textures. Then you can use the texture scale and offset functions to move this patchwork texture around so only one of the smaller sub-textures shows on the prim. The advantage to this is that the client only has to load one texture one time, after that all the sub-textures are available. This can help if all your 17 prims need to cycle between the same set of gem textures. So to get blue, instead of loading the blue texture, you move the big texture to the position where blue would show up on the prim's face. It'll take some trial and error to get it to work right, but it could make the gameplay smoother.


This sounds like a great idea! I have filed it away to be tackled when the basic gameplay is working. This tired old brain seems to only be able to go after 1 small problem at a time. Right now when I click the spinner it is not changing to a random gem so that I can place it. I know it has to be something small because I had this working yesterday before I switched it from Listens to Linked Messages. Lesson learned the hard way from that ... keep copies of old code in case you need to compare after a change. ;)

***edit***
the spinner is working now. I changed nothing but the same code that didn't work this morning is working now. (shrugs) go figure LOL

time to move on to the placement blocks on the board :)
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
10-19-2005 11:13
Hol - good luck, and good on ya' - you definitely have the right attitude :)
I dunno what your gems look like, but just in case they all look the same except for their colour - did you know that you could upload one (white) texture, and use llSetColor to "tint" the gems.
Hol Alexander
Registered User
Join date: 16 Mar 2005
Posts: 17
10-19-2005 15:14
From: Ben Bacon
Hol - good luck, and good on ya' - you definitely have the right attitude :)
I dunno what your gems look like, but just in case they all look the same except for their colour - did you know that you could upload one (white) texture, and use llSetColor to "tint" the gems.


Thank you so much I will definitely consider this option. RIght now i am just using place holder graphics the final ones have not been done yet. but this sounds like an interesting thing to try :)


I do have a question for you gurus

It seems to me it used to be that in the script window if I hovered my mouse over something built into LSL it gave me a hover text with info on the correct format for the thing. Suddenly this isn't happening. Anyone know where to turn this back on?
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
10-20-2005 03:36
View menu>hover tips.

I think it's Cntl-Shift-T, as opposed to Cntl-Alt-T for highlight transparent.
Hol Alexander
Registered User
Join date: 16 Mar 2005
Posts: 17
10-20-2005 05:42
From: Eloise Pasteur
View menu>hover tips.

I think it's Cntl-Shift-T, as opposed to Cntl-Alt-T for highlight transparent.



Thank you for this unfortunately, this got them back for general hovering but not in the script window or on the Map. LOL

Any other ideas to try?