Python error, can't solve

For questions about using Classic.

Post » Tue Aug 05, 2014 11:11 am

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) :
Code: Select all
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")


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: Select all
---------------------------
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   
---------------------------


Has anyone an idea of how to fix this :( ?

Thanks in advance :D
Regards, player.elite
B
7
S
1
Posts: 58
Reputation: 683

Post » Tue Aug 05, 2014 1:41 pm

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 )
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
120
S
41
G
17
Posts: 2,214
Reputation: 19,665

Post » Tue Aug 05, 2014 2:21 pm

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...
B
7
S
1
Posts: 58
Reputation: 683

Post » Tue Aug 05, 2014 2:30 pm

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?)
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
120
S
41
G
17
Posts: 2,214
Reputation: 19,665

Post » Tue Aug 05, 2014 2:49 pm

Yes ofc :p
B
7
S
1
Posts: 58
Reputation: 683

Post » Wed Aug 06, 2014 9:55 am

Unfortunately that's about as deep as my Python knowledge goes sorry :( Hopefully someone else can stop in and check this out!
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
120
S
41
G
17
Posts: 2,214
Reputation: 19,665

Post » Wed Aug 06, 2014 10:07 am

I think this was a problem in my code (maybe the fact my Sprite is called "object" ?). I recoded everything and now it works :)
B
7
S
1
Posts: 58
Reputation: 683


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest