PDA

View Full Version : Death Clock


Angel_Light
06-10-2007, 06:11 AM
Just load it into a weapon named whatever you want and add it to the your player. Sorry I have to double post this script since it is too many characters


// Created by Mr. Omega
// Help from DustyPorViva : Thanks :D

// Found a website with something like this, so I tried to
// replicate it. Forum PM me for the site since I'm not
// allowed to post it. Anyways, this is what I made out a
// boredom and many hours of coffee o_O.

//#CLIENTSIDE
function onCreated() DeathClock();
DeathWindow();

function DeathClock() {
new GuiButtonCtrl( "Death_Button") {
profile = "GuiBlueButtonProfile";
position = { 0, screenheight-16};
extent = { 64, 16};
text = "Death Clock";
};
}

function Death_Button.onAction()
Death_Window.visible = !Death_Window.visible;


function DeathWindow() {
new GuiWindowCtrl("Death_Window") {
profile = "GuiBlueTransWindowProfile";
profile.fontColor = { 255, 255, 255};
extent = { 400, 96};
position = { screenwidth/3, screenheight/3};
text = "Death Clock";
fontSize = 14;
useownprofile = true;
canClose = true;
canMove = true;
canResize = false;
canMinimize = true;
canMaximize = false;
visble = false;

new GuiTextCtrl("Day_of_Birth") {
profile = "GuiBlueTextProfile";
position = { 9, 25};
text = "Day of Birth:";
};

new GuiTextEditCtrl("Day_of_Birth_Text") {
profile = "GuiBlueTextEditProfile";
position = { 78, 25};
extent = { 32, 20};
text = 1;
};

new GuiTextCtrl("Month_of_Birth") {
profile = "GuiBlueTextProfile";
position = { 9, 47};
text = "Month of Birth:";
};

new GuiPopUpMenuCtrl("Month_of_Birth_Choice") {
profile = "GuiBluePopUpMenuProfile";
scrollprofile = "GuiBlueScrollProfile";
position = { 78, 47};
extent = { 70, 20};
canMove = false;
canResize = false;
canMaximize = false;
canClose = true;
useownprofile = true;
canMinimize = false;
tile = true;
visible = true;

clearrows();
addRow( 1, "January");
addRow( 2, "February");
addRow( 3, "March");
addRow( 4, "April");
addRow( 5, "May");
addRow( 6, "June");
addRow( 7, "July");
addRow( 8, "August");
addRow( 9, "September");
addRow( 10, "October");
addRow( 11, "November");
addRow( 12, "December");
setSelectedRow(0);
};

new GuiTextCtrl("Year_of_Birth") {
profile = "GuiBlueTextProfile";
position = { 9, 69};
profile.fontsize = 14;
text = "Birth Year:";
};

new GuiTextEditCtrl("Year_of_Birth_Text") {
profile = "GuiBlueTextEditProfile";
position = { 78, 69};
extent = { 32, 20};
text = 1970;
};

new GuiTextCtrl("Gender") {
profile = "GuiBlueTextProfile";
position = { 150, 25};
text = "Sex :";
};

new GuiPopUpMenuCtrl("Gender_Choice") {
profile = "GuiBluePopUpMenuProfile";
scrollprofile = "GuiBlueScrollProfile";
position = { 180, 25};
extent = { 70, 20};
canMove = false;
canResize = false;
canMaximize = false;
canClose = true;
useownprofile = true;
canMinimize = false;
tile = true;
visible = true;

clearrows();
addRow( 0, "Male");
addRow( 1, "Female");
addRow( 2, "Unknown");
setSelectedRow(0);

};

new GuiTextCtrl("BMI") {
profile = "GuiBlueTextProfile";
position = { 150, 47};
text = "BMI*:";
};

new GuiPopUpMenuCtrl("BMI_Choice") {
profile = "GuiBluePopUpMenuProfile";
scrollprofile = "GuiBlueScrollProfile";
position = { 180, 47};
extent = { 70, 20};
canMove = false;
canResize = false;
canMaximize = false;
canClose = true;
useownprofile = true;
canMinimize = false;
tile = true;
visible = true;

clearrows();
addRow( 0, "<25");
addRow( 1, "25-29");
addRow( 2, "30-34");
addRow( 3, "35-39");
addRow( 4, "40-44");
addRow( 3, ">=45");
setSelectedRow(0);
};

new GuiTextCtrl("Smoking") {
profile = "GuiBlueTextProfile";
position = { 150, 69};
text = "Smoking Status:";
};

new GuiPopUpMenuCtrl("Smoking_Choice") {
profile = "GuiBluePopUpMenuProfile";
scrollprofile = "GuiBlueScrollProfile";
position = { 227, 69};
extent = { 70, 20};
canMove = false;
canResize = false;
canMaximize = false;
canClose = true;
useownprofile = true;
canMinimize = false;
tile = true;
visible = true;

clearrows();
addRow( 0, "Non-Smoker");
addRow( 1, "Smoker");
setSelectedRow(0);
};

new GuiButtonCtrl("BMI_Button") {
profile = "GuiBlueButtonProfile";
position = { 250, 25};
extent = { 64, 20};
text = "Get BMI";
};

new GuiButtonCtrl("About_Button") {
profile = "GuiBlueButtonProfile";
position = { 318, 25};
extent = { 75, 20};
text = "About";
};

new GuiButtonCtrl("Death_Date_Button") {
profile = "GuiBlueButtonProfile";
position = { 300, 69};
extent = { 93, 20};
text = "Get Death Date!";
};

new GuiTextCtrl("CreatedBy") {
profile = "GuiTextProfile";
profile.fontsize = 16;
position = { 253, 45};
extent = { 256, 32};
profile.fontColor = { 0, 0, 0};
text = "Created By: Mr. Omega";
useownprofile = true;
};

new GuiTextCtrl("DD") {
profile = "GuiBlueTextProfile";
position = { 115, 25};
text = "DD";
};

new GuiTextCtrl("YY") {
profile = "GuiBlueTextProfile";
position = { 112, 69};
text = "YYYY";
};
};
}

