Alon's Forum Posts

  • > 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.

  • 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.

  • 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?

  • 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 :|

  • 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
  • Yes I did, where is that explanation or examples of how it's done exactly?

    All I see is just a brief information, there is nothing there that can explain to ME (non-programmer) how do I save my unique file extension as file?

    This is why I'm using the forums MUCH more informative and helpful than the documents which are using lots of terms for programmers with lack of examples for non-programmers.

    The Dialog windows are working fine as you saw on my example, it's not the issue because it works great with the functions you helped me with:

    For example: How do I SAVE my specific file .ALON using the NWJS?

    there is no example or tutorial about such thing using C3 there is only something about TEXT which isn't helping me in any way since I need to save data using my unique file extension.

    I wish the documents had more tutorials or at least base examples for non-programmers... so I could learn and actually understand from there as well.

    The result of Save dialog is the file name only, which will be in ChosenPath expression. Then you need to write to this file.

    I must say that I always appreciate your help, I learn a lot from you and other good people at the forums but I wish I knew how to do half of what you just explained...

    Since I don't know where to begin or how it's done exactly I can only guess that "something.ChosenPath" after something in one of the actions I need to do but I have no idea what or how

    I'm looking on the older save code and keep guessing but not sure if I'll "HIT" right how it's done... these things are not so simple to learn, trying to connect the pieces together, not so simple but I'm trying as I go. :)

  • Sensei dop2000 I got some progress:

    If press SAVE button, the PANEL + TEXT "SAVING PROJECT FILE" appears and if I Cancel from the SAVE Dialog, I get the panel to get back to it's hidden position, so the functions are working! :)

    But the problem is that now the ACTUAL saving file to .alon as it was with the Browser using Invoke Download not saving the data, I tried to understand using the manuals unfortunately I still can't understand many things about how to use it right it's not simple as I thought based on what I saw on the Loading group which I tried somehow to follow.

    .

    As for the UNFINISHED current code, I can save a file, but it will be an empty file, obviously it's not actually saving the data since I don't know how to complete the code in this area.

    I'm trying to convert the saving via Browser object to NWJS, just like it's already loading from NWJS fine including the Panel + Text.

    Can you have a look on the SAVE group, and tell me how can I make the save work?

    Thanks ahead for any help!

  • If you want to continue showing "SAVING PROJECT FILE" message while the "Save as" dialog is on the screen, you have no other option but to switch from using "Browser invoke download" to "NWJS Show Save Dialog", and then "NWJS Write text file".

    You can find how to use it in the official documentation, or search the forum for tutorials, examples. It's not difficult.

    I'll dig into that because I think it will be better that most of my code will work around NWJS when possible anyway, I hope I can get it to work. :)

    But I would just forget about it, and leave it as it is - invoke download and immediately unlock the UI in the same event.

    It will look weird to have some messages appears, but when saving... nothing, also it helps me do early checks more visually, but if I won't be able to code that... I may have to skip the all panel idea which is a shame.

    By the way, you should send the message to be shown in Text_Panel_CPU_Is_Busy in function parameter, and set text inside the function.

    OH! I never used Functions Parameters before, it sounds like an efficient way using parameters for every SET TEXT! I gotta give it a try, Thanks! :)

  • You don't really need to continue blocking UI when saving files. There will be a modal "Save as" dialog open, which will prevent users from doing anything else.

    Even before I get to the all Blocking code, I want to solve the original issue the PANEL with the text that shows "LOADING PROJECT FILE" while the Load Dialog Box is working, while the "SAVING PROJECT FILE" is not working, because it works with the Invoke download if I understood you, but how do I still make the panel to work like it does with the LOAD?

    This is to CHECK if it works, also the Save/Load Dialog is not always covering all the screen like in the screenshot, it's up to what the user size and position used last so I want it to be on the background with all other messages that I will use on this panel later on.

    The question is: how can I make the "SAVING PROJECT FILE" Panel with Text to appear while the Save Dialog Open?

    So I think you can remove event 229, and in event 234 remove "wait for previous event to complete"

    .

    Also, by TextBox I meant Text Input object.

    Thanks I can't wait to try it after I'll solve the Save issue! :)

    Here is the current code version if it helps you follow my mess:

    What I'm trying to do first is to solve this PANEL + TEXT to appear on it's position (using the Functions) and SET it's text to the current states that I need because I will have more.

    That's why I don't want to proceed to the actual Blocking yet.

  • "On saved dialog cancelled" may be triggered after "NWJS Show Save dialog" action. You are using "Browser invoke download" to save files, that's why it's not triggered.

    That's why I got confused... broswer/NWJS, can I use ONLY NWJS instead of browser so I'll have the same "way" talking with these events.

    I didn't touch these because of all the binary or Json data and rest of the code that you helped me with earlier since it works... I was afraid to ruin it by "guessing" things, is it possible at all to NOT use Browser for save/download the files? but only NWJS? If so... how exactly? or if not what is the solution?

    Boolean flag is needed for checks in your various events.

    OK, I wasn't sure I understood thanks!

    If you add any opaque layer or background above everything in your project, it will not block mouse clicks, they will still go through to objects underneath. You need to use TextBox (or another Form Control object), only they block mouse events.

    OH... I didn't know that! it should be easier than using Sprite or QuickBackground and put "While Mouse cursor is NOT over X" for all the events one by one... I must give it a try once I'll fix the current issue.

  • Thanks for the explanation and guides, I will try to follow your instructions.

    Sorry about the wrong line number, my bad... I meant Line 229 the part I marked on the screenshot which supposed to show print it to me on the Console(F12) once SAVE Dialog Canceled (same code WORKS for Load Dialog Cancel) but NOT for SAVE Dialog Cancel. Please have a look on the post with that screenshot maybe you'll get my mistake why it's NOT working on SAVE Dialog Cancel?

    .

    Now that the Boolean CPU_is_Busy are inside both functions (true / false)

    What about the CPU_is_Busy events themselves? the position that was in there moved to the Function, so what do I need to put in there? I'm not sure I understood why I need them, because checking CPU_is_Busy = Same as Call Function at the moment? (unless I'll put there something of course)

    it's a huge loop in my head that I don't understand exactly, please explain or give an example with Func_LockUI + CPU_is_Buys why I need both if you can?

    I guess ONLY for checking flags as you said but to PUT NOTHING inside lines 227 and 228 I can actually remove these two?

    I'm asking because I'm not sure.

    .

    Blocking the keyboard may be tricky for me since I will need to reorganize some groups but, yes it will be much easier to Activate / Deactivate instead of messing around. :)

    About the Mouse lock, I was thinking about making a dedicated Layer (or just a huge QuickBackground Stretched all over the place) as you suggested but I never done that before so I didn't know if I can use such thing to actually BLOCK anything with the mouse, it seems the most simple and effective solution. I should give that a try... As soon as I get the CONSOLE (F12) show me that most basic actions actually works.

    Thanks ahead for any help! :)

  • Here is my first basic attempt with the functions instead of the Boolean:

    If disable the Call Func_UnlockUI on Line 229:

    I get a signal on the Console (F12) By pressing the SAVE button but not when I CANCEL from the Save Dialog:

    If Enable the Call Func_UnlockUI on Line 229:

    I get automatic signal for SAVE button and immediately for the CANCEL (while the Save Dialog is open, I didn't press Cancel yet) even if I press Cancel it won't give me a signal on the console.

    I'm missing something related to the SAVE / CANCEL but I can't see what...

    How do I even make something simple such as "CANCEL" the Save Dialog to work for sake of testing?

  • Thanks for the help sensei dop2000!

    Before I'll do the Console Log check as you suggested I want to convert the current code to Functions as you suggested first, it's still a mess.

    I'm still confused what kind of events runs on "Every Frame" if I didn't use "EVERY FRAME" that's why I thought it's "Only Trigger Once" by default and didn't even think about functions BTW.

    I didn't understand something, I hope that you can help me get the idea right:

    The reason I used Boolean: "CPU_is_Busy" is because like in Line 235 (WIP) for example, I don't know how to do the same "IDEA" with functions?

    Which I want to check if the UI can even be used or not.. I was thinking about checking Activate/Deactivate Groups instead but maybe there are better, cleaner options?

    Do I even NEED "CPU_is_Busy" anymore if the functions basically do the same check but as you explained, not every frame and more efficient = GREAT!

    As you can see... I'm confused about the all thing, but I'm still messing with it...

  • Hi All,

    Since I don't want to have extra issues when I'll test my project on other machines, I've decided to try make some kind of Lock/Unlock some buttons whenever the CPU is busy for Saving/Loading Project file and Exporting/Importing Image file.

    I just got started with a very simplistic logic by creating a Global Boolean called: "is_CPU_Busy"

    Before I'll add the actual buttons/menus I want to lock, I made a simple 9-patch PANEL with TEXT (Pinned to the Panel) so it will be a visual way to check beside the Console (F12).

    The Panel TEXT is out of the Layout by default, and when "is_CPU_Busy" = True it changes position to a specific place:

    I actually made the LOADING part works in a way, it's not perfect yet (need to add "on cancel" etc..)

    But I'm having issues with the SAVE part... it won't show the PANEL with the Text, I tried to follow what I did in the LOADING but I can't get it to work correct.

    I tried some different approaches, I get to show it but then the panel stay on the screen (on save complete) instead of go back to it's position based on the "is_CPU_Busy" Bool, just like it works when I click "LOAD" that's where I got confused.

    Console (F12) didn't show anything strange so I'm on a trial and errors now, and I make things more complicated than they should instead of making it clean and efficient.

    .

    Note: the screenshots are NOT my current latest version, I'm still playing with the code as you read this post BUT! you can see the rough idea of what I got started (a total mess) but it's just so you can have a look and give me a hint how to make it work more efficient if possible, Any help is appreciated, thanks ahead! :)

  • Nice!! I'm so jelly on how you even manage to code such magic AllanR :)

    If you don't mind sharing the next update working version please do it's very helpful!