# Rpg code updating

**URL:** https://forum.kirupa.com/t/rpg-code-updating/208790
**Category:** Uncategorized
**Created:** [December 2, 2006, 5:09pm UTC](https://forum.kirupa.com/t/rpg-code-updating/208790 "2006-12-02T17:09:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![oicu812](https://avatars.discourse-cdn.com/v4/letter/o/f475e1/32.png) [@oicu812](https://forum.kirupa.com/u/oicu812)
#### Post date: [December 2, 2006, 5:09pm UTC](https://forum.kirupa.com/t/rpg-code-updating/208790/1 "2006-12-02T17:09:52Z")

</div>

I havent loaded up flash in awhile, and decided recently to recode my rpg using AS3. My rpg was done using Macromedia Flash 4, so my code may look alittle primitive lol. Im wanting some insight on which AS3 code would be most effecient by example. I assume by looking at other posts you no longer need to use \_root. infront of everything. Some formulas are listed below, just wanting AS3 examples of them.

## Ingame Bank Code Snippet

//bank talky snippet

\_root.txt = “Welcome, how may I help you today?”

//bank deposit button formula snippet

on(release){  
\_root.BankGP = \_root.BankGP + \_root.DepositAmt  
\_root.GP = \_root.GP - \_root.DepositAmt  
\_root.txt = “Your current balance is” + \_root.BankGP + “gold.”  
}

//bank withdraw button formula snippet

on(release){  
\_root.BankGP = \_root.BankGP - \_root.WithdrawAmt  
\_root.GP = \_root.GP + \_root.WithdrawAmt  
\_root.txt = “Your current balance is” + \_root.BankGP + “gold.”  
}

* * *

## Inn code snippet

InnCost = 5

//Inn talky snippet  
\_root.txt = “Hello, rooms are 5 gold. Would you like to stay?”

//Inn stay button snippet  
on(release){  
\_root.HP = \_root.MaxHP  
\_root.MP = \_root.MaxMP  
\_root.GP = \_root.GP - \_root.InnCost  
\_root.txt = “Please come again.”  
}

## //Inn leave button snippet on(release){ \_root.txt = “Have a nice day.” \_root.gotoAndPlay(1); }

## Like I said code probably looks primitive compared to AS used today, I have Flash 9 on order and was just looking for few examples in AS3 so my game would be more effecient code wise and I assume less lines of code which would reduce my file size. any examples would be greatly appreciated so I could convert my other systems to AS3…

## List of systems in my rpg

## bank system battle system character system event system guild system inventory system (text based) levelup system monster system party system quest system store system talk system timed event system

## list of systems planned

## crafting system house system inventory system (gui based) loot system mail system

## list of graphical work in my rpg (all graphics by me using mspaint)

## sprites - hero sprites - items sprites - monster sprites - npc tiles - worldmap tiles - towns tiles - caves tiles - dungeons windows - all shops, etc

offline rpg atm but reading a good book on XML and thinking of weaving AS3 with XML and maybe PHP to create an online version. Its actually a good read, but uses AS2 anyway book is “XML in Flash, ISBN 0-672-32315-X”.