function Death_Date_Button.onAction() {
if (Month_of_Birth_Choice.text != "Pick One!" &&
Gender_Choice.text != "Pick One!" &&
BMI_Choice.text != "Pick One!" &&
Smoking_Choice.text != "Pick One!" &&
Day_of_Birth_Text.text in |1, 31| &&
Year_of_Birth_Text.text in |1900, 2100|)
ResultsWindow();

else
DataError();
}

function DataError() {
new GuiWindowCtrl("Data_Error_Window") {
profile = "GuiBlueTransWindowProfile";
profile.fontColor = { 255, 255, 255};
extent = { 200, 32};
position = { screenwidth/2.25, screenheight/3+80};
text = "!!! ERROR !!!";
fontSize = 14;
useownprofile = true;
canClose = true;
canMove = false;
canResize = false;
canMinimize = false;
canMaximize = false;
destroyOnHide = true;
visble = false;

new GuiTextCtrl("Data_Error_Text") {
profile = "GuiBlueTextProfile";
position = { 12, 25};
text = "Sorry, Not Enough Data or Bad Data!!";
};
};
}

function ResultsWindow() {
if (Month_of_Birth_Choice.text == "January")
thiso.month = "April";
if (Month_of_Birth_Choice.text == "February")
thiso.month = "August";
if (Month_of_Birth_Choice.text == "March")
thiso.month = "January";
if (Month_of_Birth_Choice.text == "April")
thiso.month = "December";
if (Month_of_Birth_Choice.text == "May")
thiso.month = "July";
if (Month_of_Birth_Choice.text == "June")
thiso.month = "September";
if (Month_of_Birth_Choice.text == "July")
thiso.month = "June";
if (Month_of_Birth_Choice.text == "August")
thiso.month = "November";
if (Month_of_Birth_Choice.text == "September")
thiso.month = "February";
if (Month_of_Birth_Choice.text == "October")
thiso.month = "May";
if (Month_of_Birth_Choice.text == "November")
thiso.month = "March";
if (Month_of_Birth_Choice.text == "December")
thiso.month = "October";

if (Gender_Choice.text == "Male")
this.sex = 74;
if (Gender_Choice.text == "Female")
this.sex = 79;
if (Gender_Choice.text == "Unknown")
this.sex = 75;

if (BMI_Choice.text == "<25")
this.BMI = 2;
if (BMI_Choice.text == "25-29")
this.BMI = 3;
if (BMI_Choice.text == "30-34")
this.BMI = 4;
if (BMI_Choice.text == "35-39")
this.BMI = 5;
if (BMI_Choice.text == "40-44")
this.BMI = 7;
if (BMI_Choice.text == ">=45")
this.BMI = 9;

if (Smoking_Choice.text == "Non-Smoker")
this.smoke = 1;
if (Smoking_Choice.text == "Smoker")
this.smoke = 3;

if (Day_of_Birth_Text.text in |1, 4|)
thiso.day = {"Sunday", 28};
if (Day_of_Birth_Text.text in |5, 9|)
thiso.day = {"Monday", 2};
if (Day_of_Birth_Text.text in |10, 14|)
thiso.day = {"Tuesday", 26};
if (Day_of_Birth_Text.text in |15, 19|)
thiso.day = {"Wednesday", 5};
if (Day_of_Birth_Text.text in |20, 24|)
thiso.day = {"Thursday", 9};
if (Day_of_Birth_Text.text in |25, 29|)
thiso.day = {"Friday", 11};
if (Day_of_Birth_Text.text in |30, 31|)
thiso.day = {"Saturday", 21};

this.year = Year_of_Birth_Text.getText();
thiso.d1 = (this.year + this.sex) - (this.BMI*this.smoke);

Angel_Light
06-10-2007, 06:11 AM
new GuiWindowCtrl("Results_Window") {
profile = "GuiBlueTransWindowProfile";
profile.fontColor = { 255, 255, 255};
extent = { 158, 64};
position = { screenwidth/2, screenheight/3+80};
text = "Death Clock Results";
fontSize = 14;
useownprofile = true;
canClose = true;
canMove = false;
canResize = false;
canMinimize = false;
canMaximize = false;
destroyOnHide = true;
visble = false;

new GuiMLTextCtrl("Reseult_Text") {
profile = "GuiBlueTextProfile";
position = { 12, 25};
extent = { 175, 48};
columns = { 80, 175};
text = "Your going to die on, " NL thiso.day[0] SPC thiso.month SPC thiso.day[1] SPC thiso.d1;
};

if (thiso.d1 < 2007)
{
Reseult_Text.setText("Sorry, your time is up!" NL "Have a Nice Day! :)");
}
};
}


