Error.

For questions about using Classic.

Post » Thu Jan 05, 2012 3:42 am

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?
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Thu Jan 05, 2012 3:58 am

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.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Jan 05, 2012 6:13 am

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.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Thu Jan 05, 2012 6:38 am

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:

[code]def doublequote():
    return "\""[/code]

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.tulamide2012-01-05 06:45:19
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Jan 05, 2012 7:08 am

That helped a lot! Thank you very much!
B
11
S
3
G
8
Posts: 473
Reputation: 4,569


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests