Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Easy BMI Calculator with Feet/Pounds converter (https://forums.graalonline.com/forums/showthread.php?t=134261606)

PowerProNL 01-08-2011 02:53 PM

Easy BMI Calculator with Feet/Pounds converter
 
Ok, I have decided to make my own BMI Converter.

The BMI Converter looks how fat u are. If your BMI is higher then 30 then you are way too fat if it's 24 you are healthy.

I tested it and it works very well!

Installation:
1. Create a weapon (name doesn't matter).
2. Copy and paste this script.
3. Give your self the weapon.
4. Fire the weapon (select the weapon and press D).
5. Have fun :D.

Feel free to use it anywere, share it doesn't matter. I did this for you :).

PHP Code:

/*
This is made by PowerProNL. Feel free to use it, edit it. as long as I get the credits.
Don't edit this and say that you have made it because that is sad.
*/

//#CLIENTSIDE
function OpenBMI() {
  
BMI_Window1.show();
  new 
GuiWindowCtrl("BMI_Window1") {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "386,112";

    
canmaximize false;
    
canminimize true;
    
canmove true;
    
canresize false;
    
closequery false;
    
destroyonhide false;
    
text "BMI Calculator";
    
364;
    
372;

    new 
GuiButtonCtrl("BMI_Button1") {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "Calculate BMI";
      
width 229;
      
87;
    }
    new 
GuiButtonCtrl("BMI_Button2") {
      
profile GuiBlueButtonProfile;
      
height 57;
      
text "Feets to M ";
      
width 161;
      
227;
    }
    new 
GuiScrollCtrl("BMI_MultiLine1_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 87;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 227;

      new 
GuiMLTextCtrl("BMI_MultiLine1") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
width 202;
      }
    }
    new 
GuiTextEditCtrl("BMI_TextEdit1") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 136;
      
89;
      
text "ex: 1.66";
      
8;
    }
    new 
GuiTextEditCtrl("BMI_TextEdit2") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 137;
      
89;
      
text "ex: 61";
      
42;
    }
    new 
GuiTextCtrl("BMI_Text1") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Your length in m";
      
width 84;
      
3;
      
7;
    }
    new 
GuiButtonCtrl("BMI_Button4") {
      
profile GuiBlueButtonProfile;
      
height 55;
      
text "Pound to KG";
      
width 159;
      
227;
      
57;
    }
    new 
GuiTextCtrl("BMI_Text2") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Your weight in kg";
      
width 85;
      
2;
      
40;
    }
    new 
GuiTextCtrl("BMI_Text3") {
      
profile GuiBlueTextProfile;
      
height 20;
      
width 8;
      
2;
      
64;
      
text "BMI:";
    }
  }
}

function 
BMI_Button1.onAction() {
  
this.cm BMI_TextEdit1.gettext();
  
this.kg BMI_TextEdit2.gettext();
  
this.cm1 this.cm this.cm;
  
this.bmi this.kg this.cm1;
  if (
this.bmi 18) {
    
BMI_Text3.text "BMI: "@int(this.bmi)@" = You have a too light weight.";
  }
  if (
this.bmi 18 && this.bmi 25) {
    
BMI_Text3.text "BMI: "@int(this.bmi)@" = You have a perfect weight.";
  }
  if (
this.bmi 25 && this.bmi 30) {
    
BMI_Text3.text "BMI: "@int(this.bmi)@" = You are fat.";
  }
  if (
this.bmi 30 && this.bmi 35) {
    
BMI_Text3.text "BMI: "@int(this.bmi)@" = You have Obesitas.";
  }
  if (
this.bmi 35) {
    
BMI_Text3.text "BMI: "@int(this.bmi)@" = You have Morbide Obesitas.";
  }
}

function 
BMI_Button2.onAction() {
  
this.cm BMI_TextEdit1.gettext();
  
this.cmm this.cm 0.3048;
  
BMI_TextEdit1.text this.cmm;
}

function 
BMI_Button4.onAction() {
  
this.kg BMI_TextEdit2.gettext();
  
this.kgg this.kg 2.2;
  
BMI_TextEdit2.text int(this.kgg);
}
function 
onWeaponFired() {
  if (!
BMI_Window1.visible) {
    
OpenBMI();
  } else {
    
BMI_Window1.destroy();
  }



Url to video (little preview): http://www.youtube.com/watch?v=g3vcalwc_b4

Deas_Voice 01-08-2011 06:00 PM

poor video, hard see anything ! :(

maximus_asinus 01-08-2011 06:12 PM

interesting but since BMI is completely flawed as a measurement, I'll just say good job on the script.

Crono 01-08-2011 07:11 PM

Quote:

Originally Posted by maximus_asinus (Post 1621325)
interesting but since BMI is completely flawed as a measurement, I'll just say good job on the script.

this.

PowerProNL 01-08-2011 07:20 PM

Thanks :), It's my first time to put a script in the code gallery

PowerProNL 01-08-2011 07:22 PM

Quote:

Originally Posted by Deas_Voice (Post 1621323)
poor video, hard see anything ! :(

I know :O, I used alt+6 (screen recorder of Graal) and I saw video, and I was too lazy to make another video because I was sleepy. But yea, you can see the gui :)


All times are GMT +2. The time now is 03:02 AM.

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