Python crashes, known bug or?

This forum is currently in read-only mode.
From the Asset Store
Minimalist Crash Balls is a game where the goal is to hit the ball on the portal, with 20 different levels :)
  • Hi,

    I got some problems in python when creating an online highscorelist. I stripped down the whole project and got the essential parts that makes it crash. It crashes lesser in this stripped .cap file, but it should be the same type of crash.

    Link to .cap file:

    http://fullmetal.no-ip.org:8080/test.cap

    To produce the crash:

    Press "Start Game" button and then press the "Submit" button.

    Do this 19 times (you can press Skip too, it only matters the first time). If you delete TextManipulator do this 23 times then it crashes.

    In the real project you only need to do this twice and before I recreated the TextManipulator obj it took 7 times in the stripped cap file. I wouldn't mind if it takes 23 times in the real project before it crash, it just would be annoying. I noticed now while writing that it crashed much earlier on another almost identical computer. It seems it may vary depending on computer. If you toggle the load script in loadHS event sheet it stops crashing.

    I checked in the bug tracker and there was a bug with python and Image Manipulator, thought it could be something with the Text Manipulator. But it still crashes without it. Then I saw something about using Globalvars with "Text" crashes but not "Numbers" in python. Could this be the case?

    How to do it otherwise?

    All help appreciated

  • Hi. It is a known bug with reading global variables containing text from python. It's very unpredictable. Sometimes it works, sometimes it doesn't, sometimes it crashes.

    Anyway, I couldn't figure out much of what you were doing or why you had python commands where you did in that stripped down .cap, but I would deal with the global variables normally through construct events whenever possible.

    As for the specific problem in the .cap:

    + layout2control: On Left Clicked on Box
    -> System: Run Script ("func(System.globalvar('Name'), System.globalvar('Score'))")[/code:31g2cxr9]
    
    ... changed to:
    
    [code:31g2cxr9]+ layout2control: On Left Clicked on Box
    -> System: Run Script ("func('" & global('Name') & "', " & global('Score') & ")")[/code:31g2cxr9]
    
    ... fixes the problem on my computer. This just reads the global vars from the construct event and inserts their values into the string which is to be run as a python script. Note that string values must be enclosed in quotes as I did there, and that the string can't contain the type of quote mark used( ' in this case.)
    
    Otherwise, one can usually write a python function that calls a Construct function, which returns the desired result back to the python function, which in turn returns the result... Eh, sounds worse than it is, really.  I'm not sure that would work well in this case, though. Construct has it's own quirky use of ' quotes with global variables that would probably prove difficult.
    
    Also, I noticed that you were assigning strings to global variables which were defined as numbers. I'm not sure if Construct considers the global variables to be dynamically typed, but seems as though it does.
  • Thanks for the answer, I will try that out and see if it will work.

    I have switched out the real code for something random, but it produces the same bug. So I understand why you don't get what I'm doing there

    I'll post a new reply if this solves the problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It works now , thanks a bunch!

    The real purpose is a online highscore that saves to and shows from my server. Everything works now as it should with your help ^^

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