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 03-28-2008, 09:53 AM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Bank!!

PHP Code:
public function GetMoney() {
    
temp.data.loadVars(this.GetBankFilePath());
    
    return (
data.money);
}

public function 
CreateBankAccount() {
    
temp.data.money 0;
    
    
data.account_opened timevar2;
    
data.last_transaction timevar2;
    
    
data.savevars(this.GetBankFilePath(), 0);
}

public function 
GetBankFilePath() {
    return 
"ServerData/Bank/" this.account.substring(01) @ "/" this.account ".txt";
}

public function 
ResetBank() {
    
this.CreateBankAccount();
}

public function 
SetMoney(amount) {
    
temp.data.loadVars(this.GetBankFilePath());
    
temp.money temp.amount.substring(1);
    
temp.flag temp.amount.substring(01);
       
    
data.transactions.add(log);
    
    if (
flag == "-"data.money -= amount;
    else if (
flag == "="data.money amount;
    else 
data.money += amount;

    
temp.flags = {"-""+""="};
    
temp.logs = {"Reduce""Increase""Set"};
    
temp.log flags.index(flag);
    
log flag @ (log == -1"Increase"logSPC money ". Total:" SPC data.money;
    
log.add(timevar2);
    
    
data.last_transaction timevar2;
    
    
data.savevars(this.GetBankFilePath(), 0);
}    

public function 
GetNetWorth() {
    
temp.assets this.obtainAssets();
    
temp.liabilities this.obtainLiabilities();
    
    return (
liabilities assets);

created for dev Litter!!
Reply With Quote
  #2  
Old 03-28-2008, 03:22 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
PHP Code:
temp.assets this.obtainAssets();
temp.liabilities this.obtainLiabilities(); 
Defined where?
Reply With Quote
  #3  
Old 03-28-2008, 08:26 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
obj.substring(0,1) is more succinctly put as obj.charat(0).
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 03-28-2008 at 08:33 PM.. Reason: Spelling
Reply With Quote
  #4  
Old 03-28-2008, 09:07 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
they are my functions to obtain what the player pays out and gains he he
Quote:
Originally Posted by DrakilorP2P View Post
PHP Code:
temp.assets this.obtainAssets();
temp.liabilities this.obtainLiabilities(); 
Defined where?

oh, thanks!!!!
Quote:
Originally Posted by Tolnaftate2004 View Post
obj.substring(0,1) is more succinctly put as obj.charat(0).
Reply With Quote
  #5  
Old 03-28-2008, 09:39 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
I would also like to point out that you're using temp.log before you define it (data.transactions.add(log); and some lines down it's defined).
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #6  
Old 03-29-2008, 04:23 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
When making accessor functions like GetBankFilePath and such, you should return either thiso.var or just plain var as if that function was called inside a with () block, it would cause problems. Same applies to some other areas where you said stuff like this.obtainAsserts().
__________________
Do it with a DON!
Reply With Quote
  #7  
Old 03-29-2008, 04:34 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
Wow, you are getting good fast, Sydney!

Could use some work though, especially adding security.
__________________
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:33 PM.


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