thor348

August 23rd, 2013, 04:11 AM

Hello everyone, I have spent the past few hours developing this bank system script for my new project. I was contemplating releasing it or not because of the depth of possible detail based upon the developer discretion. When you examine the script, there are a few things I could have done to shorten it and still have it's level of functionality, but I script different than most and i'm fine with that.

*Credit Required if Used/Changed

Version 1.0

=begin

###############################################################################

***PokéUnionBank System By Thor348K***

Features Include:

Withdraw, Deposit, View Account Balance,

Interest Gain, Check Total Interest Gain

Created on 8/22/13

Future Features Will Iclude:

View Total In-Game Days With An Account

View Total In-Game Days With A Specific Account

Variables Used:

21 = Interest Gained Total

19 = Account Balance

18 = $Trainer.money

17 = Steps Taken (Defined in Game_Player_ Script)

Switches Used:

47 = \PN has Starter Account

48 = \PN has Trainer Account

49 = \PN has Master Account

50 = \PN has Legendary Account

>>>Credit Required if Used/Changed

###############################################################################

=end

###################################

# BASIC FUNCTIONS #

###################################

#Function for Withdrawing Money from your Account

def pbWithdrawMoney

params=ChooseNumberParams.new

params.setRange(0,$game_variables[19])

params.setInitialValue($game_variables[19])

params.setCancelValue(0)

qty=Kernel.pbMessageChooseNumber(

_INTL("\\bHow much do you want to withdraw?"),params

)

if qty>0

$Trainer.money+=qty

$game_variables[19]-=qty

Kernel.pbMessage(_INTL("\\b${1} was withdrawn.",qty))

Kernel.pbMessage(_INTL("\\bYou now have ${1} in your account.",$game_variables[19]))

else

Kernel.pbMessage(_INTL("\\bNo money was withdrawn."))

end

end

#Function for Depositing Money into Account

def pbDepositMoney

params=ChooseNumberParams.new

$game_variables[18]=$Trainer.money

params.setRange(0,$game_variables[18])

params.setInitialValue(0)

params.setCancelValue(0)

qty=Kernel.pbMessageChooseNumber(

_INTL("\\bHow much do you want to deposit?"),params

)

if qty>0

$Trainer.money-=qty

$game_variables[19]+=qty

Kernel.pbMessage(_INTL("\\b${1} was deposited.",qty))

Kernel.pbMessage(_INTL("\\bYou now have ${1} in your account.",$game_variables[19]))

else

Kernel.pbMessage(_INTL("\\bNothing was deposited."))

end

end

#Tells you how much you have in your Account

def pbViewMoney

Kernel.pbMessage(_INTL("\\bYou currently have ${1} in your account.",$game_variables[19]))

end

###################################

# INTEREST #

###################################

#Sets Steps that Player has taken to Zero

def pbSetupInterest

$game_variables[17]=0

steps=$game_variables[17]

end

#Tells you how many steps you have taken

def pbCheckInterest

steps=$game_variables[17]

Kernel.pbMessage(_INTL("\\bYou have taken {1} steps.",steps))

end

#Tells you how much you've made off interest

def pbInterestGain

total=$game_variables[21]

Kernel.pbMessage(_INTL("\\bYou've made ${1} from your interest rate!",total))

end

#Calculates and Adds Interest into Account

def pbCalcInterest

steps=$game_variables[17]

account=$game_variables[19]

if $game_switches[47]==true #Has Starter Account

$game_variables[17]=0

end

if account>=500 #500

if steps<=499 #499

$game_variables[19]+=0 if $game_switches[47]==true #Has Starter Account

$game_variables[19]+=0 if $game_switches[48]==true #Has Trainer Account

$game_variables[19]+=0 if $game_switches[49]==true #Has Master Account

$game_variables[19]+=0 if $game_switches[50]==true #Has Legendary Account

end

begin

if steps>=500 #500

$game_variables[19]+=0 if $game_switches[47]==true #Has Starter Account

$game_variables[19]+=5 if $game_switches[48]==true #Has Trainer Account

$game_variables[19]+=15 if $game_switches[49]==true #Has Master Account

$game_variables[19]+=50 if $game_switches[50]==true #Has Legendary Account

$game_variables[21]+=0 if $game_switches[47]==true #Has Starter Account

$game_variables[21]+=5 if $game_switches[48]==true #Has Trainer Account

$game_variables[21]+=15 if $game_switches[49]==true #Has Master Account

$game_variables[21]+=50 if $game_switches[50]==true #Has Legendary Account

$game_variables[17]-=500 #500

end

end until $game_variables[17]<=499 #499

else

account+=0

end

end

###################################

# DAYS WITH ACCOUNT #

###################################

#pbDayCountAccount = counts how many days you've had that specific account

#pbDayCountTotal = counts how many days you've had an account

