Python Forum
Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RPG game trouble
#2
Variables have scope. Within the scope of the battle function, you have not defined lair_enemy. The best way to do this is to pass a parameter to the function:
def test(arg):
    print(arg)
test(801)
Now, you define lair_enemy in your home function, so you will need to pass it as a parameter to the question function, and then have the question function pass it to the battle function. For more details, check out the function tutorial in my signature below.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RPG game trouble - by J125 - Apr-08-2017, 05:38 PM
RE: RPG game trouble - by ichabod801 - Apr-08-2017, 06:04 PM
RE: RPG game trouble - by J125 - Apr-17-2017, 11:43 AM
RE: RPG game trouble - by ichabod801 - Apr-18-2017, 01:20 AM
RE: RPG game trouble - by J125 - Apr-20-2017, 10:25 AM
RE: RPG game trouble - by Kebap - Apr-20-2017, 05:21 PM
RE: RPG game trouble - by J125 - Apr-24-2017, 11:38 AM
RE: RPG game trouble - by nilamo - Apr-29-2017, 04:42 PM
RE: RPG game trouble - by J125 - May-03-2017, 08:34 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020