Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

CHANGED_REGION breaks under load?

RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
05-20-2008 16:16
I made a hud a sort of a GPS system to keep the giant snails on the route of the giant snail cross country race. Thing It seems to work fine when I use it. Never had it break. but when I give it to 40 others that are racing a lot of them stop working. Its usually a close race but once it doesn't work on a sim crossing it doesn't work the rest of the race. I made it shout out loud so hopefully if any snail had a working GPS anail near him/her would get the message too. There's 42 sims and 8 places where you need to know which way to turn.

Previous race I had 8 volunteers wearing huge arrows on there heads stand at intersections pointing the way, problem with that was they some times didn't rez in time
for the snails to see them, Thought this script would fix that.

Hard to play test something it takes 40 avatars to break. Anyone know what I'm doing wrong or is it a bug I should report?

script one
________________________________________________________

vector spot_when_small = <-0.01010, -1.27718, 0.85957>;
vector size_when_small = <0.02988, 0.33823, 0.21235>;

vector spot_when_big = <-0.01010, -0.67450, 0.59380>;
vector size_when_big = <0.09668, 1.09447, 0.58755>;

default
{
state_entry()
{
llMessageLinked(LINK_SET,0,"small","";);
llSetTimerEvent(0);
}

touch_start(integer total_number)
{
llSetPos(spot_when_small);
llSetScale(size_when_small);
llSetAlpha(1,ALL_SIDES);
state big;
}
changed(integer change)
{
if (change & CHANGED_REGION) //note that it's & and not &&... it's bitwise!
{
llMessageLinked(LINK_SET,0,"small","";);
llSetAlpha(0.5,ALL_SIDES);
}
}


}
_______________________________________________________________
script 2
this is the script that is receiving the IM'S
_______________________________________________________

