Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-07-2010, 08:47 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
Calculator script

**UPDATED**
I made a simple calculator script, it's my biggest script so far.
this is what it looks like:

Updates planned for the future:

*I will make it more advanced so you will have a mem function, and a square root and ^2 function.


this is the code:
PHP Code:
//#CLIENTSIDE
function onWeaponFired()
{
  
this.number1 1;
  
this.number2 0;
  
this.divide 0;
  
this.add 0;
  
this.subtract 0;
  
this.multiply 0;
  new 
GuiWindowCtrl("Calculator_window")
  {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "165, 200";
    
canmove true;
    
canresize false;
    
closequery false;
    
destroyonhide true;
    
text "Calculator";
    
300;
    
200;
    
    new 
GuiTextEditCtrl("Calculator_input")
    {
      
profile GuiBlueTextEditProfile;
      
useownprofile true;
      
profile.align "right"
      
5;
      
5;
      
width 155;
      
height 30;
      
text="0";
      
text.align "right";
    }
    new 
GuiButtonCtrl("Calculator_clear")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "Clear";
      
width 35;
      
5;
      
45;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_plusmin")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "+/-";
      
width 35;
      
45;
      
45;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_divide")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "/";
      
width 35;
      
85;
      
45;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_multiply")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "X";
      
width 35;
      
125;
      
45;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
        new 
GuiButtonCtrl("Calculator_seven")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "7";
      
width 35;
      
5;
      
75;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_eight")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "8";
      
width 35;
      
45;
      
75;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_nine")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "9";
      
width 35;
      
85;
      
75;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_subtract")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "-";
      
width 35;
      
125;
      
75;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
        new 
GuiButtonCtrl("Calculator_four")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "4";
      
width 35;
      
5;
      
105;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_five")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "5";
      
width 35;
      
45;
      
105;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_six")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "6";
      
width 35;
      
85;
      
105;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_add")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "+";
      
width 35;
      
125;
      
105;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
        new 
GuiButtonCtrl("Calculator_one")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "1";
      
width 35;
      
5;
      
135;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_two")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "2";
      
width 35;
      
45;
      
135;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_three")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "3";
      
width 35;
      
85;
      
135;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_equals")
    {
      
profile GuiBlueButtonProfile;
      
height 55;
      
text "=";
      
width 35;
      
125;
      
135;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_zero")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "0";
      
width 75;
      
5;
      
165;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_dot")
    {
    
profile GuiBlueButtonProfile;
      
height 25;
      
text ".";
      
width 35;
      
85;
      
165;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }   
  }
}
function 
ButtonPressed(obj)
{
  if(
obj.text in |09|)
  {
    if(
Calculator_input.text == "0")
    {
      
Calculator_input.text obj.text;
    }
    else
    {
      
Calculator_input.text @= obj.text;
    }
  }
  else if(
obj.text == ".")
  {
    
    
Calculator_input.text @= obj.text;
  }
  else if(
obj.text == "+/-")
  {
    
Calculator_input.text -= Calculator_input.text;
  }
  else if(
obj.text == "X")
  { 
    if(
this.divide == 1)
    {
      
this.divide 0;
      
Calculator_input.text = (this.number1 Calculator_input.text);
    }
    else if(
this.add == 1)
    {
      
this.add 0;
      
Calculator_input.text += this.number2;
    }
    else if(
this.subtract == 1)
    {
      
Calculator_input.text this.number2 Calculator_input.text;
      
this.subtract 0;
    }
    
this.divide 0;
    
this.add 0;
    
this.subtract 0;
    
this.multiply 1;
    
this.number1 *= Calculator_input.text;
    
Calculator_input.text "0";
  }
  else if(
obj.text == "/")
  {
    if(
this.multiply == 1)
    {
      
Calculator_input.text *= this.number1;
      
this.number1 1;
    }
    else if(
this.add == 1)
    {
      
this.add 0;
      
Calculator_input.text += this.number2;
    }
    else if(
this.subtract == 1)
    {
      
Calculator_input.text this.number2 Calculator_input.text;
      
this.subtract 0;
    }
    
this.multiply 0;
    
this.add 0;
    
this.subtract 0;
    
this.divide 1;
    
this.number1 Calculator_input.text this.number1;
    
Calculator_input.text "0";
  }
  else if(
obj.text == "+")
  { 
    if(
this.multiply == 1)
    {
      
Calculator_input.text *= this.number1;
      
this.number1 1;
    }
    else if(
this.divide == 1)
    {
      
this.divide 0;
      
Calculator_input.text = (this.number1 Calculator_input.text);
    }
    else if(
this.subtract == 1)
    {
      
Calculator_input.text this.number2 Calculator_input.text;
      
this.subtract 0;
    }
    
this.multiply 0;
    
this.divide 0;
    
this.subtract 0;
    
this.add 1;
    
this.number2 += Calculator_input.text;
    
Calculator_input.text "0";
  }
  else if(
obj.text == "-")
  { 
    if(
this.multiply == 1)
    {
      
Calculator_input.text *= this.number1;
      
this.multiply 0;
    }
    else if(
this.divide == 1)
    {
      
this.divide 0;
      
Calculator_input.text = (this.number1 Calculator_input.text);
    }
    else if(
this.add == 1)
    {
      
this.add 0;
      
Calculator_input.text += this.number2;
    }
    
this.subtract 1;
    
this.number2 Calculator_input.text this.number2;
    
Calculator_input.text "0";
  }
  else if(
obj.text == "=")
  {
    if(
this.multiply == 1)
    {
      
Calculator_input.text *= this.number1;
      
this.number1 1;
      
this.multiply 0;
      
this.number2 0;
    }
    else if(
this.divide == 1)
    {
      
this.divide 0;
      
Calculator_input.text = (this.number1 Calculator_input.text);
      
this.number1 1;
      
this.number2 0;
    }
    else if(
this.add == 1)
    {
      
this.add 0;
      
Calculator_input.text += this.number2;
      
this.number2 0;
      
this.number1 1;
    }
    else if(
this.subtract == 1)
    {
      
Calculator_input.text this.number2 Calculator_input.text;
      
this.subtract 0;
      
this.number1 1;  
      
this.number2 0;
    }
  }
  else if(
obj.text == "Clear")
  {
    
Calculator_input.text 0;
    
this.number1 1;  
    
this.number2 0;   
  } 
}
//Created by Miniman 
or in a handy text file.
any tips or critics are appreciated, i know i could've done *= with the multiply and add functions. but decided to leave it this way so they match with the divide and subtract functions.

thanks to chris, switch and fowlplay4 for the help.
Attached Files
File Type: txt Calculatorscript2.txt (8.5 KB, 199 views)
__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.

Last edited by Liberated; 01-08-2010 at 07:09 PM..
Reply With Quote
  #2  
Old 01-07-2010, 09:09 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Looks good

Quote:
Originally Posted by Liberated View Post
but decided to leave it this way so they match with the divide and subtract functions.
You can do "/=", "-=", etc.
__________________
Reply With Quote
  #3  
Old 01-07-2010, 09:19 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
Quote:
Originally Posted by cbk1994 View Post
Looks good



You can do "/=", "-=", etc.
but i have to change Calculator_input.text.
and if i would do
PHP Code:
Calculator_input.text -= this.number1;
i would get Calculator_input.text Calculator_input.text this.number1;
when i need Calculator_input.text this.number1 Calculator_input.text
the wrong way arround :s
same with /= but for multiplying and adding it doesn't matter which one comes first.

for example
PHP Code:
Calculator_input.text 5;
this.number1 2;
i need this.number1 Calculator_input.text = -3
but 
if i would do =- i would get Calculator_input.text -= this.number1which is
 3 but in the order which it is entered in the calculator i need the first way

__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.
Reply With Quote
  #4  
Old 01-07-2010, 10:06 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Try using catchEvent() in the buttons so you don't need all those obj.onAction()'s
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #5  
Old 01-07-2010, 10:10 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
Quote:
Originally Posted by Switch View Post
Try using catchEvent() in the buttons so you don't need all those obj.onAction()'s
What doe catchEvent() do?
I was already wondering if there wasn't an easier way btw.
__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.
Reply With Quote
  #6  
Old 01-07-2010, 10:22 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Liberated View Post
What doe catchEvent() do?
I was already wondering if there wasn't an easier way btw.
catchevent(str, str, str) - adds an event handler for the specified object name and event, third parameter is the name of the function which receives the event (first parameter of the event will be the object for which the event occured)
http://wiki.graal.net/index.php/Crea...ient/TGraalVar

PHP Code:
//in button creation
catchEvent(this"onAction""buttonPressed");

//later
function buttonPressed(obj) { //obj is the object caught
  //stuff

Doing simple checks (probably easiest to use obj.text) inside buttonPressed() will determine what to do.

Example:
PHP Code:
if (obj.text in |09|) {
  
this.number1 @= obj.text;

__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #7  
Old 01-08-2010, 01:05 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
That's kind of vague, but here's a live example of catchevent.

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
catchEventTest();
}

function 
catchEventTest() {
  new 
GuiButtonCtrl("HelloWorldButton") {
    
0;
    
width screenwidth;
    
height screenheight;
    
text "Hello World!";
    
thiso.catchevent(this.name"onAction""onHelloWorldPressed");
  }
}

function 
onHelloWorldPressed(obj) {
  
player.chat format("Good bye %s!"obj.name);
  
obj.destroy();

Also right align the result, and you'll be gr8.
__________________
Quote:
Reply With Quote
  #8  
Old 01-08-2010, 06:55 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
V2.0 is done!
PHP Code:
//#CLIENTSIDE
function onWeaponFired()
{
  
this.number1 1;
  
this.number2 0;
  
this.divide 0;
  
this.add 0;
  
this.subtract 0;
  
this.multiply 0;
  new 
GuiWindowCtrl("Calculator_window")
  {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "165, 200";
    
canmove true;
    
canresize false;
    
closequery false;
    
destroyonhide true;
    
text "Calculator";
    
300;
    
200;
    
    new 
GuiTextEditCtrl("Calculator_input")
    {
      
profile GuiBlueTextEditProfile;
      
useownprofile true;
      
profile.align "right"
      
5;
      
5;
      
width 155;
      
height 30;
      
text="0";
    }
    new 
GuiButtonCtrl("Calculator_clear")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "Clear";
      
width 35;
      
5;
      
45;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_plusmin")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "+/-";
      
width 35;
      
45;
      
45;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_divide")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "/";
      
width 35;
      
85;
      
45;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_multiply")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "X";
      
width 35;
      
125;
      
45;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
        new 
GuiButtonCtrl("Calculator_seven")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "7";
      
width 35;
      
5;
      
75;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_eight")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "8";
      
width 35;
      
45;
      
75;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_nine")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "9";
      
width 35;
      
85;
      
75;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_subtract")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "-";
      
width 35;
      
125;
      
75;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
        new 
GuiButtonCtrl("Calculator_four")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "4";
      
width 35;
      
5;
      
105;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_five")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "5";
      
width 35;
      
45;
      
105;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_six")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "6";
      
width 35;
      
85;
      
105;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_add")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "+";
      
width 35;
      
125;
      
105;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
        new 
GuiButtonCtrl("Calculator_one")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "1";
      
width 35;
      
5;
      
135;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_two")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "2";
      
width 35;
      
45;
      
135;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_three")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "3";
      
width 35;
      
85;
      
135;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_equals")
    {
      
profile GuiBlueButtonProfile;
      
height 55;
      
text "=";
      
width 35;
      
125;
      
135;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_zero")
    {
      
profile GuiBlueButtonProfile;
      
height 25;
      
text "0";
      
width 75;
      
5;
      
165;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }
    new 
GuiButtonCtrl("Calculator_dot")
    {
    
profile GuiBlueButtonProfile;
      
height 25;
      
text ".";
      
width 35;
      
85;
      
165;
      
thiso.catchEvent(this"onAction""buttonPressed");
    }   
  }
}
function 
ButtonPressed(obj)
{
  if(
obj.text in |09|)
  {
    if(
Calculator_input.text == "0")
    {
      
Calculator_input.text obj.text;
    }
    else
    {
      
Calculator_input.text @= obj.text;
    }
  }
  else if(
obj.text == ".")
  {
    
    
Calculator_input.text @= obj.text;
  }
  else if(
obj.text == "+/-")
  {
    
Calculator_input.text -= Calculator_input.text;
  }
  else if(
obj.text == "X")
  { 
    if(
this.divide == 1)
    {
      
this.divide 0;
      
Calculator_input.text = (this.number1 Calculator_input.text);
    }
    else if(
this.add == 1)
    {
      
this.add 0;
      
Calculator_input.text += this.number2;
    }
    else if(
this.subtract == 1)
    {
      
Calculator_input.text this.number2 Calculator_input.text;
      
this.subtract 0;
    }
    
this.divide 0;
    
this.add 0;
    
this.subtract 0;
    
this.multiply 1;
    
this.number1 *= Calculator_input.text;
    
Calculator_input.text "0";
  }
  else if(
obj.text == "/")
  {
    if(
this.multiply == 1)
    {
      
Calculator_input.text *= this.number1;
      
this.number1 1;
    }
    else if(
this.add == 1)
    {
      
this.add 0;
      
Calculator_input.text += this.number2;
    }
    else if(
this.subtract == 1)
    {
      
Calculator_input.text this.number2 Calculator_input.text;
      
this.subtract 0;
    }
    
this.multiply 0;
    
this.add 0;
    
this.subtract 0;
    
this.divide 1;
    
this.number1 Calculator_input.text this.number1;
    
Calculator_input.text "0";
  }
  else if(
obj.text == "+")
  { 
    if(
this.multiply == 1)
    {
      
Calculator_input.text *= this.number1;
      
this.number1 1;
    }
    else if(
this.divide == 1)
    {
      
this.divide 0;
      
Calculator_input.text = (this.number1 Calculator_input.text);
    }
    else if(
this.subtract == 1)
    {
      
Calculator_input.text this.number2 Calculator_input.text;
      
this.subtract 0;
    }
    
this.multiply 0;
    
this.divide 0;
    
this.subtract 0;
    
this.add 1;
    
this.number2 += Calculator_input.text;
    
Calculator_input.text "0";
  }
  else if(
obj.text == "-")
  { 
    if(
this.multiply == 1)
    {
      
Calculator_input.text *= this.number1;
      
this.multiply 0;
    }
    else if(
this.divide == 1)
    {
      
this.divide 0;
      
Calculator_input.text = (this.number1 Calculator_input.text);
    }
    else if(
this.add == 1)
    {
      
this.add 0;
      
Calculator_input.text += this.number2;
    }
    
this.subtract 1;
    
this.number2 Calculator_input.text this.number2;
    
Calculator_input.text "0";
  }
  else if(
obj.text == "=")
  {
    if(
this.multiply == 1)
    {
      
Calculator_input.text *= this.number1;
      
this.number1 1;
      
this.multiply 0;
      
this.number2 0;
    }
    else if(
this.divide == 1)
    {
      
this.divide 0;
      
Calculator_input.text = (this.number1 Calculator_input.text);
      
this.number1 1;
      
this.number2 0;
    }
    else if(
this.add == 1)
    {
      
this.add 0;
      
Calculator_input.text += this.number2;
      
this.number2 0;
      
this.number1 1;
    }
    else if(
this.subtract == 1)
    {
      
Calculator_input.text this.number2 Calculator_input.text;
      
this.subtract 0;
      
this.number1 1;  
      
this.number2 0;
    }
  }
  else if(
obj.text == "Clear")
  {
    
Calculator_input.text 0;
    
this.number1 1;  
    
this.number2 0;   
  } 

it looks exactly the same but it's 2 times as good!
I used the catchEvent() thing, and now you don't have to do8*8=64 * 8= etc.
now you can just do 8*8*8=, or even 8*8+3/2
however, to make this possible, quite alot more code was used, and despite catchEvent(), it now has exactly as much lines as it used to have
it doesn't use bodmas tho. and it just does the calculations in the sequence you put it in.
right align also works now.
@fowlplay4,
i haven't been able to align it to the right. any tips? fixed, thanks
__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.

Last edited by Liberated; 01-08-2010 at 07:07 PM..
Reply With Quote
  #9  
Old 01-08-2010, 07:00 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Something like this should work, but I know align has been a pain before with me.

PHP Code:
    new GuiTextEditCtrl("Calculator_input")
    {
      
profile GuiBlueTextEditProfile;
      
useownprofile true;
      
profile.align "right";
      
5;
      
5;
      
width 155;
      
height 30;
      
text="0";
    } 
__________________
Quote:
Reply With Quote
  #10  
Old 01-08-2010, 07:05 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
Quote:
Originally Posted by fowlplay4 View Post
Something like this should work, but I know align has been a pain before with me.
i tried text.align before, but that didn't work, maybe this does, i hope it will.

edit: works, lemme update earlier post.
__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.
Reply With Quote
  #11  
Old 02-22-2010, 02:16 AM
jkldogg jkldogg is offline
J.Rollin (killaz)
jkldogg's Avatar
Join Date: Feb 2010
Location: USA
Posts: 675
jkldogg can only hope to improve
Send a message via AIM to jkldogg Send a message via MSN to jkldogg
how do u use the script? like do u say /calculator or something? i added the script to my server, vega united, but it's not working
__________________

PSN: jkldogg



The best post ever made on the graal forums.
After playing Graal Online for many years, JKL decides to make a forum account. Isn't life funny?
Reply With Quote
  #12  
Old 02-22-2010, 02:51 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Quote:
Originally Posted by jkldogg View Post
how do u use the script? like do u say /calculator or something? i added the script to my server, vega united, but it's not working
Vega United is one of the most promising server's I've seen in a long time. Good job.
Reply With Quote
  #13  
Old 02-22-2010, 03:42 AM
Soala Soala is offline
Ideas on Fire
Soala's Avatar
Join Date: Jun 2007
Location: In my head
Posts: 3,208
Soala is a jewel in the roughSoala is a jewel in the rough
Good job there buddy, +rep coming your way!

Quote:
Originally Posted by jkldogg View Post
how do u use the script? like do u say /calculator or something? i added the script to my server, vega united, but it's not working
Quote:
function onWeaponFired()
This should tell you enough about how it works. You actually just press D after selecting it in your inventory.
Just look at the script, if it was meant to be launched with a command you would actually see if the script is told to run by a command.
Reply With Quote
  #14  
Old 02-22-2010, 11:25 AM
smirt362 smirt362 is offline
Tee Hee
smirt362's Avatar
Join Date: Feb 2005
Location: Texas
Posts: 2,101
smirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant future
Send a message via AIM to smirt362 Send a message via MSN to smirt362
Pretty cool.
__________________

Don Hertzfeldt <3
Reply With Quote
  #15  
Old 02-25-2010, 07:04 PM
jkldogg jkldogg is offline
J.Rollin (killaz)
jkldogg's Avatar
Join Date: Feb 2010
Location: USA
Posts: 675
jkldogg can only hope to improve
Send a message via AIM to jkldogg Send a message via MSN to jkldogg
Wink thank you

Quote:
Originally Posted by 12171217 View Post
Vega United is one of the most promising server's I've seen in a long time. Good job.
wow, thanks
__________________

PSN: jkldogg



The best post ever made on the graal forums.
After playing Graal Online for many years, JKL decides to make a forum account. Isn't life funny?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:29 AM.


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