If your code&#39;s more than 10 lines long or so,  put it on <a href="http://pastebin.com">pastebin.com</a> and send us the link rather than inlining the whole thing.  You could also send it as an attachment.<div>Your formatting is all screwed up and I can&#39;t read the code at all, but I have an idea about your error.<br>
<div><br><div class="gmail_quote">On Wed, Sep 30, 2009 at 8:53 PM, Corey Richardson <span dir="ltr">&lt;<a href="mailto:kb1pkl@aim.com">kb1pkl@aim.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Here is my code that is being used/affected by the block that is erroring. The rest is superfluous, and does not affect it:<br>
<br>
   intel = 10  #Define the abilities.<br>
   strn = 10<br>
   con = 10<br>
   dex = 10<br>
   wis = 10<br>
   exp = 0<br>
   cha = 10<br>
   playHp = 20<br>
   melWep = 1 # A sword<br>
   rngWep = 1 #A bow<br>
   attack = dex+strn/2 #If they hit!<br>
   melDmg = strn+1+melWep/2 #Melee damage<br>
   deff = (con/3)+(dex/2)+6 #Defense<br>
   rngDmg = dex+1+rngWep/2 #Ranged damage<br>
   print &quot;You are hiking through the woods one day, and you are jumped<br>
   by a goblin!&quot; #The beginning of the adventure<br>
   print &quot;Do you want to 1. Attack w/sword, 2. Attack w/bow, 3. Flee,<br>
   or 4. Nothing&quot;<br>
   gob1Hp = 10 #First monsters hitpoints<br>
   def monsAttk (damage, attack,playHp): #A monsters attack         if attack &gt; deff:  #Monster hit             playHp -= damage #Player takes damage (I think...I will have<br>
   to work that out)<br>
           print &quot;You have sustained&quot;, damage, &quot;damage, with&quot;,<br>
   damage-playHp, &quot;remaining&quot; #Inform player of their status<br>
         def gmAttack(monHp, monDef, monAgil) :  #A player attack<br>
       op1 = raw_input(&quot;Your choice?&quot;)<br>
       while op1 != &quot;5&quot;:   #Just a loop that you can break out of<br>
   (possibly...working that out)             if op1 == &#39;1&#39;: #Option 1<br>
               if attack + 10  &gt; monDef : #If the player hits<br>
                   monHp-= melDmg  #Monster takes damage<br>
                   print &quot;you did&quot;, melDmg, &quot;damage! It now has&quot;,<br>
   monHp, &quot;health left!&quot; #Inform player how much health it has.<br>
                   monsAttk(4, 15) #Monster attacks             elif op1 == &#39;2&#39;: #Option 2                 if attack + 10 &gt;monDef: #If you hit the monster<br>
                   monHp -= rngDmg  #Monster takes damage<br>
                   print &quot;you did&quot;, rngDmg, &quot;damage! It now has&quot;,<br>
   monHp, &quot;health left!&quot;  #Inform player how much health it has                     monsAttk(4, 15) #Monster attacks<br>
           elif op1 == &#39;3&#39; : #Option 3<br>
               if attack + dex &gt; monAgil : #If they can escape                     print &quot;Thou hast fled!&quot; #They have fled!<br>
               break #Stop the loop (I think. Can someone please inform<br>
   me as of how this works? I have looked online...it makes no sense to me)<br>
           elif op1 == &#39;4&#39; : #Option 4...the dumb one<br>
               monsAttk(4, 15)  #Monster attacks<br>
               monsAttk(4,15) #Monster attacks again, cause they are dumb<br>
               print &quot;You should attack...&quot; #Inform them of their stupidity<br>
           else : #Well, what the hell did they pick?<br>
               print &quot;Unknown option, try again!&quot; #Inform them they<br>
   didn&#39;t pick a valid option<br>
   while gob1Hp &gt;= 0: #Well it is still alive<br>
       gmAttack(gob1Hp,13,15) #player attacks<br>
   if gob1Hp &lt;= 0.5 : #if it dies<br>
       print &quot;Gratz! You have gotten 5 exp! You only have&quot;, 100-exp,<br>
   &quot;exp left till lv 1!&quot; #print their experience<br>
       exp += 5 #Give them exp<br>
<br>
<br>
If you catch an error besides what is wrong, please don&#39;t point it out, as I would like to work it out myself, unless marked in the comments. But this one is evading me...I have playHp defined at the beginning, and I am getting this error :<br>

<br>
   Traceback (most recent call last):<br>
     File &quot;C:\Users\Quick-Start\Documents\Python Doc&#39;s\Game_File.py&quot;,<br>
   line 183, in &lt;module&gt;<br>
       gmAttack(gob1Hp,13,15)<br>
     File &quot;C:\Users\Quick-Start\Documents\Python Doc&#39;s\Game_File.py&quot;,<br>
   line 167, in gmAttack<br>
       monsAttk(4, 15)<br>
     File &quot;C:\Users\Quick-Start\Documents\Python Doc&#39;s\Game_File.py&quot;,<br>
   line 157, in monsAttk<br>
       playHp -= damage<br>
   UnboundLocalError: local variable &#39;playHp&#39; referenced before assignment<br>
<br>
If you could please help me, that would be great. I&#39;m just trying to get the game engine working, as of now, it is 30% done, with Inventory, Equipment, and a more sophisticated and simpler code to come. It&#39;s a bit of a mess now...<br>

<br>
<br>
<br>_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
<br></blockquote></div><br></div></div>