LOCK / UNLOCK - user interaction while CPU is busy ?

  • You've almost figured everything out yourself.

    Move "Show save dialog" to event 240, and remove "Wait for previous action to complete".

    Now look at the "Write text" action. You need to write saved data SaveStateJSON into the file with filename NWJS.ChoosenPath

    What you are currently doing is you are writing chosen path into the file named "mysave". Why?

    It looks like you are trying different random things in hope that one of them will work, instead of taking a moment to read. I mean it's right there - Path, Contents. You don't need to be a programmer to know what path and contents is.

  • You've almost figured everything out yourself.

    Move "Show save dialog" to event 240, and remove "Wait for previous action to complete".

    Now look at the "Write text" action. You need to write saved data SaveStateJSON into the file with filename NWJS.ChoosenPath

    Thanks for taking the time to explain this, I appreciate it! :)

    it is already MUCH better than anything on the manuals but still a non programmer like me have no clue what is this SaveStateJSON means or more important how I use it and when... yeah, it's not that obvious for somebody who needs to google everything and still nothing is related to how it works in C3 anyway but in more confusing terms (most of the documents built in that way).

    What you are currently doing is you are writing chosen path into the file named "mysave". Why?

    It looks like you are trying different random things in hope that one of them will work, instead of taking a moment to read. I mean it's right there - Path, Contents. You don't need to be a programmer to know what path and contents is.

    When you say it's right there... true, but it's not obvious at all:

    Path = You right, it's obviously to put "C:\whatever[/b]" but you mentioned that JSON... thingy which non-programmers have no idea what is it how to use it, why, and when even after reading about it on the documents... it's not helping with no actual C3 Example or Tutorial.

    Contents = from your "Hello World" example I guess I just need to put any text, in other words I understand it's just a "description" so why it's called contents? but I may be wrong because I don't see why I need it now... I thought it's another place to put one of these: AJAX / JSON / Binary data lines and expressions that I'm not familiar or understand yet since... I'm not a programmer.

    I understand that you can't think as a non-programmer because these things looks obvious to you, that's why you probably can't understand my point of view which is totally normal and I respect that.

    This is why I appreciate your help btw, I'm learning MUCH more from these kind of discussions and progress instead of readying "terms" with short descriptions and no actual visual C3 examples in most of the documents, that's useless for non-programmer like myself.

    I did follow your instructions, moved the lines and removed the other one,

    but still can't get that Write TEXT file box to work, I tried a specific path and I get an error on the Console... and I don't even want a specific path for saving the file as I explained, I want it to be on the users last default saved like how the browser invoke download worked. unless it's impossible... I have no idea

    On the Contents... "Enter the text content to write to the file" ??

    But I don't need any text in my file... it's a project file not a document text, so what does it even means??

    based on your example I should put there "Just Any Text" and it's useless in my case because I just want the saved file extension to be MyFile.ALON extension at the end.

    I tried to put there "SaveStateJSON" but it's not working as well, I guess it's supposed to save the system state saved when clicking the "SAVE" button and use that "JSON" thingy to transfer it or something, I'm just guessing it's a programmers language my brain have no idea how to use... lots of guessing are really bad because I'm trying HARD to understand how things are working here with no thanks to the documents.

    Confusion is on...

    Guessing Game Failed because of lack of understanding what's this "Contents" wants me to put in:

    I had so many other tries but it doesn't matter even if it works, I don't get it... I wish the documents could put good actual C3 examples to learn something from all these nice words.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Again, you don't need to be a programmer to figure out that ChosenPath expression should go into Path field, not into the Contents field!

    I give up....

    Path: NWJS.ChosenPath

    Contents: SaveStateJSON

    No quotes!

    Here is how everything works, in plain English:

    1. 1. You save the game
    2. 2. On save complete event you have SaveStateJSON expression which contains game data. You need to save it to a disk file.
    3. 3. You display "Save as" dialog
    4. 4. After user selected a file, you now have file name in NWJS.ChosenPath expression
    5. 5. Finally you have everything to write your data (SaveStateJSON) into the file (NWJS.ChosenPath)
  • Again, you don't need to be a programmer to figure out that ChosenPath expression should go into Path field, not into the Contents field!

    I give up....

    Path: NWJS.ChosenPath

    Contents: SaveStateJSON

    No quotes!

    Here is how everything works, in plain English:

    1. 1. You save the game
    2. 2. On save complete event you have SaveStateJSON expression which contains game data. You need to save it to a disk file.
    3. 3. You display "Save as" dialog
    4. 4. After user selected a file, you now have file name in NWJS.ChosenPath expression
    5. 5. Finally you have everything to write your data (SaveStateJSON) into the file (NWJS.ChosenPath)

    First of all Thanks for the help! it's important for me that you do understand your kind help is amazing! :)

    Let's agree to disagree about "you don't have to be a programmer" part, I can keep explaining this but you won't understand since you're a programmer and these things are obvious to you and it won't help any of us anyway.

    .

    Trying to follow the steps (which is THE BEST WAY to learn anything BTW and I wish the Documents had such examples)

    I'm looking at my current code and see that I'm missing a part which is STEP #2:

    I don't think I have the SaveStateJSON yet, unless.. (I must guess here again) STEP #1 ("mysave") is creating a SaveStateJSON on the "background" and it's already there waiting for me to proceed?

    or there is an actual action to use and put that expression which contains game data..?

    Now.. based on that guessing, I keep getting RED Errors so there is no point to them BEFORE I can understand how things worked as I just explained above related to the JSON part in STEP #2 anyway because I don't know how to create a an action with the SaveStateJSON expression in Line 240 so hopefully it will contain "mysave" if it's what I need to do... or it's already created for me? documents won't tell me such things or give me any visual example in C3 so I can just try to guess how it works, after all I'm not a programmer so it's not obvious to me at all.

    no explanation about this in the documents with no actual C3 example so most of the documents are useless for me as a non-programmer.

    And I was afraid of start learning Arrays in C3... this is only the beginning for my limited stupid-brain :|

  • I can keep explaining this but you won't understand since you're a programmer and these things are obvious to you

    But you do see how ChosenPath and Path both have the word "Path" in them? It's not some sacred programming knowledge, just a very basic observation :)

    What you have on your last screenshot looks correct.

    What errors are you getting? Is the file created? If you open it with Notepad, does it contain JSON data (bunch of brackets, tags and numbers)?

  • The Error appears when I load the NEW created SAVE with the current code. (same as the above screenshot)

    But when I LOAD OTHER FILES (created with the older save version using browser invoke download) it works perfectly fine... so I guess it's something in the SAVE that is wrong?

    The Error is something about my "best friend" JSON:

    Here is the SAVED FILE - what could it be?

  • Have you tried opening the file with Notepad? Didn't it appear strange to you that the file size is 0 bytes?

    .

    Looks like SaveStateJSON is only valid for one tick, after that it's reset. So you need to change the order of events - when button is clicked, first show "Save as" dialog, then on dialog OK save the game, on save complete write the file.

  • This order also make so much sense by basic logic!

    It's very similar to how the LOAD group works (beside the AJAX part that I still can't understand how it's different from JSON) but it works!

    Saving with NWJS object:

    Loading using Browser object:

    What did I learn from this? (hopefully I'm not wrong):

    When using the System Save, it will CREATE a SaveSatateJSON which is accessible and I can use it... How to use or when, that's something I still need to understand using it on other situations to get the idea sooner or later...

    NWJS.ChosenPath = If I got this right: actually telling the NWJS object to use the Chosen Path to Saved the file (that stored in the SaveStateJSON) and in my case it is CHOSEN by the user with the Save Dialog while accepting ".alon" files. (hopefully it will not have issues on other OS since I'm using Windows 10).

    I hope that I got at least SOMETHING here rather than just put the code with no clue what is done.

    .

    Next step... trying to apply the Function to EXPORT/IMPORT so I will be able to LOCK/UNLOCK the user whenever the CPU is doing anything especially for older machines.

  • Loading using Browser object: (maybe I should try convert it to NWJS

    It's already done with NWJS, where do you see any browser actions?

    NWJS.ChosenPath = If I got this right: actually telling the NWJS object to use the Chosen Path to Saved the file (that stored in the SaveStateJSON)

    ChosenPath is the chosen path to some file, nothing else. It has nothing to do with SaveStateJSON yet. Even the file itself may not exist, it's just a string containing a path, like "C:\Temp\MyFile.alon"

    And then you can write something to this path, and the file MyFile.alon will be created and contain whatever you've written into it.

  • > Loading using Browser object: (maybe I should try convert it to NWJS

    It's already done with NWJS, where do you see any browser actions?

    Yes! I was so confused I looked at the Browser Log and forgot the all thing started with NWJS.. my bad I just noticed this and edited my post... (focus is important!)

    > NWJS.ChosenPath = If I got this right: actually telling the NWJS object to use the Chosen Path to Saved the file (that stored in the SaveStateJSON)

    ChosenPath is the chosen path to some file, nothing else. It has nothing to do with SaveStateJSON yet. Even the file itself may not exist, it's just a string containing a path, like "C:\Temp\MyFile.alon"

    And then you can write something to this path, and the file MyFile.alon will be created and contain whatever you've written into it.

    If THIS explanation was on the DOCUMENTS! even simple animator such as myself would actually understand things better... oh well, at leat I understood something, it's better than nothing.

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