Someone can help me? script error

    Share

    torsello

    Posts : 50
    Join date : 2015-08-18

    Someone can help me? script error

    Post  torsello on 21st August 2015, 07:58

    Hi friends, im working on a subclass npc, but i have this errors, someone knows what it is? or how can fix it? Thanks and sorry for my bad english.



    The code is too long, this is the file _init_.py:
    https://mega.nz/#!TAFDjTpY!lgAcg3NMlxZTgpUN7hwsTm2FsG0O2Rd_GJsf0yKb56w


    Last edited by torsello on 23rd August 2015, 07:32; edited 1 time in total

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: Someone can help me? script error

    Post  DnR on 21st August 2015, 16:48

    Hello,

    I noticed you put an argument in every new connection, while you should not.
    Replace "getConnection(None)" with "getConnection()".
    That solves one problem.

    torsello

    Posts : 50
    Join date : 2015-08-18

    Re: Someone can help me? script error

    Post  torsello on 21st August 2015, 23:28

    Thanks DnR, i correct it, now i can choose the subclass, but when i choose it apears that error:



    If i could correct it, im going to upload for contributions Smile
    And what i have to do if i dont want to reset players skills? may be its a solution

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: Someone can help me? script error

    Post  DnR on 22nd August 2015, 16:12

    Replace "sendSkillList()" with "getSkillList()".
    That's how it's named in this project.

    torsello

    Posts : 50
    Join date : 2015-08-18

    Re: Someone can help me? script error

    Post  torsello on 22nd August 2015, 19:46

    DnR wrote:Replace "sendSkillList()" with "getSkillList()".
    That's how it's named in this project.
    Thanks DnR you are the best, now i can do subclass, but the only problem is that dont low the player lvl, and apears that on Gameserver Console. I dont want to reset skills, so if any of this is because resetskills dont pay attention, i only want to low the player lvl.



    Thanks !! we are close Smile

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: Someone can help me? script error

    Post  DnR on 23rd August 2015, 00:49

    Looks like you have an open connection.

    I suspect this part causes the problem.

    Code:

    try : conn.close()
    except : pass

    Method close() might be more efficient outside "if" bounds.
    So make the beginning of these lines parallel with the beginning of "if" lines.

    I try to explain this as simply as possible.
    Please let me know.
    Code:

    def resetskills(st):
       parametros = ""-1""; j=-1
       subs=getVarcharactersubs(st)
       SubSplit = subs.split(" ")
       for k in range(maxsubsindb + 1):
          conn=L2DatabaseFactory.getInstance().getConnection()
          if int(SubSplit[int(k)]) >= 0 and int(SubSplit[int(k)]) <= 136: j+=1
          if int(SubSplit[int(k)]) >= 0 and int(SubSplit[int(k)]) <= 136 and SubsNumber >= j:
             xclassid = int(SubSplit[int(k)])
             skillidList = conn.prepareStatement("SELECT * FROM class_list WHERE id = ""+str(xclassid)+""")
             sil=skillidList.executeQuery()
             while (sil.next()) :
                try :
                   parametros+=","" +str(xclassid)+ """
                   xclassid = sil.getInt("parent_id")
                   skillidList = conn.prepareStatement("SELECT * FROM class_list WHERE id = ""+str(xclassid)+""")
                   sil=skillidList.executeQuery()
                except : pass
                    try : conn.close()
                    except : pass   

    torsello

    Posts : 50
    Join date : 2015-08-18

    Re: Someone can help me? script error

    Post  torsello on 23rd August 2015, 01:45

    mmm i cant understand very well, can you paste me the correction? i do this:

    Code:
    def resetskills(st):
       parametros = ""-1""; j=-1
       subs=getVarcharactersubs(st)
       SubSplit = subs.split(" ")
       for k in range(maxsubsindb + 1):
          conn=L2DatabaseFactory.getInstance().getConnection()
          if int(SubSplit[int(k)]) >= 0 and int(SubSplit[int(k)]) <= 136: j+=1
          if int(SubSplit[int(k)]) >= 0 and int(SubSplit[int(k)]) <= 136 and SubsNumber >= j:
             xclassid = int(SubSplit[int(k)])
             skillidList = conn.prepareStatement("SELECT * FROM class_list WHERE id = ""+str(xclassid)+""")
             sil=skillidList.executeQuery()
             while (sil.next()) :
                try :
                   parametros+=","" +str(xclassid)+ """
                   xclassid = sil.getInt("parent_id")
                   skillidList = conn.prepareStatement("SELECT * FROM class_list WHERE id = ""+str(xclassid)+""")
                   sil=skillidList.executeQuery()
                except : pass
             try: conn.close()
             except : pass
       conn.close() //THIS AND
       pass   //THIS
    The error on console has disapeared, but the lvl stay at 75 :s

    torsello

    Posts : 50
    Join date : 2015-08-18

    Re: Someone can help me? script error

    Post  torsello on 23rd August 2015, 06:18

    Thanks a lot DnR!!!, now its running!! Very Happy

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: Someone can help me? script error

    Post  DnR on 23rd August 2015, 11:25

    It should be like this:

    Code:

    def resetskills(st):
      parametros = ""-1""; j=-1
      subs=getVarcharactersubs(st)
      SubSplit = subs.split(" ")
      for k in range(maxsubsindb + 1):
          conn=L2DatabaseFactory.getInstance().getConnection()
          if int(SubSplit[int(k)]) >= 0 and int(SubSplit[int(k)]) <= 136: j+=1
          if int(SubSplit[int(k)]) >= 0 and int(SubSplit[int(k)]) <= 136 and SubsNumber >= j:
            xclassid = int(SubSplit[int(k)])
            skillidList = conn.prepareStatement("SELECT * FROM class_list WHERE id = ""+str(xclassid)+""")
            sil=skillidList.executeQuery()
            while (sil.next()) :
                try :
                  parametros+=","" +str(xclassid)+ """
                  xclassid = sil.getInt("parent_id")
                  skillidList = conn.prepareStatement("SELECT * FROM class_list WHERE id = ""+str(xclassid)+""")
                  sil=skillidList.executeQuery()
                except : pass
          try: conn.close()
          except : pass

    torsello

    Posts : 50
    Join date : 2015-08-18

    Re: Someone can help me? script error

    Post  torsello on 23rd August 2015, 21:26

    Thanks DnR! Smile, Its Running

    Sponsored content

    Re: Someone can help me? script error

    Post  Sponsored content


      Current date/time is 28th July 2017, 18:04