Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

What am I doing wrong?

Echo Dragonfly
Surely You Jest
Join date: 22 Aug 2004
Posts: 325
05-11-2005 18:30
Okay I have decided to try my hand at scripting, lol. I am trying to set up an object, that the default state is cloaked. When sent a message, it is supposed to uncloak for 10 seconds and then revert back to the cloaked state. But allthough it will cloak upon first dropping in the script and uncloak, it won't revert back to cloaked state after the 10 second timer.
here is a copy of the script:
CODE

default
{
state_entry()
{
key owner = llGetOwner();
llWhisper(0,"Cloaking ready");
llListen(5,"",NULL_KEY,"");
llSetStatus(STATUS_PHANTOM, TRUE);
llSetAlpha(0,ALL_SIDES);
}

listen( integer channel, string name, key id, string message )
{

if( message == "uncloak" )
{
llSetStatus(STATUS_PHANTOM, FALSE);
llWhisper(0,"Uncloaking");
llSetAlpha(1,ALL_SIDES);
llSetTimerEvent(10);
llWhisper(0, "Re-Cloaking.");
state default;
}
}
}
_____________________
Creativity represents a miraculous coming together of the uninhibited energy of the child with its apparent opposite and enemy, the sense of order imposed on the disciplined adult intelligence.
Norman Podhoretz
......................
If quizzes are quizzical, what are tests? :eek:
............................
Do illiterate people get the full effect of Alphabet Soup? :rolleyes:
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
05-11-2005 18:38
Replace your call to "state default" within the listen event with a repeat of:
llSetStatus(STATUS_PHANTOM, TRUE);
llSetAlpha(0,ALL_SIDES);

A second option would be to call: llResetScript(); instead of the change I suggested above.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
05-11-2005 18:41
CODE
llWhisper(0,"Uncloaking");
llSetAlpha(1,ALL_SIDES);
llSetTimerEvent(10);
llWhisper(0, "Re-Cloaking.");
state default;

Try llSleep(10); instead. :)
_____________________
---
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
05-11-2005 18:45
Plus a misunderstanding of the library call "llSetTimerEvent()".

Here's the simple way:

CODE
default
{
state_entry()
{
key owner = llGetOwner();
llWhisper(0,"Cloaking ready");
llListen(5, "", NULL_KEY, "");
llSetStatus(STATUS_PHANTOM, TRUE);
llSetAlpha(0.0, ALL_SIDES);
}

listen( integer channel, string name, key id, string message )
{
if( message == "uncloak" )
{
llSetStatus(STATUS_PHANTOM, FALSE);
llWhisper(0,"Uncloaking");
llSetAlpha(1,ALL_SIDES);
llSleep(10.0); // Halts the script for 10 seconds
llWhisper(0, "Re-Cloaking.");
llResetScript();
}
}
}


EDIT: Aww. Jeffry's the faster typer :p
_____________________
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
05-11-2005 18:47
Ha, I read right through that and I guess my eyes replaced the "SetTimerEvent" with "Sleep." That burns me at work all the time. So much for acquiring speed-reading skills.
Echo Dragonfly
Surely You Jest
Join date: 22 Aug 2004
Posts: 325
05-11-2005 18:57
Thx all for the help! Jillian, that worked wondefully, just what I wanted. I'll get this yet, lol. Time to read up in the wiki :)
_____________________
Creativity represents a miraculous coming together of the uninhibited energy of the child with its apparent opposite and enemy, the sense of order imposed on the disciplined adult intelligence.
Norman Podhoretz
......................
If quizzes are quizzical, what are tests? :eek:
............................
Do illiterate people get the full effect of Alphabet Soup? :rolleyes: