This forum is currently in read-only mode.
  • Construct just crashed. So, what I tired to so is save a file to "%appdata%". See, I'm making a tool for Minecraft, and the config needs to be saved to "%appdata%/.minecraft/config/file.txt". However, when I ran it to test it, it crashed as soon as I hit the save button. Is there a way around this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I answered this in another thread already. CC does not recognize environment/path variables in a string. That's what the path object is for. Add it to your project and retrieve the app data path by using the expression "Get App Data".

    You can get all system paths by using the path object.

    In your case the path string would be build this way:

    Path.GetAppData & ".minecraft\config\file.txt"

    And don't forget, it's a backslash, not a slash.

  • Is there a way I can use double quotes? I'm making utility for a mod for Minecraft. The modder has the config set up to use quotes ("). I know you can do this "''", but that's not double quotes, just two single quotes.

  • Yes, you could do it with python.

    (Enable scripting in application properties)

    Create a "start of layout"-event and add the following script to it:

    def doublequote():
        return "\""

    Then, whenever you need a double quote in a string, do it like so:

    -> Text: Set text to Python("doublequote()") & "seems to work" & Python("doublequote()")

    I haven't tested if this will also save to a file correctly, but it should.

    EDIT: I just tested the following, which set the text to "yeah" not yeah

    -> Text: Set text to """" & "yeah" & """"

    Looks odd, but seems to work.

  • That helped a lot! Thank you very much!

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