timer script missing something -- trap making-- help? - SLUniverse Forums
 
Navigation » SLUniverse Forums > Development Discussion and Support > Scripting » timer script missing something -- trap making-- help?


Scripting Discuss scripting for SL and other platforms

Sponsor:
Vengeance Studio
Reply
 
LinkBack Thread Tools Display Modes
Old 09-20-2009, 11:07 AM   #1 (permalink)
Abundantia Owner
 
Yessika's Avatar
 
Join Date: Sep 2009
Location: SL
Posts: 14
My Mood:
Unhappy timer script missing something -- trap making-- help?

Ok, I just started trying to learn scripting today. I don't speak the lingo, but I've been reading the wiki to get the idea.

What I can't figure out... I'm trying to make a brief trap.

I need a script to have a prim:
be invisible/alpha but not phantom
then become phantom on collision
then 1 second to pass (timer?)
then for it to be not phantom and visible
another 30 seconds to pass- trapping the person
then it becomes phantom and invisible again
end collision
become NOT phantom

ok. I know how to make things phantom and not phantom.

What I can't figure out is how to make the TIMER work in this.


Here's what I have so far: ((I know someone is going to tell me I'm like 1 step away... but that's the step that wiki couldn't explain!))
-------------------------------------------------------------

float gap = 2.0;
integer counter = 0;
default{
state_entry()
{
llSetTimerEvent(gap);
llResetTime();
llSetAlpha(0.0,ALL_SIDES);
llSetStatus(STATUS_PHANTOM, FALSE);
}
collision_start(integer num)
{
llSetStatus(STATUS_PHANTOM, TRUE);
llSetTimerEvent(0);
counter = 0;
}

timer()
{
++counter;
llSetStatus(STATUS_PHANTOM, FALSE);
llSetAlpha(1.0,ALL_SIDES);
}
timer()
{
++counter;
llSetStatus(STATUS_PHANTOM, TRUE);
llSetAlpha(1.0,ALL_SIDES);
}
collision_end(integer num)
{
llSetStatus(STATUS_PHANTOM, FALSE);
}
}



----------------

Can anyone point out what is wrong/ what is missing?
__________________

Last edited by Yessika; 09-20-2009 at 11:14 AM. Reason: added script pic, in case anyone thinks I just missed the tab key
Yessika is offline   Reply With Quote
Old 09-20-2009, 03:34 PM   #2 (permalink)
Dilettante scripter
 
EF Klaar's Avatar
 
Join Date: Sep 2009
Location: UK
Posts: 49
SL Join Date: 11 June 2007
Blog Entries: 1
The sequence of events you describe is linear, so you might as well write linear code for it.

I have added an extra 10 second delay at the end of the cycle to allow the victim time to get clear of the object before the script resets and it stops being phantom and triggers another collision.
Code:
default
{
    state_entry ()
    {
        llSetAlpha (0.0, ALL_SIDES);
        llSetStatus (STATUS_PHANTOM, FALSE);
    }
    collision_start (integer number)
    {
        llSetStatus (STATUS_PHANTOM, TRUE); 
        llSleep (1.0);
        llSetStatus (STATUS_PHANTOM, FALSE);
        llSetAlpha (1.0, ALL_SIDES);
        llSleep (30.0);
        llSetAlpha (0.0, ALL_SIDES);
        llSetStatus (STATUS_PHANTOM, TRUE);
        llSleep (10.0);
        llResetScript ();
    }
}
Note that you will need to use a hollow object to contain an avatar.

Last edited by EF Klaar; 09-20-2009 at 03:41 PM. Reason: Typos
EF Klaar is offline   Reply With Quote
Old 09-20-2009, 04:01 PM   #3 (permalink)
Abundantia Owner
 
Yessika's Avatar
 
Join Date: Sep 2009
Location: SL
Posts: 14
My Mood:
Quote:
Originally Posted by EF Klaar View Post
The sequence of events you describe is linear, so you might as well write linear code for it.
I'm not sure what that means--- but what you did totally works and you are AWESOME!!!!



tyvm!!
Yessika is offline   Reply With Quote
1 User Said Thanks:
Old 09-20-2009, 04:58 PM   #4 (permalink)
Dilettante scripter
 
EF Klaar's Avatar
 
Join Date: Sep 2009
Location: UK
Posts: 49
SL Join Date: 11 June 2007
Blog Entries: 1
Quote:
Originally Posted by Yessika View Post
Quote:
Originally Posted by EF Klaar
The sequence of events you describe is linear, so you might as well write linear code for it.
I'm not sure what that means
It means you don't need to use a timer event for this
EF Klaar is offline   Reply With Quote
Reply

Tags
event, script, timer, trap

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On