Jump to content

time-based vanishing portal, and particles on command


asteriddle
 Share

You are about to reply to a thread that has been inactive for 949 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

so, is it ok to ask two unrelated questions? didnt want to make 2 threads : p

 

first is related to EEP stuff. i want to make a magic portal that is inaccessible and phantom during the day, but when the region is experiencing nighttime, it appears. i already have a portal script and assume i could just use an if/else statement to determine whether it appears (i.e. if time = night, make it appear ; else make it phantom with no tp)

im just not too familiar with how eep scripting works

i assume it'd make use of llGetRegionTimeOfDay , but that's where i'm a bit lost. my region's day length is 4 hours and the offset is -8.0

 

second, is i have a boss character integrated using a hud system, but the system doesnt allow for lsl commands directly, and instead a set of commands in the system - which doesnt allow for things like particles or animations. the character says cheesy one liners when they attack, and from seeing things in SL, isn't there a way to have something said in local chat cause an object to trigger a behavior? 

for example, if the boss says "insert cheesy one liner here" in local chat, a sensor could pick it up and in my situation, i'd want a burst of particles to be summoned to simulate an attack animation. this of course has it's caveats, like if a player figured out that saying the line triggers the particles they could spam it, but the boss area is out of the way in a skybox (that you have to use the time sensitive portal to get to, go figure)

figured out particles on my own!

hopefully im making sense! if i figure it out on my own i'll update with my solution

Edited by asteriddle
clarified i solved a problem
Link to comment
Share on other sites

For automatic operation the portal could be set on a timer. Once you know the length of day, and night, the timer's duration can alternate between the two and set the portal as required.

 

As for the listening script, the listen event can use the 'id' with llGetObjectDetails and any number of parameters to verify the source of the message. I feel it's overkill, unless there are persistent issues with players, filtering your llListen with the mob's name should be enough and is easier on the sim too: llListen( integer channel, "mob name", key id, string msg );

 

 

Link to comment
Share on other sites

53 minutes ago, Mr Amore said:

For automatic operation the portal could be set on a timer. Once you know the length of day, and night, the timer's duration can alternate between the two and set the portal as required.

Personally I'm a bit skeptical of long (more than a few minutes) timers. if you don't want it to drift too much over time, it's best to check against a known clock to see how far off you are from what you are expecting.

There are quite a few clock functions in LSL that all work slightly differently:

(only listing one or two most prominent functions of each type, also check the related functions section on each wiki-page.)

Edited by Quistess Alpha
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Quistess Alpha said:

http://wiki.secondlife.com/wiki/LlGetTimeOfDay ((mostly accurate if you didn't play with environmental settings too much?))

i was planning on going with llGetTimeOfDay , but my problem is... im garbage at math (like, on the brain chemical level. thanks dyscalculia!)

my region's time is the default, 3 hours daytime, 1 hour nighttime. using the example on the wiki, i can't seem to figure out the values i'd want to use for the if (time == x) type statements, if that's even the best way to go about it

basically my question now is for someone who knows math: what would be considered 'nighttime' in seconds, out of the default sl day? where night starts at 0%-25% day progress and resumes through 75%-100% progress

Link to comment
Share on other sites

 

8 hours ago, asteriddle said:

llGetTimeOfDay

using the example code for llGetDayLength on the wiki


http://wiki.secondlife.com/wiki/LlGetDayLength

// hours and minutes are 24 hour clock format
// for the duration of the parcel's SL day length (which is typically 4 RL hours in length)

float timeOfDay = (llGetUnixTime() + llGetDayOffset()) % llGetDayLength() * 1.0 / llGetDayLength();
integer hours = (integer)(timeOfDay * 24);        
integer minutes = (integer)(timeOfDay * 24 * 60) % 60;

if (hours == 0)
{
   // has just gone midnight in the parcel's SL day           
}
else if (hours == 8)
{
   // has just gone 8AM in the parcel's SL day
}
else if (hours == 12)
{
   // has just gone midday in the parcel's SL day
}
else if (hours == 20)
{
   // has just gone 8PM in the parcel's SL day       
}

 

 

Edited by Mollymews
daylength
  • Like 1
Link to comment
Share on other sites

14 hours ago, asteriddle said:

i was planning on going with llGetTimeOfDay , but my problem is... im garbage at math (like, on the brain chemical level. thanks dyscalculia!)

my region's time is the default, 3 hours daytime, 1 hour nighttime. using the example on the wiki, i can't seem to figure out the values i'd want to use for the if (time == x) type statements, if that's even the best way to go about it

As KT Kingsley suggested above, you don't need to go to all that trouble.  Just have your timer event check  llGetSunDirection.  

vector Sun = llGetSunDirection();

