Saving Layouts?

This forum is currently in read-only mode.
0 favourites
From the Asset Store
Match the similar cards with each other and free all animals!
  • Actually I fixed it. The problem was I had no edit box... which I didn't realize until I deleted the one layout with an edit box (which gave me a different error which helped me realize I need to remove that one line of code). So it works! Besides the family stuff, but that's a good sign.

    If I try and use the same family I get...

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

    File "<string>", line 9, in save

    TypeError: 'function' object is not iterable

    or like

    TypeError: 'NoneType' object is not callable or something like that which might have to do with things in other layouts? Not sure.

    Edit: Another major issue seems to be that the other instances of an object don 't seem to actually exist? So for example, take your cap and set it so sprite rotates slowly... So then you'll have 3 spinning boxs, but once the load happens, only one of them will spin.

  • Yeah, the python errors are kind of obscure in Construct, for one the line numbers are way off. That "NoneType' object is not callable" usually means that object doesn't exist.

    The function is not iterable error and probably some others could be if the object names conflict with the python names.

    A cap could help me knock out a few of the bugs. I'll have time tomorrow.

    That last major problem intrigues me, probably some issues with my load function.

  • http://kayin.moe/forrojo.cap is a stripped down cap where the issue still happens. The iteration error I think is because I named my family "save" >_> Maybe not the best call.

  • Ah, so I guess families don't work then. Well they do partially but they're setup differently so we get that object is no callable error. Basically it's some issues with the runtimes source itself, and let's say I'm purposely avoiding going that route to avoid a myriad of errors because compiling with a different compiler introduces too many issues. Most of which I was never able to solve.

    So I guess just listing all the object types would work though, barring any other gotchas.

    It's quite the Pandora's box. The work needed to work around stuff or even trying to fix the source itself quickly seems to exceed re-writing something from scratch...

  • Yeah I mean making a list of like 700 objects is a pain but it's a doable pain. Any way to rip a list of object names out of a cap? (I'd have a much easier time excluding stuff not to save, but it's not a huge deal).

    Curious to hear what the 'not quite actually an object' issue is though.

  • Yeah I mean making a list of like 700 objects is a pain but it's a doable pain. Any way to rip a list of object names out of a cap? (I'd have a much easier time excluding stuff not to save, but it's not a huge deal).

    Curious to hear what the 'not quite actually an object' issue is though. Hopefully not another deep inset construct nightmare. D:

  • You can use this to get a list of all the object type names in a cap:

    https://dl.dropboxusercontent.com/u/542 ... peDump.zip

    just change the filename in the script. Also you can filter the dumped list by plugin, so if you wanted only sprites do this:

    for ot in cap.objtypes:
    	if ot.ot.plugin=="Sprite":
    		names+=ot.ot.name+","[/code:f8v9rjxh]
    
    The not "quite an object" issue I think has to do with objects being created outside of the event sheet so it doesn't do the usual stuff to move the new objects to the normal object lists from the new object lists.  I recall messing with that a while back and the solution is to pick the objects with events somehow so it takes care of it, I think a for each would do it.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So the problem with this is like... what's the best way to do selection since creating objects by name doesn't seem to handle selection right?

  • I had a test, and when you do for example this:

    Start of layout
    --- python: System.Create("Sprite", 1, 100,100)
    
    always
    --- Sprite: rotate 100*timedelta degrees clockwise[/code:36t5neww]
    
    Only the new sprite will rotate.
    
    But if you add a "for each" everything can be picked again.
    [code:36t5neww]Start of layout
    --- python: System.Create("Sprite", 1, 100,100)
    
    for each sprite
    ---
    
    always
    --- Sprite: rotate 100*timedelta degrees clockwise[/code:36t5neww]
    
    It only needs to be done after creating an object from python and even then it only needs to be done once. Also the object used can be anything.
  • That's wild that even works.

    Okay I am left with one question!

    So if you take my example cap and change it to save "Latern" and you load the lantern... the size of it is all mucked. The width gets set to a value that makes no sense (18.somothernonsense). I thought it might be because it 'loops to' an dhas sprite parts of difference sizes and other such issues but it was impossible for me to recreate this in your example.

    I can work around it in this one case but it's one of those things that's like "Oh uh.. is this... alright? This isn't going to fuck anything else up is it?" so knowing why it happens would be very useful. D:

  • Getting back to integrating this (probably my next big project for the game) and fixed the size bug. Just had to set size after setting animations and bam. ANYWAYS I have one tiny problem.

    So when stuff is all set up, animations are paused. I've tried throwing obj.ResumeAnim in a million different spots or just actually addressing objects and other stuff and it seems ResumeAnim is busted in python? or am I doing something wrong? Because it would be MUCH easier for me to be able to use python to restart the animations on the object list I'm providing rather than having a huge list of things to manually restart. Or I can put every animating object into a family. and restart that (I've... had some shadiness at one point with multiple families but I don't know if thats actually a construct bug or was just something I screwed up years ago?). Still if you know anything about restarting animations through python, let me know, but I guess it isn't really critical seeing as I have a backup solution.

    edit: Actually thinking about this, I don't need to save the animation frame ANYWAYS if I'm saving immediately (which I would be doing for a production solution) so this might be totally unnecessary. But if its just a simple tweak, let me know.

    edit2: Actually just ran into another snag. using the dump of objects name leads to an error of "more than 255 arguments". As in the dump works but using it with the saving code does not because there are some 700+ objects.I suppose passing a list of as one argument would be preferrable. I can maybe work that out with my very minimal python knowledge tomorrow, but of course any help is welcome.

  • Sprite.ResumeAnim() works. If it's an action with no parameters it needs the () so maybe that's what was missing.

    For the 2nd edit, you can change the function from

    def save(filename, *objtypes):

    to

    def save(filename, objtypes):

    to make it use a list.

    Then call the function with:

    save("myfile.txt", [sprite,sprite2])

    instead of

    save("myfile.txt", sprite,sprite2)

  • Ugh more problems. Getting tons of errors like -'NoneType' object is not callable-. I've identified at least two of these out of the huge list and they're... normal, sprite objects? The only thing special with them is they were in the family with the dash - in their name that got fixed by the python fixer... but even after I delete the family, the issue persists. The object (EnergyUp and HealthUp) saves fine in the old rojo test file I sent you which makes me think the fixer is doing something? But that's just a faint guess. Anyways sorry to keep going back to you but this one is -definitely- over my head. <img src="{SMILIES_PATH}/icon_neutral.gif" alt=":|" title="Neutral">

    http://kayin.moe/forrojo2.cap

    Edit: also if I clone the object, the new object works fine?

  • That latest cap gives an error when opening.

    "An invalid object in a condition was referenced"

    I don't have time currently to dive into the cap file and find where the issue is. Basically it would involve opening the cap in python with capreader, going to where the object types are listed to get all the oids, then going through the event section and verifying the oid of every event is in the list.

    I've never enjoyed the python error reporting in CC, it's kind of broken since it only gives an error and doesn't say where it happens. The most immediate idea that comes to mind is since python is case sensitive you might get errors like that if the capitalization isn't the same.

  • Wait when you run the cap or compile the cap? I don't get that error in either case, which is... strange.

    edit: In case the issue is with opening it, I tore out some unused event sheets that might have caused that. kayin.pyoko.org/forrojo3.cap Not that it seems like you have the time to do much anyways. Capitalization is the same.

    It's weird to think of things being mucked upside the cap but the object in question working perfectly fine. Hm...

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