Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Death Clock (https://forums.graalonline.com/forums/showthread.php?t=74503)

Angel_Light 06-10-2007 05:11 AM

Death Clock
 
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

PHP Code:

// 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 = { 0screenheight-16};
    
extent   = { 6416};
    
text     "Death Clock";
  };
}

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


function 
DeathWindow() {
  new 
GuiWindowCtrl("Death_Window") {
    
profile           "GuiBlueTransWindowProfile";
    
profile.fontColor = { 255255255};
    
extent            = { 40096};
    
position          = { screenwidth/3screenheight/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 = { 925};
      
text     "Day of Birth:";
    };

    new 
GuiTextEditCtrl("Day_of_Birth_Text") {
      
profile  "GuiBlueTextEditProfile";
      
position = { 7825};
      
extent   = { 3220};
      
text     1;
    };

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

    new 
GuiPopUpMenuCtrl("Month_of_Birth_Choice") {
      
profile       "GuiBluePopUpMenuProfile";
      
scrollprofile "GuiBlueScrollProfile";
      
position      = { 7847};
      
extent        = { 7020};
      
canMove       false;
      
canResize     false;
      
canMaximize   false;
      
canClose      true;
      
useownprofile true;
      
canMinimize   false;
      
tile          true;
      
visible       true;

      
clearrows();
      
addRow1"January");
      
addRow2"February");
      
addRow3"March");
      
addRow4"April");
      
addRow5"May");
      
addRow6"June");
      
addRow7"July");
      
addRow8"August");
      
addRow9"September");
      
addRow10"October");
      
addRow11"November");
      
addRow12"December");
      
setSelectedRow(0);
    };

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

    new 
GuiTextEditCtrl("Year_of_Birth_Text") {
      
profile  "GuiBlueTextEditProfile";
      
position = { 7869};
      
extent   = { 3220};
      
text     1970;
    };

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

    new 
GuiPopUpMenuCtrl("Gender_Choice") {
      
profile       "GuiBluePopUpMenuProfile";
      
scrollprofile "GuiBlueScrollProfile";
      
position      = { 18025};
      
extent        = { 7020};
      
canMove       false;
      
canResize     false;
      
canMaximize   false;
      
canClose      true;
      
useownprofile true;
      
canMinimize   false;
      
tile          true;
      
visible       true;

      
clearrows();
      
addRow0"Male");
      
addRow1"Female");
      
addRow2"Unknown");
      
setSelectedRow(0);

    };

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

    new 
GuiPopUpMenuCtrl("BMI_Choice") {
      
profile       "GuiBluePopUpMenuProfile";
      
scrollprofile "GuiBlueScrollProfile";
      
position      = { 18047};
      
extent        = { 7020};
      
canMove       false;
      
canResize     false;
      
canMaximize   false;
      
canClose      true;
      
useownprofile true;
      
canMinimize   false;
      
tile          true;
      
visible       true;

      
clearrows();
      
addRow0"<25");
      
addRow1"25-29");
      
addRow2"30-34");
      
addRow3"35-39");
      
addRow4"40-44");
      
addRow3">=45");
      
setSelectedRow(0);
    };

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

    new 
GuiPopUpMenuCtrl("Smoking_Choice") {
      
profile       "GuiBluePopUpMenuProfile";
      
scrollprofile "GuiBlueScrollProfile";
      
position      = { 22769};
      
extent        = { 7020};
      
canMove       false;
      
canResize     false;
      
canMaximize   false;
      
canClose      true;
      
useownprofile true;
      
canMinimize   false;
      
tile          true;
      
visible       true;

      
clearrows();
      
addRow0"Non-Smoker");
      
addRow1"Smoker");
      
setSelectedRow(0);
    };

    new 
GuiButtonCtrl("BMI_Button") {
      
profile  "GuiBlueButtonProfile";
      
position = { 25025};
      
extent   = { 6420};
      
text     "Get BMI";
    };

    new 
GuiButtonCtrl("About_Button") {
      
profile  "GuiBlueButtonProfile";
      
position = { 31825};
      
extent   = { 7520};
      
text     "About";
    };

    new 
