Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script compiles but doesn't work?

Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-09-2009 23:56
Everything works except for the reset on rez. Can anyone help me figure out what I missed?

CODE


integer channel = 0;

default {
state_entry() {
llRequestPermissions(llGetOwner(),PERMISSION_TRACK_CAMERA);
}
run_time_permissions(integer perm) {
if (perm & PERMISSION_TRACK_CAMERA) {
state camera_captured;
}
}
}

state camera_captured {
state_entry() {
llListen(channel,"",llGetOwner(),"");
llSetStatus(STATUS_PHYSICS,TRUE);
llSetTimerEvent(0.1);
}
timer() {
llMoveToTarget(llGetCameraPos()+< 0.0,0.0,-1.5>,0.1);
}
listen(integer channel, string name, key id, string message) {
if (llToLower(message) == "hold") {
state camera_captured_disabled;
}
}
}

state camera_captured_disabled {
state_entry() {
llListen(channel,"",llGetOwner(),"");
llSetStatus(STATUS_PHYSICS,FALSE);
}
listen(integer channel, string name, key id, string message) {
if (llToLower(message) == "follow") {
state camera_captured;
}
}

on_rez(integer start_param)
{
llResetScript();
}
}

Talon Brown
Slacker Punk
Join date: 17 May 2006
Posts: 352
07-10-2009 00:09
Perhaps I am wrong but wouldn't newly rezzed objects always start in the default state? You have the on_rez event in the camera_captured_disabled state.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-10-2009 00:15
From: Talon Brown
Perhaps I am wrong but wouldn't newly rezzed objects always start in the default state? You have the on_rez event in the camera_captured_disabled state.

not exactly... it could be in ANY state, but it's only resetting if it's in the disabled state... if you want it to reset on EVERY rez, then it needs to be in every state.
_____________________
|
| . "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...
| -
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-10-2009 00:24
In other words, I gotta put that in once before each new state?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-10-2009 02:19
yup
_____________________
|
| . "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...
| -