LLREZOBJECT woes!
|
|
DogPatrol Adder
Registered User
Join date: 2 Mar 2009
Posts: 19
|
04-30-2009 08:23
Hey guys.
I basically have a rather complex section of code. Now I need to keep trck of the keys of the newly generated objects - to do this I simply send the original object which rezzes the new object a message with its key on a specific channel.
Problem is, this seems to take a long time and I need quicker access to the key because my next piece of code relies on the key being inserted into this list of keys, and it doesnt exist because its not yet been added.
How do I get quicker access to the key when rezzing an object...?
Thanks
Andy
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
04-30-2009 08:51
From: DogPatrol Adder Hey guys. I basically have a rather complex section of code. Now I need to keep trck of the keys of the newly generated objects - to do this I simply send the original object which rezzes the new object a message with its key on a specific channel. Problem is, this seems to take a long time and I need quicker access to the key because my next piece of code relies on the key being inserted into this list of keys, and it doesnt exist because its not yet been added. How do I get quicker access to the key when rezzing an object...? Thanks Andy it's returned by the object_rez(key id) event; http://wiki.secondlife.com/wiki/Object_rez.
|
|
DogPatrol Adder
Registered User
Join date: 2 Mar 2009
Posts: 19
|
04-30-2009 08:56
...oh really? so in my object which is calling llrezObject - i could just put:
object_rez(key id) { //do stuff }
and it would receive the ids of the newly created objects automatically?
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
04-30-2009 09:32
Yep.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
DogPatrol Adder
Registered User
Join date: 2 Mar 2009
Posts: 19
|
04-30-2009 09:38
argh ok that kind of helps - thanks very much!
so If i had code like this:
llSay(0,"Size of list before is:"+(string)llGetListLength(tempList)); llRezObject("Begin", (vector)llList2String(params,0) - <0, 0, 0.5>, ZERO_VECTOR, ZERO_ROTATION,val); llSay(0,"Size of list after is:"+(string)llGetListLength(tempList));
and the rez event adds the id to the tempList, how can I ensure it has added it before i progress to that last llSay print statement!?
Andy
|
|
Prajna Vella
Registered User
Join date: 27 May 2008
Posts: 59
|
04-30-2009 09:59
You could put the second llSay() in the object_rez() event handler.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
04-30-2009 10:00
From: DogPatrol Adder argh ok that kind of helps - thanks very much!
so If i had code like this:
llSay(0,"Size of list before is:"+(string)llGetListLength(tempList)); llRezObject("Begin", (vector)llList2String(params,0) - <0, 0, 0.5>, ZERO_VECTOR, ZERO_ROTATION,val); llSay(0,"Size of list after is:"+(string)llGetListLength(tempList));
and the rez event adds the id to the tempList, how can I ensure it has added it before i progress to that last llSay print statement!?
Andy no, you have to exit your current event before the object rez event will fire... so set a timeout after the rez, and move the rest of your code to the object rez event, then use the timeout to catch objects that the sim hasn't rezzed for whatever reason
_____________________
| | . "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... | - 
|
|
DogPatrol Adder
Registered User
Join date: 2 Mar 2009
Posts: 19
|
04-30-2009 10:58
But thats going to completely destroy the code flow : string EvaluatePostFix(list postFixOutput){ list deadBoxes = []; list evaluationStack = []; list temp = []; integer i; integer boxesKilled = 0; lock = 1; for(i=0;i < llGetListLength(postFixOutput); i++){ llSleep(1); string val = llList2String(postFixOutput,i); deadBoxes = deadBoxes + llList2String(keysOfLastBlocks,i); if(~llListFindList(operators, (list)val)) { integer one = (integer)llList2String(evaluationStack,llGetListLength(evaluationStack)-2); integer two = (integer)llList2String(evaluationStack,llGetListLength(evaluationStack)-1); integer result = 0; if(val == "-")result = one - two; if(val == "+")result = one + two; if(val == "/")result = one / two; if(val == "*")result = one * two; llSay(0,"Popped "+(string)one +","+(string)two+" off eval and operator = "+val+" and result back onto eval is : "+(string)result); temp = evaluationStack; evaluationStack = []; integer p; for(p=0;p < llGetListLength(temp)-2;p++){ evaluationStack = evaluationStack + llList2String(temp,p); } evaluationStack = evaluationStack + (string)result; llSay(888,(string)(llList2String(keysOfLastBlocks,i)+"lala")); //delete last two and operator output the result as a new box integer k; key lastVal; tempList = []; for(k = 0;k< llGetListLength(deadBoxes);k++){ llSay(6666,llList2String(deadBoxes,k)); tempList +=""; boxesKilled++; } //fill in gaps for the items now deleted and add integer val = result + 100; integer item = (integer)llGetListLength(keysOfLastBlocks); item = item - boxesKilled-1; list params= llGetObjectDetails(llList2String(keysOfLastBlocks,item),[OBJECT_POS] ); old = llGetListLength(keysOfLastBlocks); llSay(0,"Size of list before is:"+(string)llGetListLength(tempList)); llRezObject("Begin", (vector)llList2String(params,0) - <0, 0, 0.5>, ZERO_VECTOR, ZERO_ROTATION,val); llSay(0,"Size of list after is:"+(string)llGetListLength(tempList)); integer s; llSay(0,"OTHER MESSAGE BEFORE THIS?!"); for(s=llGetListLength(tempList);s< llGetListLength(keysOfLastBlocks); s++){ tempList+=llList2String(keysOfLastBlocks,s); } keysOfLastBlocks = tempList; llSay(0,"Boxes killed"+(string)boxesKilled); integer l; for(k = boxesKilled;k < llGetListLength(keysOfLastBlocks);k++){ llSleep(0.5); for(l=0;l < boxesKilled;l++){ llSleep(0.2); llSay(999,llList2String(keysOfLastBlocks,k)); } } } else if( (integer)val >= 0){ evaluationStack = evaluationStack + val; llSay(888,llList2String(keysOfLastBlocks,i)); } } list params= llGetObjectDetails(llList2String(keysOfLastBlocks,0),[OBJECT_POS] ); integer item = (integer)llList2String(evaluationStack,0); item = item + 100; llRezObject("Begin", llGetPos() - <0, 0, 0.5>, ZERO_VECTOR, ZERO_ROTATION,item); return ownerSayStrings(evaluationStack); }
How would you go about doing it , as im sure you can see the event needs to be fired before the next lines after llrezobject are run.
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
04-30-2009 15:17
You cannot have event handlers inside a function  So you have to rethink your code and incorporate the way LSL works with events
_____________________
From Studio Dora
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
04-30-2009 16:13
yup.
yer gonna have to break it up.
welcome to to event driven programing =P
_____________________
| | . "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... | - 
|