Version1.1

Modified by Laureolus with help from Maruno

To be more "Plug and Play"

=begin

###############################################################################

***PokéUnionBank System By Thor348K.

Edited by Laureolus, with help from Maruno***

>>>Credit Thor348K if Used/Changed

Features Include:

Withdraw, Deposit, View Account Balance,

Interest Gain, Check Total Interest Gain

Created on 8/22/13

>>>Credit Thor348K if Used/Changed

###############################################################################

=end

class PokemonGlobalMetadata

attr_accessor :bankInterestTimer

attr_accessor :bankInterestTotal

attr_accessor :bankAccountType

attr_accessor :bankAccountBalance

def bankInterestTimer

@bankInterestTimer=0 if !@bankInterestTimer

return @bankInterestTimer

end

def bankAccountType

@bankAccountType=0 if !@bankAccountType

return @bankAccountType

end

def bankInterestTotal

@bankAccountBalance=0 if !@bankAccountBalance

return @bankAccountBalance

end

def bankAccountBalance

@bankAccountBalance=0 if !@bankAccountBalance

return @bankAccountBalance

end

end

Events.onStepTaken+=proc{

$PokemonGlobal.bankInterestTimer += 1

}

###################################

# BASIC FUNCTIONS #

###################################

#Function for Withdrawing Money from your Account

def pbWithdrawMoney

params=ChooseNumberParams.new

params.setRange(0, $PokemonGlobal.bankAccountBalance)

params.setInitialValue( $PokemonGlobal.bankAccountBalance)

params.setCancelValue(0)

qty=Kernel.pbMessageChooseNumber(

_INTL("\\bHow much do you want to withdraw?"),params

)

if qty>0

$Trainer.money+=qty

$PokemonGlobal.bankAccountBalance-=qty

Kernel.pbMessage(_INTL("\\b${1} was withdrawn.",qty))

Kernel.pbMessage(_INTL("\\bYou now have ${1} in your account.", $PokemonGlobal.bankAccountBalance))

else

Kernel.pbMessage(_INTL("\\bNo money was withdrawn."))

end

end

#Function for Depositing Money into Account

def pbDepositMoney

params=ChooseNumberParams.new

params.setRange(0,$Trainer.money)

params.setInitialValue(0)

params.setCancelValue(0)

qty=Kernel.pbMessageChooseNumber(

_INTL("\\bHow much do you want to deposit?"),params

)

if qty>0

$Trainer.money-=qty

$PokemonGlobal.bankAccountBalance+=qty

Kernel.pbMessage(_INTL("\\b${1} was deposited.",qty))

Kernel.pbMessage(_INTL("\\bYou now have ${1} in your account.", $PokemonGlobal.bankAccountBalance))

else

Kernel.pbMessage(_INTL("\\bNothing was deposited."))

end

end

#Tells you how much you have in your Account

def pbViewMoney

Kernel.pbMessage(_INTL("\\bYou currently have ${1} in your account.", $PokemonGlobal.bankAccountBalance))

end

###################################

# INTEREST #

###################################

#Sets Steps that Player has taken to Zero

def pbSetupAccount

$PokemonGlobal.bankInterestTimer=0

$PokemonGlobal.bankAccountBalance=0

$PokemonGlobal.bankAccountType=1

$PokemonGlobal.bankInterestTotal=0

end

#Tells you how many steps you have taken

def pbCheckInterestTimer

steps = $PokemonGlobal.bankInterestTimer

Kernel.pbMessage(_INTL("\\bYou have taken {1} steps.",steps))

end

#Tells you how much you've made off interest

def pbInterestEarned

total= $PokemonGlobal.bankInterestTotal

Kernel.pbMessage(_INTL("\\bYou've made ${1} from your interest rate!",total))

end

#Calculates and Adds Interest into Account

def pbCalcInterest

if $PokemonGlobal.bankAccountType == 1

a = $PokemonGlobal.bankInterestTimer/500

$PokemonGlobal.bankInterestTimer -= a*500

a = a * 5

$PokemonGlobal.bankAccountBalance+=a

elsif $PokemonGlobal.bankAccountType == 2

a = $PokemonGlobal.bankInterestTimer/500

$PokemonGlobal.bankInterestTimer -= a*500

a = a * 15

$PokemonGlobal.bankAccountBalance+=a

elsif$PokemonGlobal.bankAccountType == 3

a = $PokemonGlobal.bankInterestTimer/500

$PokemonGlobal.bankInterestTimer -= a*500

a = a *30

$PokemonGlobal.bankAccountBalance+=a

else

a = $PokemonGlobal.bankInterestTimer/500

$PokemonGlobal.bankInterestTimer -= a*500

a= a *50

$PokemonGlobal.bankAccountBalance+=a

end

end

###################################