list sim_corners = [<263168.00000, 256512.00000, 0.00000>,//huron
<263168.00000, 256256.00000, 0.00000>,//Abitibi
<262912.00000, 256256.00000, 0.00000>,//Superior
<262656.00000, 256256.00000, 0.00000>,//Ontario
<262400.00000, 256256.00000, 0.00000>,//Brauer
<262400.00000, 256000.00000, 0.00000>,//Clunn
<262144.00000, 256000.00000, 0.00000>,//Yelas
<262144.00000, 255744.00000, 0.00000>,//Butler
<261888.00000, 256000.00000, 0.00000>,//Munck
<261888.00000, 255744.00000, 0.00000>,// Chong
<261632.00000, 255744.00000, 0.00000>,// McFee
<261376.00000, 255744.00000, 0.00000>,// Whinlatter
<261120.00000, 255744.00000, 0.00000>, // Macclaine
<261120.00000, 256000.00000, 0.00000>,// Hardknott
<260864.00000, 256000.00000, 0.00000>, // Mowry
<260608.00000, 256000.00000, 0.00000>, // Selby
<260608.00000, 256256.00000, 0.00000>, // Mare
<260352.00000, 256000.00000, 0.00000>, // Brazos
<260352.00000, 255744.00000, 0.00000>,// Garrison
<260096.00000, 255744.00000, 0.00000>,// Pierce
<259840.00000, 255744.00000, 0.00000>,// Suisun
<259840.00000, 255488.00000, 0.00000>,// Buckler
<259840.00000, 255232.00000, 0.00000>,//Bishop
<259840.00000, 254976.00000, 0.00000>,// Arcata
<259584.00000, 254976.00000, 0.00000>,// Samoa
<259328.00000, 254976.00000, 0.00000>,// Quentin
<259328.00000, 254720.00000, 0.00000>,// Clarksburg
<259072.00000, 254976.00000, 0.00000>,// Hookton
<259072.00000, 254720.00000, 0.00000>,//Westport
<258816.00000, 254720.00000, 0.00000>,// Shelter
<258560.00000, 254720.00000, 0.00000>,// Crescent
<258560.00000, 254976.00000, 0.00000>,// Kaminari
<258560.00000, 255232.00000, 0.00000>,// Yamato
<258560.00000, 255488.00000, 0.00000>,// Gama
<258304.00000, 255488.00000, 0.00000>,// Amida
<258048.00000, 255488.00000, 0.00000>,// Gualala
<258048.00000, 255232.00000, 0.00000>,// Limantour
<257792.00000, 255232.00000, 0.00000>,// Montara
<257536.00000, 255232.00000, 0.00000>,// Hooper
<257280.00000, 255232.00000, 0.00000>,// Bolinas
<257024.00000, 255232.00000, 0.00000>,// Bodega
<256768.00000, 255232.00000, 0.00000>,// Davenport
<256512.00000, 255232.00000, 0.00000>];// Noyo
list small_map_spots = [<0.01820, 0.16340, 0.02570>,//huron
<0.01840, 0.16190, 0.01230>,//Abitibi
<0.01870, 0.15390, 0.01230>,//Superior
<0.01930, 0.13780, 0.01230>,//Ontario
<0.01960, 0.12840, 0.01100>,//Brauer
<-0.00440, 0.12730, 0.00000>,//Clunn
<-0.00400, 0.11660, -0.00130>,//yelas
<-0.00400, 0.11660, -0.01340>,//Butler
<-0.00350, 0.10320, -0.00130>,//Munck
<-0.00350, 0.10320, -0.01470>,//Chong
<-0.00310, 0.09250, -0.01470>,// McFee
<-0.00280, 0.08310, -0.01740>,// Whinlatter
<-0.00240, 0.07100, -0.01740>,// Macclaine
<-0.00240, 0.07100, -0.00670>,// Hardknott
<-0.00190, 0.05760, -0.00670>, // Mowry
<-0.00160, 0.04820, -0.00670>,// Selby
<-0.00160, 0.04820, 0.00670>,// Mare
<-0.00120, 0.03750, -0.00670>,// Brazos
<-0.00120, 0.03750, -0.01880>,// Garrison
<-0.00080, 0.02540, -0.01880>,// Pierce
<-0.00040, 0.01470, -0.01880>,// Suisun
<-0.00040, 0.01470, -0.03350>,// Buckler
<-0.00040, 0.01470, -0.04560>,//Bishop
<-0.00040, 0.01470, -0.05770>,// Arcata
<0.00000, 0.00400, -0.05770>,// Samoa
<0.00040, -0.00810, -0.05770>,// Quentin
<0.00040, -0.00810, -0.07110>,// Clarksburg
<0.00080, -0.01880, -0.06040>,// Hookton
<0.00080, -0.01880, -0.07250>,//Westport
<0.00120, -0.03090, -0.07250>,// Shelter
<0.00170, -0.04430, -0.07250>,// Crescent
<0.00170, -0.04430, -0.05910>,// Kaminari
<0.00170, -0.04430, -0.04570>,// Yamato
<0.00170, -0.04430, -0.03360>,// Gama
<0.00200, -0.05230, -0.03090>,// Amida
<0.00250, -0.06570, -0.03090>,// Gualala
<0.00250, -0.06570, -0.04570>,// Limantour
<0.00290, -0.07640, -0.04570>,// Montara
<0.00330, -0.08850, -0.04570>,// Hooper
<0.00370, -0.09920, -0.04570>,// Bolinas
<0.00410, -0.10990, -0.04570>,// Bodega
<0.00450, -0.12060, -0.04570>,// Davenport
<0.00490, -0.13270, -0.04570>];// Noyo
list big_map_spots = [<0.00570, 0.52420, 0.06600>,//huron
<0.00570, 0.52420, 0.03240>,//Abitibi
<0.00720, 0.48240, 0.03790>,//Superior
<0.00840, 0.44750, 0.03250>,//Ontario
<0.00980, 0.40860, 0.03120>,//Brauer
<0.00980, 0.40860, -0.00640>,//Clunn
<0.01100, 0.37370, -0.00640>,//Yelas
<0.01100, 0.37370, -0.04400>,//Butler
<-0.01170, 0.33520, -0.00810>,//Munck
<-0.01170, 0.33520, -0.04430>,//Chong
<-0.01040, 0.29770, -0.04430>,// McFee
<-0.00920, 0.26280, -0.04430>,// Whinlatter
<-0.00790, 0.22660, -0.04430>, // Macclaine
<-0.00790, 0.22660, -0.00670>,// Hardknott
<-0.00660, 0.19040, -0.00670>,// Mowry
<-0.00530, 0.15420, -0.00670>,// Selby
<-0.00530, 0.15420, 0.02820>, // Mare
<-0.00400, 0.11800, -0.00670>,// Brazos
<-0.00400, 0.11800, -0.04430>,// Garrison
<-0.00270, 0.08050, -0.04430>,// Pierce
<-0.00140, 0.04430, -0.04430>,// Suisun
<-0.00140, 0.04430, -0.08320>,// Buckler
<-0.00140, 0.04430, -0.11940>,//Bishop
<-0.00140, 0.04430, -0.15700>,// Arcata
<-0.00020, 0.00940, -0.15700>,// Samoa
<0.00100, -0.02550, -0.15700>,// Quentin
<0.00100, -0.02550, -0.19320>,// Clarksburg
<0.00240, -0.06570, -0.15700>,// Hookton
<0.00240, -0.06570, -0.19460>,//Westport
<0.00360, -0.09920, -0.19460>,// Shelter
<0.00490, -0.13680, -0.19460>,// Crescent
<0.00490, -0.13680, -0.15570>,// Kaminari
<0.00500, -0.13950, -0.11810>,// Yamato
<0.00500, -0.13950, -0.08320>,// Gama
<0.00640, -0.17840, -0.08320>,// Amida
<0.00770, -0.21460, -0.08320>,// Gualala
<0.00770, -0.21460, -0.11940>,// Limantour
<0.00900, -0.25220, -0.11940>,// Montara
<0.01020, -0.28570, -0.11940>,// Hooper
<0.01140, -0.32060, -0.11940>,// Bolinas
<0.01280, -0.35950, -0.11940>,// Bodega
<0.01420, -0.39840, -0.11940>,// Davenport
<0.01550, -0.43460, -0.11940>];// Noyo
list directions = ["Huron Your at the starting line ",

"Abitibi",
"Superior",
"Ontario Go straight through \n at intersection",
"Brauer",
"Clunn",
"Yelas",
"Butler",
"Munck",
"Chong",
"McFee",
"Whinlatter",
"Macclaine",
"Hardknott",
"Mowry turn left toward west \n at intesection",
"Selby",
"Mare wave at the folks \n in the Elbow room bar",
"Brazos",
"Garrison",
"Pierce",
"Suisun",
"Buckler",
"Bishop Go straight toward the south west \n at intersection",
"Arcata",
"Samoa",
"Quentin",
"Clarksburg turn right toward west \n at intersection",
"Hookton",
"Westport",
"Shelter",
"Crescent",
"Kaminari",
"Yamato go straight at intersection",
"Gama make a left toward the west \n at intersection",
"Amida",
"Gualala",
"Limantour",
"Montara go straight continue west \n at intersection",
"Hooper",
"Bolinas",
"Bodega vear right toward the North West \n at the Y intersection",
"Davenport",
"Noyo"
];

