Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-06-2008, 01:55 AM
PrinceOfKenshin PrinceOfKenshin is offline
That guy with a beard
PrinceOfKenshin's Avatar
Join Date: May 2004
Location: Ontario, Canada
Posts: 819
PrinceOfKenshin has a spectacular aura aboutPrinceOfKenshin has a spectacular aura about
Question about gs2

Okay well i just started AP Computer Science at my school and we are learning Java and i was wondering if gs2 had a feature java does. And that is the whole implementing classes.

So that if i make a class called getbalance

PHP Code:
public double getbalance(double amount) {
balance =amount;
return 
balance;

so that in the main method i could do

PHP Code:
public static void main(String[] args) {
System.out.println(BankAccount.getbalance());

so that i call the method getbalance of the object BankAccount and it will return the vaule of balance.

Is it possible to do that with gs2 and how?
__________________


Quote:
Game Master (Server): Greetings PrinceOfKenshin, there are new posts on the forums that demand your urgent attention! God speed, the fate of the world is in your hands. If you fail, middle earth will forever be in the darkness and your children will be enslaved by McKain.
Reply With Quote
  #2  
Old 02-06-2008, 02:13 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
You could just create a class with a public function and join it to your weapon/weapons like

Class - Bankfunc
PHP Code:
public function getBalance(acct)
{
  
doStuff();
  return 
temp.riches;

Weapon
PHP Code:
function onCreated()
{
  
this.join("Bankfunc");
  
temp.result Bankfunc::getBalance("Twinny"); //Note: Bankfunc:: was to get the idea through: not necessary unless multiple cases of getBalance()
  
printf("Balance: $i"temp.result); //replace $ with percent sign

You could also make a global object join the class:

System
PHP Code:
function onCreated()
{
  
Bank = new TStaticVar();
  
Bank.join("Bankfunc");

Now you could simply do Bank.getBalance() from any script serverside. I don't find it ideal really but it works.

Last edited by Twinny; 02-06-2008 at 02:24 AM..
Reply With Quote
  #3  
Old 02-06-2008, 04:28 AM
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
Quote:
Originally Posted by PrinceOfKenshin View Post
Okay well i just started AP Computer Science at my school and we are learning Java and i was wondering if gs2 had a feature java does. And that is the whole implementing classes.

So that if i make a class called getbalance

PHP Code:
public double getbalance(double amount) {
balance =amount;
return 
balance;

so that in the main method i could do

PHP Code:
public static void main(String[] args) {
System.out.println(BankAccount.getbalance());

so that i call the method getbalance of the object BankAccount and it will return the vaule of balance.

Is it possible to do that with gs2 and how?
Whack your teacher in the face for not teaching my style of styling code
__________________
Reply With Quote
  #4  
Old 02-06-2008, 04:42 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by cbkbud View Post
Whack your teacher in the face for not teaching my style of styling code
Whack yourself repeatedly in the face for saying that!
Reply With Quote
  #5  
Old 02-06-2008, 05:15 PM
CremisiSteam CremisiSteam is offline
Registered User
Join Date: Mar 2007
Posts: 40
CremisiSteam is an unknown quantity at this point
gs2 is confusing XD I am still trying to learn it lol
Reply With Quote
  #6  
Old 02-06-2008, 06:22 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Twinny View Post
Whack yourself repeatedly in the face for saying that!
Seconded.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #7  
Old 02-06-2008, 09:06 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
Quote:
Originally Posted by Twinny View Post
Whack yourself repeatedly in the face for saying that!
Oh, I have already done that several times today
__________________
Reply With Quote
  #8  
Old 02-06-2008, 11:27 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by cbkbud View Post
Oh, I have already done that several times today
.... ....well....umm....keep doing it?

On another note, someone gave me neg rep for that.... who actually thought I was being serious?

"dude u wer being meen 2 him. dont be meen dude" lol...

ANYHOO was your question answered, Mike?
Reply With Quote
  #9  
Old 02-08-2008, 02:38 AM
PrinceOfKenshin PrinceOfKenshin is offline
That guy with a beard
PrinceOfKenshin's Avatar
Join Date: May 2004
Location: Ontario, Canada
Posts: 819
PrinceOfKenshin has a spectacular aura aboutPrinceOfKenshin has a spectacular aura about
Quote:
Originally Posted by Twinny View Post
.... ....well....umm....keep doing it?

On another note, someone gave me neg rep for that.... who actually thought I was being serious?

"dude u wer being meen 2 him. dont be meen dude" lol...

ANYHOO was your question answered, Mike?
Yea thanks Twinny much appreciated!
__________________


Quote:
Game Master (Server): Greetings PrinceOfKenshin, there are new posts on the forums that demand your urgent attention! God speed, the fate of the world is in your hands. If you fail, middle earth will forever be in the darkness and your children will be enslaved by McKain.
Reply With Quote
  #10  
Old 02-08-2008, 03:48 AM
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
Quote:
Originally Posted by Twinny View Post
dude u wer being meen 2 him. dont be meen dude
Are you serious?

Did they leave a name?

lol
__________________
Reply With Quote
  #11  
Old 02-08-2008, 03:49 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by cbkbud View Post
Are you serious?

Did they leave a name?

lol
That was the whole thing....I think that person should lose his/her ability to give reputation
Reply With Quote
  #12  
Old 02-08-2008, 08:48 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
I countered that with my super powerful +9 reputation power.
__________________
Do it with a DON!
Reply With Quote
  #13  
Old 02-08-2008, 03:47 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
Quote:
Originally Posted by zokemon View Post
I countered that with my super powerful +9 reputation power.
I shall be back with my +19 (how the hell did I get this much? I'd like to thank all the little people ;o) reputation for you Twinny. Alas, I have given too much reputation in the last 24 hours.
__________________
Reply With Quote
  #14  
Old 02-08-2008, 10:55 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by cbkbud View Post
I shall be back with my +19 (how the hell did I get this much? I'd like to thank all the little people ;o) reputation for you Twinny. Alas, I have given too much reputation in the last 24 hours.
How do you check how much reputation you can give?
__________________
Reply With Quote
  #15  
Old 02-08-2008, 11:32 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by cbkbud View Post
I shall be back with my +19 (how the hell did I get this much? I'd like to thank all the little people ;o) reputation for you Twinny. Alas, I have given too much reputation in the last 24 hours.
No, that is your reputation points. You power is based off your post count, time since forum sign up and a few other factors. Even forum admins only give +10.

Your rep power should only be about 2 or 3.

Read this.
__________________
Do it with a DON!
Reply With Quote
  #16  
Old 02-09-2008, 12:03 AM
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
Quote:
Originally Posted by zokemon View Post
No, that is your reputation points. You power is based off your post count, time since forum sign up and a few other factors. Even forum admins only give +10.

Your rep power should only be about 2 or 3.

Read this.
Damn you and your clever explanations
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:40 PM.


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