Python broken in a project (fixed)

This forum is currently in read-only mode.
From the Asset Store
With this template you can create your own archer game and customize it however you want.
  • So it appears that Python is broken in a project I'm working on. I enabled scripting, and upon startup, I receive the following error message:

    File "<string>", line 2037
    class 360Instance:
         ^
    SyntaxError: invalid syntax[/code:2q97tc4w]
    
    To clarify: I don't have anywhere near 2037 lines of Python in my project. Neither I have anything that would even remotely resemble class 360. I believe this is from Construct's internal Python code or something along the lines of that.
    
    Anyway, after that, whenever I try to refer to any Construct objects in Python code, it gives an error like this:
    
    [code:2q97tc4w]Traceback (most recent call last):
    File "<string>", line 30, in <module>
    NameError: name 'System' is not defined[/code:2q97tc4w]
    
    Of course, the line number and name varies. No reference at any place works. Meanwhile, in other caps, everything works just fine and dandy. Everything Python that doesn't refer to Construct objects works just fine.
    
    This is a serious showstopper for the project, since I really need Python and being unable to refer to anything means that I'm not able to do much with it. Any ideas how to fix this?
  • Do you have an object named "360"? If so you need to rename it so it doesn't start with a digit and it should work. Construct generates it's own python script on startup that builds an interface for each object, thus the 1027 lines.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I did, and renaming it fixed the problem! You, sir, are a lifesaver. Honestly.

  • How did you name an object "360"? Construct should prevent you giving objects names which are numbers, or starting with numbers, because it means you can't tell object names apart from numbers in expressions.

  • Don't know if this is the correct thread to be posting this in but anyway. The game I'm working on utilizes python scripting and for some odd reason when I have added a binary file to one of my Layouts the game suddenly stops working in the means of stuff in my python code doesn't work.

    For instance I get the File "<string>", line xxxx def Get cursor position(self): SyntaxError: invalid syntax

    and: Traceback (most recent call last): File "<string>", line 2, in <module> NameError: name "Sword" is not defined.

    The "Sword" is a sprite. But when I remove the binary file object that I added to one of the layouts the problem goes away? Is this a bug I should report or is it known to happen that way?

    Cheers!

    P.S

    I'm using Construct v0.99.84 (unstable)

    Python version 2.6.5

  • Construct should prevent you giving objects names which are numbers, or starting with numbers, because it means you can't tell object names apart from numbers in expressions.

    oes this refer to objects only or function names, too?

  • How did you name an object "360"? Construct should prevent you giving objects names which are numbers, or starting with numbers, because it means you can't tell object names apart from numbers in expressions.

    Well, I just made an Xbox 360 Controller object, and renamed it 360. From the looks of it, I can rename anything to any number, though. Like renaming a gradient to 303882 works.

  • 1146Ullman

    That is a known problem. The solution is not to use the binary object when using python. It's no loss because python can do everything the binary object can do and more.

  • Good to know

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