# DAYS WITH ACCOUNT #

###################################

#pbDayCountAccount = counts how many days you've had that specific account

#pbDayCountTotal = counts how many days you've had an account

*Credit Required if Used/Changed

Version 1.0

=begin

###############################################################################

***PokéUnionBank System By Thor348K***

Features Include:

Withdraw, Deposit, View Account Balance,

Interest Gain, Check Total Interest Gain

Created on 8/22/13

Future Features Will Iclude:

View Total In-Game Days With An Account

View Total In-Game Days With A Specific Account

Variables Used:

21 = Interest Gained Total

19 = Account Balance

18 = $Trainer.money

17 = Steps Taken (Defined in Game_Player_ Script)

Switches Used:

47 = \PN has Starter Account

48 = \PN has Trainer Account

49 = \PN has Master Account

50 = \PN has Legendary Account

>>>Credit Required if Used/Changed

###############################################################################

=end

###################################

# BASIC FUNCTIONS #

###################################

#Function for Withdrawing Money from your Account

def pbWithdrawMoney

params=ChooseNumberParams.new

params.setRange(0,$game_variables[19])

params.setInitialValue($game_variables[19])

params.setCancelValue(0)

qty=Kernel.pbMessageChooseNumber(

_INTL("\\bHow much do you want to withdraw?"),params

)

if qty>0

$Trainer.money+=qty

$game_variables[19]-=qty

Kernel.pbMessage(_INTL("\\b${1} was withdrawn.",qty))

Kernel.pbMessage(_INTL("\\bYou now have ${1} in your account.",$game_variables[19]))

else

Kernel.pbMessage(_INTL("\\bNo money was withdrawn."))

end

end

#Function for Depositing Money into Account

def pbDepositMoney

params=ChooseNumberParams.new

$game_variables[18]=$Trainer.money

params.setRange(0,$game_variables[18])

params.setInitialValue(0)

params.setCancelValue(0)

qty=Kernel.pbMessageChooseNumber(

_INTL("\\bHow much do you want to deposit?"),params

)

if qty>0

$Trainer.money-=qty

$game_variables[19]+=qty

Kernel.pbMessage(_INTL("\\b${1} was deposited.",qty))

Kernel.pbMessage(_INTL("\\bYou now have ${1} in your account.",$game_variables[19]))

else

Kernel.pbMessage(_INTL("\\bNothing was deposited."))

end

end

#Tells you how much you have in your Account

def pbViewMoney

Kernel.pbMessage(_INTL("\\bYou currently have ${1} in your account.",$game_variables[19]))

end

###################################

# INTEREST #

###################################

#Sets Steps that Player has taken to Zero

def pbSetupInterest

$game_variables[17]=0

steps=$game_variables[17]

end

#Tells you how many steps you have taken

def pbCheckInterest

steps=$game_variables[17]

Kernel.pbMessage(_INTL("\\bYou have taken {1} steps.",steps))

end

#Tells you how much you've made off interest

def pbInterestGain

total=$game_variables[21]

Kernel.pbMessage(_INTL("\\bYou've made ${1} from your interest rate!",total))

end

#Calculates and Adds Interest into Account

def pbCalcInterest

steps=$game_variables[17]

account=$game_variables[19]

if $game_switches[47]==true #Has Starter Account

$game_variables[17]=0

end

if account>=500 #500

if steps<=499 #499

$game_variables[19]+=0 if $game_switches[47]==true #Has Starter Account

$game_variables[19]+=0 if $game_switches[48]==true #Has Trainer Account

$game_variables[19]+=0 if $game_switches[49]==true #Has Master Account

$game_variables[19]+=0 if $game_switches[50]==true #Has Legendary Account

end

begin

if steps>=500 #500

$game_variables[19]+=0 if $game_switches[47]==true #Has Starter Account

$game_variables[19]+=5 if $game_switches[48]==true #Has Trainer Account

$game_variables[19]+=15 if $game_switches[49]==true #Has Master Account

$game_variables[19]+=50 if $game_switches[50]==true #Has Legendary Account

$game_variables[21]+=0 if $game_switches[47]==true #Has Starter Account

$game_variables[21]+=5 if $game_switches[48]==true #Has Trainer Account

$game_variables[21]+=15 if $game_switches[49]==true #Has Master Account

$game_variables[21]+=50 if $game_switches[50]==true #Has Legendary Account

$game_variables[17]-=500 #500

end

end until $game_variables[17]<=499 #499

else

account+=0

end

end

###################################

# DAYS WITH ACCOUNT #

###################################

#pbDayCountAccount = counts how many days you've had that specific account

#pbDayCountTotal = counts how many days you've had an account

Version1.1

Modified by Laureolus with help from Maruno

To be more "Plug and Play"

=begin

###############################################################################

***PokéUnionBank System By Thor348K.

