| Scripting Discuss scripting for SL and other platforms |
| |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Abundantia Owner ![]() Join Date: Sep 2009 Location: SL
Posts: 14
My Mood: | 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 |
| | |
| | #2 (permalink) |
| Dilettante scripter ![]() | 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 ();
}
}
Last edited by EF Klaar; 09-20-2009 at 03:41 PM. Reason: Typos |
| | |
![]() |
| Tags |
| event, script, timer, trap |
| Thread Tools | |
| Display Modes | |
| |