System.CreateObject

This forum is currently in read-only mode.
  • System.CreateObject(LGPGuiWindowProfile,0,400,300)[/code:1ux2mmzi]
    Gives me the error "NoneType object is not callable"
  • Hmm, is that the "create object by name" expression? I'm guessing you might have to put the object name into quotation marks (" ").

    Just a wild guess. Don't kill me if it doesn't work

  • Yeah you'd need to put quotations round the object name you want to create.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Still happens. I've tried all the create object functions, no go. Same error message for all of them.

  • Same problem for me, and i don't know how to figure out.

  • Did anyone get this working? I want to create a sprite dynamically from Python but I'm getting the same error as Zack0.

    I have a sprite object on the layout named Sprite.

    In Python I have the following code - System.CreateObject(Sprite, 1, 50, 50)

    I've also tried - spr = System.CreateObject(Sprite, 1, 50, 50) , in case it returns the object created or something. I've even tried CreateObjectByName with quotations.. nothing works. Any ideas?

  • I've never been able to get it to work. What I do instead is make a Function object that calls CreateObjectByName and then call the function from Python.

  • You need to remove "Object" from it. So it would be for example:

    System.Create("Sprite",1,50,50)[/code:2hafnbcs]
  • Was just about to reply to JUK saying his method wasn't working and noticed ROJO's, so thought I'd give that a try before I replied. IT WORKED! Nice one man. Bit weird that it's Create(), as that's not listed in the Functions list box on the right in the Python editor. Ah well..

    Cheers for replying too JUK. Would still like to know your method as I'd probably find it useful to call a Construct Function from within Python... nothing I tried worked.

    eg. Construct -> On Function "blah"

    Python -> blah()

    Doesn't work..

  • All the create functions are incorrectly listed:

    System.CreateObject -> System.Create

    System.CreateObjectAtObject -> System.CreateAtObject

    System.CreateObjectByName -> System.CreateByName

    System.CreateObjectIP -> System.CreateIP

    As to calling a construct function from python you would do something like this:

    Function.ClearParams()
    Function.AddParam(50)
    Function.Call("blah",0)[/code:3nywgwkf]
  • Aha! I knew it'd be so obvious I'd kick myself! Nice one again mate!

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