Edited by Laureolus, with help from Maruno***

>>>Credit Thor348K if Used/Changed

Features Include:

Withdraw, Deposit, View Account Balance,

Interest Gain, Check Total Interest Gain

Created on 8/22/13

>>>Credit Thor348K if Used/Changed

###############################################################################

=end

class PokemonGlobalMetadata

attr_accessor :bankInterestTimer

attr_accessor :bankInterestTotal

attr_accessor :bankAccountType

attr_accessor :bankAccountBalance

def bankInterestTimer

@bankInterestTimer=0 if !@bankInterestTimer

return @bankInterestTimer

end

def bankAccountType

@bankAccountType=0 if !@bankAccountType

return @bankAccountType

end

def bankInterestTotal

@bankAccountBalance=0 if !@bankAccountBalance

return @bankAccountBalance

end

def bankAccountBalance

@bankAccountBalance=0 if !@bankAccountBalance

return @bankAccountBalance

end

end

Events.onStepTaken+=proc{

$PokemonGlobal.bankInterestTimer += 1

}

###################################

# BASIC FUNCTIONS #

###################################

#Function for Withdrawing Money from your Account

def pbWithdrawMoney

params=ChooseNumberParams.new

params.setRange(0, $PokemonGlobal.bankAccountBalance)

params.setInitialValue( $PokemonGlobal.bankAccountBalance)

params.setCancelValue(0)

qty=Kernel.pbMessageChooseNumber(

_INTL("\\bHow much do you want to withdraw?"),params

)

if qty>0

$Trainer.money+=qty

$PokemonGlobal.bankAccountBalance-=qty

Kernel.pbMessage(_INTL("\\b${1} was withdrawn.",qty))

Kernel.pbMessage(_INTL("\\bYou now have ${1} in your account.", $PokemonGlobal.bankAccountBalance))

else

Kernel.pbMessage(_INTL("\\bNo money was withdrawn."))

end

end

#Function for Depositing Money into Account

def pbDepositMoney

params=ChooseNumberParams.new

params.setRange(0,$Trainer.money)

params.setInitialValue(0)

params.setCancelValue(0)

qty=Kernel.pbMessageChooseNumber(

_INTL("\\bHow much do you want to deposit?"),params

)

if qty>0

$Trainer.money-=qty

$PokemonGlobal.bankAccountBalance+=qty

Kernel.pbMessage(_INTL("\\b${1} was deposited.",qty))

Kernel.pbMessage(_INTL("\\bYou now have ${1} in your account.", $PokemonGlobal.bankAccountBalance))

else

Kernel.pbMessage(_INTL("\\bNothing was deposited."))

end

end

#Tells you how much you have in your Account

def pbViewMoney

Kernel.pbMessage(_INTL("\\bYou currently have ${1} in your account.", $PokemonGlobal.bankAccountBalance))

end

###################################

# INTEREST #

###################################

#Sets Steps that Player has taken to Zero

def pbSetupAccount

$PokemonGlobal.bankInterestTimer=0

$PokemonGlobal.bankAccountBalance=0

$PokemonGlobal.bankAccountType=1

$PokemonGlobal.bankInterestTotal=0

end

#Tells you how many steps you have taken

def pbCheckInterestTimer

steps = $PokemonGlobal.bankInterestTimer

Kernel.pbMessage(_INTL("\\bYou have taken {1} steps.",steps))

end

#Tells you how much you've made off interest

def pbInterestEarned

total= $PokemonGlobal.bankInterestTotal

Kernel.pbMessage(_INTL("\\bYou've made ${1} from your interest rate!",total))

end

#Calculates and Adds Interest into Account

def pbCalcInterest

if $PokemonGlobal.bankAccountType == 1

a = $PokemonGlobal.bankInterestTimer/500

$PokemonGlobal.bankInterestTimer -= a*500

a = a * 5

$PokemonGlobal.bankAccountBalance+=a

elsif $PokemonGlobal.bankAccountType == 2

a = $PokemonGlobal.bankInterestTimer/500

$PokemonGlobal.bankInterestTimer -= a*500

a = a * 15

$PokemonGlobal.bankAccountBalance+=a

elsif$PokemonGlobal.bankAccountType == 3

a = $PokemonGlobal.bankInterestTimer/500

$PokemonGlobal.bankInterestTimer -= a*500

a = a *30

$PokemonGlobal.bankAccountBalance+=a

else

a = $PokemonGlobal.bankInterestTimer/500

$PokemonGlobal.bankInterestTimer -= a*500

a= a *50

$PokemonGlobal.bankAccountBalance+=a

end

end

###################################

# DAYS WITH ACCOUNT #

###################################

#pbDayCountAccount = counts how many days you've had that specific account

#pbDayCountTotal = counts how many days you've had an account