function BMI_Button.onAction() BMIWind();

function BMIWind() {
new GuiWindowCtrl("BMI_Window") {
profile = "GuiBlueTransWindowProfile";
profile.fontColor = { 255, 255, 255};
extent = { 175, 96};
position = { screenwidth/2.25, screenheight/3+80};
text = "BMI";
fontSize = 14;
useownprofile = true;
canClose = true;
canMove = false;
canResize = false;
canMinimize = false;
canMaximize = false;
destroyOnHide = true;
visble = false;

new GuiTextCtrl("Weight_Text") {
profile = "GuiBlueTextProfile";
position = { 12, 25};
text = "Weight (lbs) :";
};

new GuiTextCtrl("Height_Text") {
profile = "GuiBlueTextProfile";
position = { 12, 47};
text = "Height (in) :";
};

new GuiTextCtrl("BMI_Text") {
profile = "GuiBlueTextProfile";
position = { 12, 69};
text = "Your BMI is :";
};

new GuiTextEditCtrl("Weight_Edit_Text") {
profile = "GuiBlueTextEditProfile";
position = { 78, 25};
extent = { 32, 20};
};

new GuiTextEditCtrl("Height_Edit_Text") {
profile = "GuiBlueTextEditProfile";
position = { 78, 47};
extent = { 32, 20};
};

new GuiButtonCtrl("BMI_Get_Button") {
profile = "GuiBlueButtonProfile";
position = { 112, 47};
extent = { 55, 20};
text = "Get BMI";
};
};
}

