The way I figured it was something like a microwave timer, the timer starts at 00:00:00 and hitting 1 will make it 00:01:00, now a minute is added, but then hitting another number doesn't just add another minute; hitting one again would show 00:11:00. It would push the 1 into the next field making it 11 minutes in total. Like a microwave.
Don't know if I'm going about it wrong but chances are I am
. Any help would be appreciated.------------------------------------------------------------------------------------------------------
// Global Variables
// Integers
integer TimerActive = FALSE;
integer SettingPTimer = FALSE;
integer SettingCTimer = FALSE;
integer channel = -1;
integer PrizeTimer = 0;
integer ClaimTimer = 120;
integer TimeSelected;
// Vectors
// Floats
// Keys
key Key_Holder = NULL_KEY;
// Strings
string SActive = "Inactive";
string Duration = "00:00:00"; // This is not for function, I know that, it's just there to fill in what would otherwise be a blank field as I couldn't get the thing to work
string PDuration;
string CDuration;
// Lists
list Main = ["Safe Timer", "Claim Timer"];
list TimerMenu = ["Clear", "0", "Start", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
list Observation = ["-", "-", "-"];
default
{
state_entry()
{
llListen(channel, "", "", ""
;}
touch_start(integer total_number)
{
if (llDetectedKey(0) == llGetOwner()) {
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration:" + PDuration + "\nClaim Duration: " + CDuration, Main, channel);
} else if (llDetectedKey(0) != llGetOwner()) {
llDialog(llDetectedKey(0), "\t-- Prize Safe -- \n\nTimer: " + SActive + "\nLocked by: " + llKey2Name(Key_Holder), Observation, channel);
}
}
listen (integer channel, string name, key id, string message)
{
////// Safe Timer //////////////////////////////////////////////////////////////////////////////////////////////////////////
if (message == "Safe Timer"
{llDialog(llGetOwner(), "\t-- Prize Timer -- \n\nTimer: " + SActive + "\nTimer Duration: " + PDuration, TimerMenu, channel);
SettingPTimer = TRUE;
SettingCTimer = FALSE;
///// Claim Timer //////////////////////////////////////////////////////////////////////////////////////////////////////////
} else if (message == "Claim Timer"
{llDialog(llGetOwner(), "\t-- Claim Timer -- \n\nTimer Duration: " + CDuration, TimerMenu, channel);
SettingPTimer = FALSE;
SettingCTimer = TRUE;
///// Clear Timers /////////////////////////////////////////////////////////////////////////////////////////////////////////
// Clear Prize Timer //
} else if (message == "Clear"
{if (SettingPTimer == TRUE && SettingCTimer == FALSE) {
// Clear PDuration
PrizeTimer = 0;
llSetTimerEvent(PrizeTimer);
SActive = "Inactive";
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer: " + SActive + "\nTimer Duration: " + PDuration, TimerMenu, channel);
// Clear Claim Timer //
} else if (SettingPTimer == FALSE && SettingCTimer == TRUE)
// Clear CDuration
ClaimTimer = 0;
llSetTimerEvent(ClaimTimer);
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer: " + SActive + "\nTimer Duration: " + CDuration, TimerMenu, channel);
///// Start Timers /////////////////////////////////////////////////////////////////////////////////////////////////////////
// Start Prize Timer //
} else if (message == "Start"
{if (SettingPTimer == TRUE && SettingCTimer == FALSE) {
SActive = "Active";
PrizeTimer = TimeSelected;
llSetTimerEvent(PrizeTimer);
Key_Holder = llGetOwner();
PDuration = Duration;
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration:" + PDuration + "\nClaim Duration: " + CDuration, Main, channel);
// Close Safe
SettingPTimer = FALSE;
SettingCTimer = FALSE;
// Set Claim Timer //
} else if (SettingPTimer == FALSE && SettingCTimer == TRUE)
ClaimTimer = TimeSelected;
CDuration = Duration;
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration:" + PDuration + "\nClaim Duration: " + CDuration, Main, channel);
SettingPTimer = FALSE;
SettingCTimer = FALSE;
///// Add to Timers ////////////////////////////////////////////////////////////////////////////////////////////////////////
} else if (message == "0"
{// Add a 0
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration: " + Duration, TimerMenu, channel);
} else if (message == "1"
{// Add a 1
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration: " + Duration, TimerMenu, channel);
} else if (message == "2"
{// Add a 2
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration: " + Duration, TimerMenu, channel);
} else if (message == "3"
{// Add a 3
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration: " + Duration, TimerMenu, channel);
} else if (message == "4"
{// Add a 4
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration: " + Duration, TimerMenu, channel);
} else if (message == "5"
{// Add a 5
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration: " + Duration, TimerMenu, channel);
} else if (message == "6"
{// Add a 6
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration: " + Duration, TimerMenu, channel);
} else if (message == "7"
{// Add a 7
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration: " + Duration, TimerMenu, channel);
} else if (message == "8"
{// Add a 8
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration: " + Duration, TimerMenu, channel);
} else if (message == "9"
{// Add a 9
llDialog(llGetOwner(), "\t-- Timelock -- \n\nTimer Duration: " + Duration, TimerMenu, channel);
}
}
timer ()
{
if (PrizeTimer = 0) {
SActive = "Inactive";
llSetTimerEvent(0);
// Open Safe
llRezObject("Prize", llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0); // Object "Prize" would hand out the prize to anyone who clicks on it, adding their name to a list which prevents them from getting more then one prize of that type.
} else if (ClaimTimer = 0) {
// Close Safe
}
}
object_rez (key id)
{
llSay(SecureChannel, "PRIZESTART"
; // Run a script within the rezzed object "Prize" that uses llDie to remove itself from the Safe. This will allow the Safe to close and have no object inside it (physically) which prevents people from using their camera to look inside and click the prize after the (claim prize) timer is up.llSetTimerEvent(ClaimTimer);
}
}
I find its easier to read as I do it.