synchronization with llMovetoTarget

Paul Fishwick fishwick at cise.ufl.edu
Sat Mar 3 13:28:07 PST 2007


Because Section A, the intermediate two lines after
A, and Section B are all inside of 2 nested loops. So, I
do not want the loops to progress either, which is what
would happen if I tried your suggestion. I need the
computation to halt right after llMoveToTarget until
I am ready for it to continue. If the sim was not
asynchronously event-based, this synchronization
would not be necessary, but given the parallel nature
of certain operations such as llMoveToTarget,
synchronization becomes critical.

Consider that you are building a "grid scanner" that ranges over X
and Y for example (0 to 255 in X and Y). Inside of
at_target, you would want to stop at each X,Y location
but once stopped, you want to execute an llSensor and
do some additional operations...

I tried in one test, putting a "while (!flag) {};" right
after llMoveToTarget(..) and then use "flag" as
a global semaphore, but that didn't work either.

Getting back to llSleep, this is a poor solution since it
is not guaranteed to function correctly and depends on
client/server load. However, I have seen this used frequently
in certain scripts. It should not be necessary.


-paul

Frans wrote:
> Hi,
>
> Why don't you put the Section B code in at the end of the at_targer event?
>
> On 3/3/07, *Paul Fishwick* < fishwick at cise.ufl.edu 
> <mailto:fishwick at cise.ufl.edu>> wrote:
>
>     Thanks to Dzonatas for the buoyancy/setpos trick
>     to solve the earlier movetotarget issue. So, now I
>     can successfully and predictably move to a specific
>     target on queue. However, now the next step is to
>     have a grid of targets (as if one is building a scanner,
>     which I am). The following situation arises.....
>
>     Given that code exists to move to a target as follows:
>
>     ...Code Section A....
>     targetID = llTarget(destination,range);
>     llMoveToTarget(destination,speed);
>     ....Code Section B....
>
>     I want to perfectly synchronize it so that Code
>     Section B does not begin until the at_target event
>     code is completely finished. As it stands, Code
>     Section B begins immediately after the move
>     to target has started.
>
>     The simple way to achieve this is to put an
>     llSleep(X) right after llMoveToTarget(..) but this
>     is really a kludge. It should be possible to synchronize
>     things more exactly without such arbitrary, and
>     non-guaranteed, delay artifacts.
>
>     I've looked into things like switching states inside
>     of at_target() which would halt state "default"
>     from going further into Code Section B, but then
>     the quesyion is how to return to this exact spot later
>     once at_target has completed.
>
>     Comments or strategies are welcome.
>
>     -paul
>
>     --
>     Paul Fishwick, PhD
>     Professor and Director, Digital Arts and Sciences Programs
>     University of Florida
>     Computer & Information Science and Eng. Dept.
>     Bldg. CSE, Room 301
>     P.O. Box 116120
>     Gainesville, FL 32611
>     Email: fishwick at cise.ufl.edu <mailto:fishwick at cise.ufl.edu>
>     Phone: (352) 392-1414
>     Fax: (352) 392-1220
>     Web: http://www.cise.ufl.edu/~fishwick
>     <http://www.cise.ufl.edu/%7Efishwick>
>
>     _______________________________________________
>     Click here to unsubscribe or manage your list subscription:
>     https://lists.secondlife.com/cgi-bin/mailman/listinfo/secondlifescripters
>
>
>
>
> -- 
> RL: Jeroen Frans / SL: Frans Charming
> http://www.thevesuviusgroup.com <http://www.thevesuviusgroup.com>
> http://www.fransinnovations.com
> http://www.linkedin.com/in/mrfrans
> http://secondslog.blogspot.com <http://secondslog.blogspot.com>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Click here to unsubscribe or manage your list subscription:
> https://lists.secondlife.com/cgi-bin/mailman/listinfo/secondlifescripters
>   


-- 
Paul Fishwick, PhD
Professor and Director, Digital Arts and Sciences Programs
University of Florida
Computer & Information Science and Eng. Dept.
Bldg. CSE, Room 301
P.O. Box 116120
Gainesville, FL 32611
Email: fishwick at cise.ufl.edu
Phone: (352) 392-1414
Fax: (352) 392-1220
Web: http://www.cise.ufl.edu/~fishwick



More information about the secondlifescripters mailing list