Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-05-2011, 08:32 AM
Twilikari Twilikari is offline
Registered User
Twilikari's Avatar
Join Date: Nov 2010
Location: America
Posts: 86
Twilikari is on a distinguished road
Calculator GUI Help

I was practicing my scriting, and I somewhat succesfully FIXED a calculator script. Too some of you, it may look veryyyy familiar. But I wanted to take it one step further. i wanted to make into a fully operational calculator GUI. I've never even attempted to make a GUI however, and I am completely lost. Any help is greatly appreciated!

I'm not looking for someone to do it for me, more of guide me. I want buttons for numbers in the GUI, and some kind of output for the answer.

PHP Code:
function onCreated() {
  
temp.2;
  
temp.1;
  
temp.3;
  
temp.onAdd(temp.atemp.b);
  
onResult(temp.a);  
  
temp.onSubtract(temp.atemp.c);
  
onResult(temp.a);  
  
temp.onDivide(temp.btemp.a);
  
onResult(temp.a);  
  
temp.onMultiply(temp.1temp.c);
  
onResult(temp.a);  
}

function 
onResult(temp.result) {
  echo(
"Result: " temp.result);
}

function 
onAdd(ab) {
  
a+b;
  return 
a;
}

function 
onSubtract(ab) {
  
b;
  return 
a;
}

function 
onDivide(ab) {  
  if (
== 0) {
    
"Error: Can't divide by 0!";
  } 
  if (
!= 0) {
    
;
  }  
  return 
a;
}

function 
onMultiply(ab) {
  
b;
  return 
a;

Thank's for the help, in advance! ^~^
Reply With Quote
  #2  
Old 07-05-2011, 03:33 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
You can use the GUI Editor in the Client-RC to get a rough idea of how GUIs are made and then afterwards hand-make your own.
__________________
Quote:
Reply With Quote
  #3  
Old 07-05-2011, 03:42 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
This thread might help. If you don't understand how to use onAction events I'll be happy to explain them. I'd try to avoid catchEvent (which that script uses) until you're a bit more experienced with GUIs. If you'd like a more conventional example, try this (but whatever you do, do NOT style your code like that).
__________________
Reply With Quote
  #4  
Old 07-05-2011, 07:49 PM
Twilikari Twilikari is offline
Registered User
Twilikari's Avatar
Join Date: Nov 2010
Location: America
Posts: 86
Twilikari is on a distinguished road
Thank's for all that
That calculator is exactly what I was aiming for. I just gotta figure out an easier way.
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 11:36 AM.


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