function BMI_Get_Button.onAction() {
this.weight1 = Weight_Edit_Text.text;
this.height1 = Height_Edit_Text.text;
this.BMI1 = int((this.weight1*703)/(this.height1^2));
BMI_Text.setText("Your BMI is :" @ this.BMI1);
}

function About_Button.onAction() {
new GuiWindowCtrl("About_Window") {
profile = "GuiBlueTransWindowProfile";
profile.fontColor = { 255, 255, 255};
extent = { 250, 150};
position = { screenwidth/2.55, screenheight/3+80};
text = "About";
fontSize = 14;
useownprofile = true;
canClose = true;
canMove = false;
canResize = false;
canMinimize = false;
canMaximize = false;
destroyOnHide = true;
visble = false;

new GuiMLTextCtrl("About_Text") {
profile = "GuiBlueTextProfile";
position = { 8, 25};
extent = { 240, 48};
columns = { 80, 175};
text = "Hello, this script is made by Mr. Omega of Niromia it is free for anyone to tinker with, just do not call it your own. :P THIS IS NOT MEANT TO BE SERIOUS OR ACTUAL!!! Some data is based off averages from the CIA Data bases of Human Health and sites alike. Have Fun!
- Mr. Omega";
};
};
}


Just copy each one into the same weapon no spaces or nothing, just make sure it's on its own line :P

I'm sure there ways to optimize it but I could care less so don't babble on about it

File for download I put aswell if you feel unsafe with the two post thing o.o

Twinny
06-10-2007, 06:47 AM
With GUI's, if you are setting multiple values as true, just do

canresize=canclose=canminimize=false;
canmaximize=canmove=true;


To save lines. Doing this will drastically reduce the size of your current script.

Also, instead of doing

if (condition)
statement;
if (condition)
statement;
if (condition)
statement;


You should get into the habit of using

if (condition)
statement
else if (condition)
statement
else
statement

Angel_Light
06-10-2007, 07:01 AM
I'm sure there ways to optimize it but I could care less so don't babble on about it

read above Twinny :P It's not a serious script, it's just to play around. I know your trying to help and all, but I know those things already, just to lazy, haha!

DustyPorViva
06-10-2007, 07:10 AM
To save lines. Doing this will drastically reduce the size of your current script.

Also, instead of doing

if (condition)
statement;
if (condition)
statement;
if (condition)
statement;


You should get into the habit of using

if (condition)
statement
else if (condition)
statement
else
statement

Actually, It's only really necessary if the following checks should only be possible when the previous are not true. Should probably use a switch in this case.

Twinny
06-10-2007, 07:23 AM
Actually, It's only really necessary if the following checks should only be possible when the previous are not true. Should probably use a switch in this case.

In this examples case, Omega should have used if else if else if else. A switch would work too though.

DustyPorViva
06-10-2007, 07:25 AM
Well I didn't actually read the script, so I didn't really check if it should have been best done that way or not. Though it seems in this case, an array would have been the best usage here, probably wrapped all that into a couple of lines max.
read above Twinny :P It's not a serious script, it's just to play around. I know your trying to help and all, but I know those things already, just to lazy, haha!
Not to really put you out there or anything, but just for discussion about the topic. If you know the skills, you should always put them to use, whether it's just for fun or not. There's no reason to dismiss them, even in laziness, as even being done in fun it still helps. Like I said, not trying to challenge your knowledge of the stuff, just my opinion.