Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

I have a question

Alberrt Steptoe
Second Life Resident
Join date: 31 Oct 2004
Posts: 19
04-13-2009 14:59
Hello. I have split a prim face up by 16 wide by 14 high.

If I click the prim it will tell me where I have clicked with a number from 1 to 224.

What I want to do is is have each number represent a position in a list. Now. I will be hard coding the list in to the script and then that will limit the amount of entries per list.

So what I will be doing is creating a list per column of 14 entries.

What I need is some math done here to work out if the number I have been given is either columm 1, 2, 3, etc so I know which list to read from.

If anyone can help it would be appreciated.

Thank you.

- Alberrt
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-13-2009 15:57
single list with 224 total items

generalized as:
row = (integer)(13.9999998 * y_percentage);
column =(integer)(15.9999998 * x_percentage);
index = row * 14 + column;

assuming a top left origin with positive signs in the prim face field. subtract y-percentage from 1.0 if it's bottom left origin (or just reorder your cell count from the bottom up)

you can stack all the list data into a single list in state entry, and if the data is created there only the large list will affect memory afterwards.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Alberrt Steptoe
Second Life Resident
Join date: 31 Oct 2004
Posts: 19
04-13-2009 16:11
Thank you Void, You have helped tons.

- Alberrt