By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,715 Members | 748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,715 IT Pros & Developers. It's quick & easy.

RPG Info and Questions

P: 7
Hello Everyone again,
I am having a bit of trouble figuring out how I am going to get this to work. First off I am running windows xp, and yes this is a homework problem so what ever anyone show me or any hints given will be completely changed by me so as to not let it be considered cheating.
So far I have a program that doesn't work so I am post in here.
Expand|Select|Wrap|Line Numbers
  1. print " Welcome to the RPG"
  2. print " You have 30 points to spend to help make your charecter stronger"
  3. print "choose to spend your points on Strength, Dexterity, Wisdom,and Health"
  4. print "You only have thirty points so choose wisely"
  5.  
  6. answer=raw_input "What do you want to add points to first"
  7.     if answer="Dexterity"
  8.     dex=raw_input "how many points should we add to Dexterity?"
  9.     print "you now have," dex "points for Decterity"
  10.  
  11.     if answer="Strength"
  12.     strength=raw_input "how many points should we add to strength?"
  13.     print "you now have," strength "points for Decterity"
  14.  
  15.     if answer="Wisdom"
  16.     wisdom=raw_input "how many points should we add to wisdom?"
  17.     print "you now have," wisdom "points for Decterity"
  18.  
  19.     if answer="Health"
  20.     health=raw_input "how many points should we add to health?"
  21.     print "you now have," health "points for health"
  22.  
  23.  
  24. print "you now have," health " points for health"
  25. print "you now have," strength " points for strength"
  26. print "you now have," wisdom " points for wisdom"
  27. print "you now have," dexterity " points for dexterity"
  28.  
  29.  
  30. exit game
  31.  
I am getting syntax errors, which I am getting more and more used to it seems, but this gives eveyone an idea of what I am going for! thanks for any help that you can give!
Nov 20 '06 #1
Share this Question
Share on Google+
3 Replies


P: 7
I found something that helped alot actually, so this tag is going to be closed after all, but I am going to post what I have so others can see it!


Expand|Select|Wrap|Line Numbers
  1. # your-name
  2. # Creating a RPG program that allows the user to creats a stat sheet
  3. # 11-16-06
  4.  
  5.  
  6. points = 30
  7. Exit = 0
  8. health = 0
  9. strength = 0
  10. wisdom = 0
  11. dex = 0
  12.  
  13. print " Welcome to the RPG"
  14. print " You have", points, "points to spend to help make your charecter stronger"
  15. print "choose to spend your points on Strength, Dexterity, Wisdom,and Health"
  16. print "You only have thirty points so choose wisely"
  17.  
  18. def Menu():
  19.     print """Choose Stat to add points to:
  20.     1. Dexterity
  21.     2. Strength
  22.     3. Wisdom
  23.     4. Health
  24.     5. Stats
  25.     0. Exit
  26.     """
  27.  
  28.     answer = raw_input("What do you want to add points to first: ")
  29.  
  30.     return int(answer)
  31.  
  32. def AddHea():
  33.     global health
  34.     global points
  35.  
  36.     add = raw_input ("how many points should we add to health?")
  37.  
  38.     if (health + int(add) < 0):
  39.         print "You can not remove points that you dont have... Bastard\n"
  40.     elif (points - int(add) > 0):
  41.         health = health + int(add)
  42.         points = points - int(add)
  43.     else:
  44.         print "You do not have enough points\n"
  45.  
  46.     print "you now have,", health, "points for health"
  47.     print "you now have,", points, "points remaining\n"
  48.  
  49. def AddDex():
  50.     global dex
  51.     global points
  52.  
  53.     add = raw_input ("how many points should we add to dexterity?")
  54.  
  55.  
  56.     if (dex + int(add) < 0):
  57.         print "You can not remove points that you dont have... come on, what do you take me for?\n"
  58.     elif (points - int(add) > 0):
  59.         dex = dex + int(add)
  60.         points = points - int(add)
  61.     else:
  62.         print "You do not have enough points\n"
  63.  
  64.     print "you now have,", dex, "points for dexterity"
  65.     print "you now have,", points, "points remaining\n"
  66.  
  67. def AddStr():
  68.     global strength
  69.     global points
  70.  
  71.     add = raw_input ("how many points should we add to strength?")
  72.  
  73.  
  74.     if (strength + int(add) < 0):
  75.         print "You can not remove points that you dont have... come on, what do you take me for?\n"
  76.     elif (points - int(add) > 0):
  77.         strength = strength + int(add)
  78.         points = points - int(add)
  79.     else:
  80.         print "You do not have enough points\n"
  81.     print "you now have,", strength, "points for strength"
  82.     print "you now have,", points, "points remaining\n"
  83.  
  84. def AddWis():
  85.     global wisdom
  86.     global points
  87.  
  88.     add = raw_input ("how many points should we add to wisdom?")
  89.  
  90.     if (wisdom + int(add) < 0):
  91.         print "You can not remove points that you dont have... come on, what do you take me for?\n"
  92.     elif (points - int(add) > 0):
  93.         wisdom = wisdom + int(add)
  94.         points = points - int(add)
  95.     else:
  96.         print "You do not have enough points\n"
  97.     print "you now have,", wisdom, "points for wisdom"
  98.     print "you now have,", points, "points remaining\n"
  99.  
  100.  
  101. def Stats():
  102.     global health
  103.     global dex
  104.     global strength
  105.     global wisdom
  106.  
  107.     print "you now have,", health, " points for health"
  108.     print "you now have,", strength, " points for strength"
  109.     print "you now have,", wisdom, " points for wisdom"
  110.     print "you now have,", dex, " points for dexterity\n\n"
  111.  
  112.  
  113. while (not Exit):
  114.     choice = Menu()
  115.  
  116.     if (choice == 1):
  117.         AddDex()
  118.         Stats()
  119.     elif (choice == 2):
  120.         AddStr()
  121.         Stats()
  122.     elif (choice == 3):
  123.         AddWis()
  124.         Stats()
  125.     elif (choice == 4):
  126.         AddHea()
  127.         Stats()
  128.     elif (choice == 5):
  129.         Stats()
  130.     elif (choice == 0):
  131.         Exit = 1
  132.     else:
  133.         print "Invalid Choice"
  134.  
  135.  
  136.  
  137.  
  138.  
  139. raw_input("\nPress Enter to Exit")
  140.  
  141.  
Nov 20 '06 #2

bartonc
Expert 5K+
P: 6,596
Looks like you are on your way! Your ability to solve problems and your posts in this forum show that you are a natural. Keep it up and keep posting,

Barton
Nov 20 '06 #3

P: 7
thanks Barton, trying my best!!! :)
Nov 21 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.