|
Monkey Edge
Registered User
Join date: 23 Apr 2005
Posts: 69
|
07-30-2006 10:04
well fo rthe past few days i've been working on and off on a satellite of mine but i've run across a few problems, most of which are fixed at this point, but the problem i need help with is that it refuses to go into the uplink state the script is failry inefficent but fits my needs, for some reason even if i put the probe next to the satellite after the time goes off the satellite just keeps on its roaming path and wont go into uplink mode all help appreciated edit:edit: that should fix the un-needed variables integer target; vector destination; float div_op; float x; float y; float z; float zz; float yy; float xx;
function_find() { x=llFrand(60); y=llFrand(60); z=llFrand(15); zz=-llFrand(15); yy=-llFrand(60); xx=-llFrand(60); destination=llGetPos()+<(xx+x),(yy+y),(zz+z)>; }
default { state_entry() { llSay(0, "Satellite searching for target, please wait."); state roaming; } on_rez(integer start_param) { llResetScript(); }
}
state roaming { on_rez(integer start_param) { llResetScript(); } state_entry() { llSetStatus(STATUS_ROTATE_X, 0); llSetStatus(STATUS_ROTATE_Y,0); llSetStatus(STATUS_PHYSICS, TRUE); llSetTimerEvent(30); llSetBuoyancy(0.95); function_find(); if (destination.x <240&&destination.x>0&&destination.y<240&&destination.y>0&&destination.z>30&&destination.z<100) { target=llTarget(destination,10); div_op=(llVecDist(llGetPos(),destination)); llOwnerSay((string)div_op); llMoveToTarget(destination,div_op); } else { state default; } } not_at_target() { llMoveToTarget(destination,llVecDist(llGetPos(),destination)); } at_target( integer number, vector targetpos, vector ourpos ) { llStopMoveToTarget(); llTargetRemove(target); function_find(); if (destination.x <240&&destination.x>0&&destination.y<240&&destination.y>0&&destination.z>30&&destination.z<100) { div_op=(llVecDist(llGetPos(),destination)); llOwnerSay((string)div_op); target=llTarget(destination,10); llMoveToTarget(destination,llVecDist(llGetPos(),destination)); } else { state default; } } timer() { llSensorRemove(); llSensorRepeat("Probe", NULL_KEY, 4, 70, PI, 1); llStopMoveToTarget(); llTargetRemove(target); function_find(); if (destination.x <240&&destination.x>0&&destination.y<240&&destination.y>0&&destination.z>30&&destination.z<100) { div_op=(llVecDist(llGetPos(),destination)); llOwnerSay((string)div_op); target=llTarget(destination,10); llMoveToTarget(destination,llVecDist(llGetPos(),destination)); llSetTimerEvent(30); } else { state default; } } sensor(integer num_detected) { state uplink; }
}
state uplink { state_entry() { llSetStatus(STATUS_ROTATE_X, 1); llSetStatus(STATUS_ROTATE_Y,2); llStopMoveToTarget(); llSensorRemove(); llSensorRepeat("Probe", NULL_KEY, 1||2||4||8, 70, PI, 1); llSetTimerEvent(40); } sensor(integer num) { llLookAt(llDetectedPos(0),.1,10); } timer() { state roaming; } }
_____________________
What do today what you can put off till tommorrow But....... What is today but yesterday's tommorrow
|
|
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
|
07-30-2006 11:17
Does this work? default { state_entry() { llSensorRepeat("Probe", NULL_KEY, 4, 70, PI, 1); }
sensor(integer num_detected) { llOwnerSay("sensed!"); } }
_____________________
Prim Composer for 3dsMax -- complete offline builder for prims and sculpties in 3ds Max http://liferain.com/downloads/primcomposer/
Hierarchical Prim Archive (HPA) -- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools. https://liferain.com/projects/hpa
|
|
Monkey Edge
Registered User
Join date: 23 Apr 2005
Posts: 69
|
07-30-2006 11:27
yes it works fine
_____________________
What do today what you can put off till tommorrow But....... What is today but yesterday's tommorrow
|
|
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
|
07-30-2006 22:51
One possibility is that the script is performing lots of state changes. Because of the way it is set up, the script changes state every time that the new destination is out of bounds. From the wiki: When a state changes, all pending events are cleared, and all events that require setup (via a function) are defaulted (disabled). So, if we happen to get a state change before the sensor event is fired, then it gets lost. My first recommendation would be to eliminate the state changes between the default state and roaming. The default state really doesn't do anything, so I'd just make roaming the default state. Then, modify function_find() so that it will only return a destination that is in bounds. This will allow you to remove all of the if/then tests. I'm not confident that this will fix the problem, but it will probably bring you closer to a solution. That's my best guess anyway.
_____________________
Prim Composer for 3dsMax -- complete offline builder for prims and sculpties in 3ds Max http://liferain.com/downloads/primcomposer/
Hierarchical Prim Archive (HPA) -- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools. https://liferain.com/projects/hpa
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
07-30-2006 23:01
From: Monkey Edge edit:edit: that should fix the un-needed variables
float x; float y; float z; float zz; float yy; float xx;
function_find() { x=llFrand(60); y=llFrand(60); z=llFrand(15); zz=-llFrand(15); yy=-llFrand(60); xx=-llFrand(60); destination=llGetPos()+<(xx+x),(yy+y),(zz+z)>; }
might help you clean things up abit you can use vectors and do the same thing vector one; vector two;
function_find { one.x = llFrand(60); one.y = llFrand(60); one.z = llFrand(15);
two.x = llFrand(15); two.y = llFrand(60); tow.z = llFrand(60);
destination=llGetPos()+<(two.x+one.x),(two.y+one.y),(two.z+one.z)>; }
|