GuiButtonCtrl("Death_Date_Button") {
      
profile  "GuiBlueButtonProfile";
      
position = { 30069};
      
extent   = { 9320};
      
text     "Get Death Date!";
    };

    new 
GuiTextCtrl("CreatedBy") {
      
profile           "GuiTextProfile";
      
profile.fontsize  16;
      
position          = { 25345};
      
extent            = { 25632};
      
profile.fontColor = { 000};
      
text              "Created By: Mr. Omega";
      
useownprofile true;
    };

    new 
GuiTextCtrl("DD") {
      
profile  "GuiBlueTextProfile";
      
position = { 11525};
      
text     "DD";
    };

    new 
GuiTextCtrl("YY") {
      
profile  "GuiBlueTextProfile";
      
position = { 11269};
      
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 |131| &&
      
Year_of_Birth_Text.text in |19002100|)
    
ResultsWindow();

  else
    
DataError();
}

function 
DataError() {
  new 
GuiWindowCtrl("Data_Error_Window") {
    
profile           "GuiBlueTransWindowProfile";
    
profile.fontColor = { 255255255};
    
extent            = { 20032};
    
position          = { screenwidth/2.25screenheight/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 = { 1225};
      
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 |14|)
    
thiso.day = {"Sunday"28};
  if (
Day_of_Birth_Text.text in |59|)
    
thiso.day = {"Monday"2};
  if (
Day_of_Birth_Text.text in |1014|)
    
thiso.day = {"Tuesday"26};
  if (
Day_of_Birth_Text.text in |1519|)
    
thiso.day = {"Wednesday"5};
  if (
Day_of_Birth_Text.text in |2024|)
    
thiso.day = {"Thursday"9};
  if (
Day_of_Birth_Text.text in |2529|)
    
thiso.day = {"Friday"11};
  if (
Day_of_Birth_Text.text in |3031|)
    
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 05:11 AM

1 Attachment(s)
PHP Code:

  new GuiWindowCtrl("Results_Window") {
    
profile           "GuiBlueTransWindowProfile";
    
profile.fontColor = { 255255255};
    
extent            = { 15864};
    
position          = { screenwidth/2screenheight/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 = { 1225};
      
extent   = { 17548};
      
columns  = { 80175};
      
text     "Your going to die on, " NL thiso.day[0SPC thiso.month SPC thiso.day[1SPC 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 = { 255255255};
    
extent            = { 17596};
    
position          = { screenwidth/2.25screenheight/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 = { 1225};
      
text     "Weight (lbs) :";
    };

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

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

    new 
GuiTextEditCtrl("Weight_Edit_Text") {
      
profile  "GuiBlueTextEditProfile";
      
position = { 7825};
      
extent   = { 3220};
    };

    new 
GuiTextEditCtrl("Height_Edit_Text") {
      
profile  "GuiBlueTextEditProfile";
      
position = { 7847};
      
extent   = { 3220};
    };

    new 
GuiButtonCtrl("BMI_Get_Button") {
      
profile  "GuiBlueButtonProfile";
      
position = { 11247};
      
extent   = { 5520};
      
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 = { 255255255};
    
extent            = { 250150};
    
position          = { screenwidth/2.55screenheight/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 = { 825};
      
extent   = { 24048};
      
columns  = { 80175};
      
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 05:47 AM

With GUI's, if you are setting multiple values as true, just do
PHP Code:

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
PHP Code:

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

You should get into the habit of using
PHP Code:

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


Angel_Light 06-10-2007 06:01 AM

Quote:

Originally Posted by Angel_Light (Post 1316774)
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 06:10 AM

Quote:

Originally Posted by Twinny (Post 1316776)
To save lines. Doing this will drastically reduce the size of your current script.

Also, instead of doing
PHP Code:

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

You should get into the habit of using
PHP Code:

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 06:23 AM

Quote:

Originally Posted by DustyPorViva (Post 1316779)
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 06: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.
Quote:

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.


All times are GMT +2. The time now is 07:27 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.