Python error, can't solve

This forum is currently in read-only mode.
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • Hello,

    I am currently working on a new project and I'm using python, the problem is that when I start the game, I have an error message and I don't have any idea of where it comes from.

    For the moment the game only have this code (and it works) :

    import os.path
    
    totalObjects = INI.ItemValue("objectsList", "objects")
    objects = 0
    line = 0
    lineObjects = 0
    
    while objects < totalObjects:
    	objects += 1
    	lineObjects += 1
    	if lineObjects > 5:
    		line += 1
    		lineObjects = 1
    	objx = (745 + ((lineObjects - 1)* 55))
    	objy = 105 + (line * 55)
    	System.CreateByName("object", 1, objx, objy)
    	SOL.object.SetValue("name", INI.ItemString("objectsList", objects))
    	if os.path.isfile(System.AppPath + "images/" + SOL.object.Value("name") + ".png"):
    		SOL.object.LoadFrameFromFile(System.AppPath + "images/" + SOL.object.Value("name") + ".png")
    	else:
    		SOL.object.LoadFrameFromFile(System.AppPath + "images/undefined.png")
    [/code:zdl4z7u6]
    
    But I get this when I start the game  (I click ok and then everything works fine, I mean, the code above do what he must do) :
    [code:zdl4z7u6]
    ---------------------------
    Error
    ---------------------------
    Traceback (most recent call last):
      File "<string>", line 1387, in <module>
    TypeError: Error when calling the metaclass bases
        __init__() takes exactly 1 argument (4 given)
    
    ---------------------------
    OK   
    ---------------------------
    [/code:zdl4z7u6]
    
    Has anyone an idea of how to fix this  ?
    
    Thanks in advance 
    Regards, player.elite
  • Hmm, maybe + is acting as an argument? I've not used Python much but checked out some other ways to join the strings together: http://stackoverflow.com/questions/4435 ... o-a-string

    Also, I think events would be faster for this task than Python, is there any specific reason you're using Python? (if you want events already made for that you can check out the source of my I Had Hope game: http://ihadhope.blogspot.ca/p/download.html )

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well I'll give a look

    The reason I'm doing this in python is that because the game will be 99% editable, I want to let users mod what they want using python (editing txt python file then they are executed by construct)

    Edit : another reason is that with python I can have temp variables and with events I'd have to create useless global variables...

    Edit 2 : String addition is not the reason, if I replace all my script by anything in python (example : print "hello") it shows me the error message too...

  • Ah good point and have you copied the Python 2.6 DLL from the Construct Classic directory to your export folder? (and told it to include Python in export?)

  • Yes ofc :p

  • Unfortunately that's about as deep as my Python knowledge goes sorry Hopefully someone else can stop in and check this out!

  • I think this was a problem in my code (maybe the fact my Sprite is called "object" ?). I recoded everything and now it works

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)