[Opensim-users] Floating text not going away

Robert Klein rtkwebman at gmail.com
Wed Mar 16 15:47:41 UTC 2011


I have a script that puts the current time floating above an object. When I
remove the script from the object contents the text still remains floating
above the object showing the time from when the script was removed. The time
does not continue to update but it will not go away. Anyone else have this
problem and if so how did you get the text to go away without deleting the
object and starting over?

Here is the script:

// HoverText Clock Script
// By Ben Linden
//
// Drop on an object to make it display the PST time.
//
// If you are interested in scripting, check out
// the Script Help under the help menu.

// The double slash means these lines are comments
// and ignored by the computer.




// Global Variables
// a string is a collection of characters.
string smin; // Represents minutes
string sseconds; //Represens seconds

// All scripts have a default state, this will be
// the first code executed.
default
{
    // state_entry() is an event handler, it executes
    // whenever a state is entered.
    state_entry()
    {
        // llSetTimerEvent() is a function that sets 
        // up a timer event in seconds.
        llSetTimerEvent(2.0);  // call a timer event 
                               // every 2 seconds.
    }
    
    
    // timer() is an event handler, it executes on an
    // interval defined by llSetTimerEvent()
    timer()
    {
       // llFloor is a function that rounds down all numbers.
       // llGetWallClock is a function that returns the time 
       // of day in seconds, on a 24 hour clock.
       integer seconds =  llFloor(llGetWallclock());
       // Convert the total number of seconds into a integer (whole number)
       integer min = llFloor(seconds/60);
       // Figure out how many minutes that is
       seconds = seconds - (min*60);
       //Work out the remaining number of seconds
       integer hour = llFloor(min/60);
       // figure out how many hours it represents.
       min = min - (hour*60);
       // figure out the number of minutes remaining
       
       // if is a conditional statement, it will only execute if the
conditions are met. 
       if(hour > 12) {hour = hour - 12;} // if the hours are greater than
12, convert to 12 hour time
       string shour = (string)hour; //convert the number into a string
       if(min < 10) {smin = "0"+(string)min;} // if less than 10 minutes,
put a 0 in the minute string
       else { smin = (string)min;} 
       if(seconds < 10) { sseconds = "0"+(string)seconds;} // if less than
10 sec, put a 0 in the second string
       else {sseconds = (string)seconds;}
       
       
       string time = shour + ":" + smin; // build the seperate strings into
a complete string, with colons
       
       // llSetText is a function that displays a string over the object.
       llSetText(time, ZERO_VECTOR, 1.0); //Display the string in solid
black.
    }

}


Thanks,

Robert

--
View this message in context: http://opensim-users.2152040.n2.nabble.com/Floating-text-not-going-away-tp6177053p6177053.html
Sent from the opensim-users mailing list archive at Nabble.com.



More information about the Opensim-users mailing list