[PYHTON]Script fehler ??

12/24/2012 02:37 EngelEatos#1
hallo, ich hab diesen code in die game.py eingefügt:

Code:
onPressKeyDict[app.DIK_F7] = lambda : self.__Autopotter()
&

Code:
#hp rot
        maxHP = int(player.GetStatus(player.MAX_HP))
        HP = int(player.GetStatus(player.HP))
        curPoint = min(HP, maxHP)
        curPoint = max(HP, 0)
        maxPoint = max(maxHP, 0)
        #Tränke nehmen
        if (float(curPoint) / max(1, float(maxPoint)) * 100) < iPotionR:
            for eachSlot in xrange(player.INVENTORY_PAGE_SIZE):
                itemVNum = player.GetItemIndex(eachSlot)
                if itemVNum == 91024 or itemVNum == 91023
                    net.SendItemUsePacket(eachSlot)
                    break
syserr.txt

Code:
1224 02:28:06791 :: SkillDesc.line(68).NO_INDEX_ERROR

1224 02:28:06972 :: 
networkModule.py(line:194) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:27) ?
system.py(line:130) __pack_import
system.py(line:110) _process_result
interfaceModule.py(line:26) ?
system.py(line:130) __pack_import
system.py(line:110) _process_result
uiRestart.py(line:4) ?
system.py(line:130) __pack_import

networkModule.SetSelectCharacterPhase - exceptions.IndentationError:expected an indented block (line 459)

1224 02:28:06972 :: ============================================================================================================
1224 02:28:06972 :: Abort!!!!
hoffe jmd kann helfen

Ps: im anhang oder [Only registered and activated users can see links. Click Here To Register...] sind alle in der syserr genannten dateien
12/24/2012 09:54 [Patrick]#2
Versuch das mal, hab das aber nicht getestet.;)
12/24/2012 09:55 'ChuckNorris#3
Scheint so das du die Einrückung nicht eingehalten hast schau mal ob das wirklich tabs sind und nicht leerzeichen
12/24/2012 12:29 EngelEatos#4
Quote:
Originally Posted by [Patrick] View Post
Versuch das mal, hab das aber nicht getestet.;)
habe es mit deiner version versuche funktioniert aber auch nicht^^

gleiche sysrr

@Yissu:
bei Patricks variante müssten die Tabs stimmen^^, funktioniert aber trotzdem nicht:

HTML Code:
def Autopotter(self):
[TAB][TAB]#hp rot
[TAB][TAB]maxHP = int(player.GetStatus(player.MAX_HP))
[TAB][TAB]HP = int(player.GetStatus(player.HP))
[TAB][TAB]curPoint = min(HP, maxHP)
[TAB][TAB]curPoint = max(HP, 0)
[TAB][TAB]maxPoint = max(maxHP, 0)
[TAB][TAB]#Tränke nehmen
[TAB][TAB]if (float(curPoint) / max(1, float(maxPoint)) * 100) < iPotionR:
[TAB][TAB][TAB] for eachSlot in xrange(player.INVENTORY_PAGE_SIZE):
[TAB][TAB][TAB][TAB]itemVNum = player.GetItemIndex(eachSlot)
[TAB][TAB][TAB][TAB]if[TAB]itemVnum[TAB]==	[TAB]91024[TAB]or[TAB]itemVnum[TAB]==[TAB]91023
[TAB][TAB][TAB][TAB][TAB]net.SendItemUsePacket(eachSlot)
[TAB][TAB][TAB][TAB][TAB]break
12/24/2012 12:35 .United#5
Code:
onPressKeyDict[app.DIK_F7] = lambda : self.__Autopotter() 


def __Autopotter(self):
      maxHP = int(player.GetStatus(player.MAX_HP))
      HP = int(player.GetStatus(player.HP))
      curPoint = min(HP, maxHP)
      curPoint = max(HP, 0)
      maxPoint = max(maxHP, 0)
      if (float(curPoint) / max(1, float(maxPoint)) * 100) < iPotionR:
          for eachSlot in xrange(player.INVENTORY_PAGE_SIZE):
              itemVNum = player.GetItemIndex(eachSlot)
              if itemVNum == 91024 or itemVNum == 91023
                  net.SendItemUsePacket(eachSlot)
                  break
Finde ausserdem iPotionR nirgends, muss irgendwo deklariert sein.
Wichtig ist, das du wie im vorherigen Beitrag mit Tabs arbeitest und nicht mit Leerzeichen ;)
12/25/2012 18:27 EngelEatos#6
Quote:
Originally Posted by .United View Post
Code:
onPressKeyDict[app.DIK_F7] = lambda : self.__Autopotter() 


def __Autopotter(self):
      maxHP = int(player.GetStatus(player.MAX_HP))
      HP = int(player.GetStatus(player.HP))
      curPoint = min(HP, maxHP)
      curPoint = max(HP, 0)
      maxPoint = max(maxHP, 0)
      if (float(curPoint) / max(1, float(maxPoint)) * 100) < iPotionR:
          for eachSlot in xrange(player.INVENTORY_PAGE_SIZE):
              itemVNum = player.GetItemIndex(eachSlot)
              if itemVNum == 91024 or itemVNum == 91023
                  net.SendItemUsePacket(eachSlot)
                  break
Finde ausserdem iPotionR nirgends, muss irgendwo deklariert sein.
Wichtig ist, das du wie im vorherigen Beitrag mit Tabs arbeitest und nicht mit Leerzeichen ;)
was meinst du mit IPotionR?

ich hab das aus diesem thread übernommen: [Only registered and activated users can see links. Click Here To Register...]

das müsste doch stimmen, oder fehlt da noch was?

mfg
12/27/2012 14:05 EngelEatos#7
#
01/01/2013 01:10 EngelEatos#8
#
01/01/2013 01:49 CookieKing#9
Quote:
Originally Posted by EngelEatos View Post

Code:
#hp rot
        maxHP = int(player.GetStatus(player.MAX_HP))
        HP = int(player.GetStatus(player.HP))
        curPoint = min(HP, maxHP)
        curPoint = max(HP, 0)
        maxPoint = max(maxHP, 0)
        #Tränke nehmen
        if (float(curPoint) / max(1, float(maxPoint)) * 100) < iPotionR:
            for eachSlot in xrange(player.INVENTORY_PAGE_SIZE):
                itemVNum = player.GetItemIndex(eachSlot)
                if itemVNum == 91024 or itemVNum == 91023
                    net.SendItemUsePacket(eachSlot)
                    break
Hab es nur mal schnell überflogen, aber hier fehlt auf jeden fall schon mal ein Doppelpunkt
Code:
if itemVNum == 91024 or itemVNum == 91023
Code:
if itemVNum == 91024 or itemVNum == 91023[COLOR="Red"]:[/COLOR]
mfg & happy new year