if ( Sun.z < 0) { //It's nighttime }

You can get more sophisticated than that if you like.  For example, the sky is still lit for a while after the sun goes down, so you might want to use something slightly on the negative side of zero.  It turns out that Sun.z is pretty close to the sine of the sun's vertical angle, so you could say that it's night when the sun is, say, ten degrees below the horizon or

if ( Sun.z  <  -0.17 )  {//It's nighttime}

Just watch what the sun does and decide how dark you want "night" to be.

Edited by Rolig Loon
typos. as always.
  • Like 1
Link to comment
Share on other sites

58 minutes ago, Rolig Loon said:
if ( Sun.z < 0) { //It's nighttime }

In my head without thinking it through or trying it, trying to figue if it's nighttime with the sun direction seemed like it would be kinda hard. When you point out that for night/day you just have to check the z component it seems like an obvious solution :)

Link to comment
Share on other sites

9 hours ago, Quistess Alpha said:

Interesting. for a 4 segment day with midnight at 0, I'd expect sunset at 21:00 and sunrise at 3:00. 3-9 as 'morning' 9-15 as 'midday' and 15-21 as evening. Some testing for desired times may be required.

i haven't tested it much, but as wrote the wiki uses modulus(daylength) to create the 24 hour clock relative to daylength.  So when daylength is equivalent to 6 unix hours then there is still 24 clock hours in the day

 

  • Like 1
Link to comment
Share on other sites

apologies for the late reply! i stayed up until like 5am working on things and then fell asleep for 12 hours : p

but using good ol google calculator and a LOT of patience, i figured out my own way :'D which is very messy and probably not efficient but also i dont know how to script competently

this is essentially a frankenstein of the experience TP code i use (found here) and my own chickenscratch

originally it would only check in and vanish/appear once, so i ended up adding a 15 minute 'check' timer that resets it to check, and it seems to work just fine!

figured i'd just post it if anyone wants to tear it apart / steal it if they wanted to do the same thing

//orginal TP script by Hillary Davi
vector teleportme = <212,150,1000>;
string MyObjectName;
string textdefault = "";
//Begin code
string theerror;
integer error;
key agent;
integer type;
default
{
    state_entry()
    {
        // Activate the timer listener every 15 mins
        llSetTimerEvent(900.0);
        float tod = llGetTimeOfDay( );
        MyObjectName = llGetObjectName();
        llVolumeDetect(TRUE);
        llSetText(textdefault, <1.0, 1.0, 1.0>, 1.0);
        
        //If TOD is less than 6AM
        if (tod <= 3600) {
        llSetStatus(STATUS_PHANTOM, FALSE);
        llSetAlpha(1.0, ALL_SIDES); // set entire prim 100% invisible
    }
    else {
         //If TOD is more than 6PM      
         if (tod >= 10800) {
            llSetStatus(STATUS_PHANTOM, FALSE);
        llSetAlpha(1.0, ALL_SIDES); // set entire prim 100% invisible
    }
    else {
         llSetStatus(STATUS_PHANTOM, TRUE);
        llSetAlpha(0.0, ALL_SIDES); // set entire prim 100% invisible.
    }
        
    }
           
     
    }
    //Start original TP script
    collision_start(integer num)
    { 
    
       agent = llDetectedKey(0); type = llDetectedType(0);
       if (type == (AGENT | ACTIVE) ) // 1 + 2
        {
            llRequestExperiencePermissions(agent, "");
        }   
    } 
    experience_permissions(key agent) {
        
         float tod2 = llGetTimeOfDay( );
           
           if (tod2 <= 3600) {
           
            llSetText(llKey2Name(agent) + " is using the teleporter please wait...", <1.0, 1.0, 1.0>, 1.0);
            llTeleportAgent(agent, "", teleportme, teleportme);
            llSleep(1);
             llSetText(textdefault, <1.0, 1.0, 1.0>, 1.0);   
            }
            
            else { }
            
            if (tod2 >= 10800) {
           
            llSetText(llKey2Name(agent) + " is using the teleporter please wait...", <1.0, 1.0, 1.0>, 1.0);
            llTeleportAgent(agent, "", teleportme, teleportme);
            llSleep(1);
             llSetText(textdefault, <1.0, 1.0, 1.0>, 1.0);   
            }
            
            else { }
            
    }
    
    timer()
    //Reset script to check if it's night
    {
        llResetScript();
    }
    
    experience_permissions_denied(key agent, integer reason){
        string theerror = llGetExperienceErrorMessage((integer)reason);
        if(reason = XP_ERROR_THROTTLED) {
         llSleep(2);
        } else if (reason = XP_ERROR_REQUEST_PERM_TIMEOUT || reason = XP_ERROR_NOT_PERMITTED || reason = XP_ERROR_NOT_FOUND) {
             llInstantMessage(agent, "Please accept the experience or bad things may happen!"); 
            } 
        if(!llAgentInExperience(agent)) {
         llRequestExperiencePermissions(agent, "");  
         //llRequestExperiencePermissions(llDetectedKey(0), "");
        }
       
    }
    
    touch_start(integer total_number)
    {
     agent = llDetectedKey(0);  type = llDetectedType(0);
       if (type == (AGENT | ACTIVE) ) // 1 + 2
        {
            llRequestExperiencePermissions(agent, "");
        } 
    }
     
}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 949 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...