|Don't ask to ask, just ask|
Re: Help making simple RPG game less boringby jethro (Monsignor)
|on Oct 30, 2012 at 13:22 UTC||Need Help??|
You don't have a single subroutine in your script. I have coded lots of simple scripts without subroutines or modularisation, but even a simple game should be so complex that it becomes impossible to manage without some abstraction and structure.
For example, make a subroutine that does the monster selection. The subroutine should be called with the parameters $lvl and possibly location type (so that wild pigs are only encountered in forests, Mothers-in-Law only in towns). Also not every location should have a monster
Make a subroutine that is called whenever the player moves into a new location. It should select and print what the location is (hill, road, forest, town) and return the location type. Maybe add some special events that can happen
Make a subroutine that asks the player what to do when he enters a location without a monster. Possible things to do: Heal, select a different weapon, search the area, goto next location
Make a subroutine for fighting monsters. This subroutine should ask the player each round what to do (attack, change weapon, run away, make a special attack (more damage, but less defense on the counter attack of the monster), heal ...) and resolve that. Don't hesitate to put each action the player can do in its own subroutine.
Try to give each subroutine everything it needs as a parameter. Your main script should essentially be a few subroutine calls that show the structure of the game.
If you have done that your script has become more maintainable and your game is probably a bit more fun.
UPDATE: I forgot the usability hint: Don't let the player enter 1,2,3... to select the options, attack should be 'a' not '1'.