default
{
state_entry()
{
llSay(0,(string)llGetLocalPos());
}

link_message(integer lnum,integer num,string mes,key id)
{
if(mes == "big";)
{
integer total_sims =llGetListLength(sim_corners);
// integer i;
// while(i < total_sims)
// {
list test = [llGetRegionCorner()];
integer here = llListFindList(sim_corners,test);
if(here != -1)
{
//llOwnerSay("found big";);
llSetText(llList2String(directions,here),<0,1,0>,1);
llShout(0,llList2String(directions,here));
string text = llList2String(directions,here);
list words = llParseString2List(text, [" "], []);
string place = llToLower(llList2String(words, 0));
llSetObjectName(place);
llMessageLinked(LINK_ROOT,0,place,"";);
llSetPos(llList2Vector(small_map_spots,here));
llSetScale(<0.5,0.01,0.01>;);

}
else
{
llOwnerSay("your off the route";);
}
// i = i +1;
// }
}
if(mes == "small";)
{
integer total_sims =llGetListLength(sim_corners);
// integer i = 0;
// while(i < total_sims)
// {
list test = [llGetRegionCorner()];
integer here = llListFindList(sim_corners,test);
// llOwnerSay((string)here);
if(here != -1)
{
string text = llList2String(directions,here);
list words = llParseString2List(text, [" "], []);
string place = llToLower(llList2String(words, 0));
llMessageLinked(LINK_ROOT,0,place,"";);
llSetObjectName(place);
// llOwnerSay("found small"+(string)llList2Vector(big_map_spots,here));
llSetText(llList2String(directions,here),<0,1,0>,1);
llShout(0,llList2String(directions,here));
llSetPos(llList2Vector(big_map_spots,here));
llSetScale(<0.5,0.03,0.03>;);

}
else
{
llShout(0,"your off the route turn around go back you missed a corner";);
}
// i = i +1;
// }
}
}


touch(integer pop)
{
llSay(0,(string)llGetLocalPos());
}
}
_____________________
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
05-21-2008 01:28
Just a thought on an alternative approch.

If you can rez an object, anywhere at all, in each Sim of the route, you could try using beacons.
Have each beacon llRegionSay(RaceChannel,"region instructions";); on a regular basis and the HUD listens on the RaceChannel.
My theory being that by the nature of llRegionSay the message should change as soon as the new Sim in entered by the contestant.
It will simplify your HUD code at the expense of several beacon prims, but at least that way you do not have to hard code the course information into each HUD.
If one of the Sims has nowhere at all that you can rez a beacon, you could have a course marshal have a beacon as an attachment and hold their position till the race is over.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
05-21-2008 13:45
I doubt you are doing anything that could break CHANGED_REGION, I think you should bug report it on JIRA.

I really like Very Keynes suggestion, it's a good stop-gap solution.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
05-21-2008 14:35
From: Very Keynes
It will simplify your HUD code at the expense of several beacon prims, but at least that way you do not have to hard code the course information into each HUD.
If one of the Sims has nowhere at all that you can rez a beacon, you could have a course marshal have a beacon as an attachment and hold their position till the race is over.

Hmm. Yeah. Neat idea. Or an (external) database associating region name with route data....
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
05-21-2008 15:25
From: Hewee Zetkin
Hmm. Yeah. Neat idea. Or an (external) database associating region name with route data....


Not sure that would work in this instance as the problem appears to be in detecting the region change. In effect the current HUD holds all the information you would be storing on the Database.