0 Favourites

Python EOL Error on leveleditor

This forum is currently in read-only mode.
  • I need an external python file because I'm making a leveleditor where people can change things.

    I use CreateByName to load objects and substrings for their position, layer etc.

    I have a few questions:

    1. Why can I not use \ on the end but I have to load it in "textman" wich is a rename from Textmanipulator? (EOL error)

    2. Why can't I insert the 3d box object in my application if this script is executed? (EOL error) <img src="smileys/smiley7.gif" border="0" align="middle" /> <img src="smileys/smiley3.gif" border="0" align="middle" />

    I don't know much about python.

    <img src="smileys/smiley19.gif" border="0" align="middle" />

    ---

    path = System.apppath+"Data\Levels";

    file = "level1"

    ext = "txt"

    if ListBox.GetCount == 0:

    textman.SetString("\ ")

    ListBox.Load(path+textman.GetLeft(1)+file+"."+ext)

    l = 1

    for i in range(0, ListBox.GetCount+1):

    if i <= ListBox.GetCount+1:

    if l == 1:

       textman.SetString(ListBox.LineText(i))

       # sub string 1 to 4 (name, layer, xPos, yPos)

       System.CreateByName(textman.GetSubstring("'",1),textman.GetSubstring("'",2),textman.GetSubstring("'",3),textman.GetSubstring("'",4))

    if i == ListBox.GetCount:

    if l == 1:

       msgbox.SetIcon(1)

       textman.SetString(file)

       textman.Uppercase()

       msgbox.MessageBoxID("File Loaded",textman.GetString+" Sucessfully Loaded", 1)

       l = 0

       break

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Python always checks for escape sequences, which start with a backslash (e.g. \n for newline). To be able to use the backslash as a char just double it (e.g. "myfolder" + "\\", becomes "myfolder\").

  • Python always checks for escape sequences, which start with a backslash (e.g. \n for newline). To be able to use the backslash as a char just double it (e.g. "myfolder" + "\\", becomes "myfolder\"). <img src="smileys/smiley4.gif" border="0" align="middle" /> It works perfectly. I thank you for that.

    But now, when I add a 3D box to the canvas, i get this error:

    --

    File "<string>", line 739

    class 3DBoxInstance:

        ^

    SyntaxError: invalid Syntax.

    and

    --

    Trackeback (most recent call last):

    File "<string>", line 1, in <module>

    NameError: name 'System' is not defined

  • You need to rename the 3dbox object so it's name does not start with a number.

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