Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Question about gs2 (https://forums.graalonline.com/forums/showthread.php?t=78606)

PrinceOfKenshin 02-06-2008 01:55 AM

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?

Twinny 02-06-2008 02:13 AM

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.

cbk1994 02-06-2008 04:28 AM

Quote:

Originally Posted by PrinceOfKenshin (Post 1373799)
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 :(

Twinny 02-06-2008 04:42 AM

Quote:

Originally Posted by cbkbud (Post 1373827)
Whack your teacher in the face for not teaching my style of styling code :(

Whack yourself repeatedly in the face for saying that!

CremisiSteam 02-06-2008 05:15 PM

gs2 is confusing XD I am still trying to learn it lol

Tigairius 02-06-2008 06:22 PM

Quote:

Originally Posted by Twinny (Post 1373830)
Whack yourself repeatedly in the face for saying that!

Seconded.

cbk1994 02-06-2008 09:06 PM

Quote:

Originally Posted by Twinny (Post 1373830)
Whack yourself repeatedly in the face for saying that!

Oh, I have already done that several times today ;)

Twinny 02-06-2008 11:27 PM

Quote:

Originally Posted by cbkbud (Post 1373904)
Oh, I have already done that several times today ;)

.... :oo:....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?

PrinceOfKenshin 02-08-2008 02:38 AM

Quote:

Originally Posted by Twinny (Post 1373924)
.... :oo:....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!

cbk1994 02-08-2008 03:48 AM

Quote:

Originally Posted by Twinny (Post 1373924)
dude u wer being meen 2 him. dont be meen dude

Are you serious?

Did they leave a name?

lol

Twinny 02-08-2008 03:49 AM

Quote:

Originally Posted by cbkbud (Post 1374107)
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 :frown:

zokemon 02-08-2008 08:48 AM

I countered that with my super powerful +9 reputation power.

cbk1994 02-08-2008 03:47 PM

Quote:

Originally Posted by zokemon (Post 1374129)
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.

Chompy 02-08-2008 10:55 PM

Quote:

Originally Posted by cbkbud (Post 1374155)
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? :(

zokemon 02-08-2008 11:32 PM

Quote:

Originally Posted by cbkbud (Post 1374155)
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.

cbk1994 02-09-2008 12:03 AM

Quote:

Originally Posted by zokemon (Post 1374205)
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 :(


All times are GMT +2. The time now is 06:53 PM.

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