Ginger Cat Studios's Recent Forum Activity

  • > I believe what I should do then is create an array and a json within the construct, use Ajax to import the json into the array

    If you need to pre-load some data into the array, then yes - create an array file in the project and load it with AJAX. You don't need NWjs for this part.

    > and then use NJWS to write the array into the json, right?

    If you need to save the contents of the (changed) array in runtime, you can either save it to local storage or write to a disk file with NWjs.

    I was using Local Storage, but I can't find the location where it is saved, this is my main problem actually, I need to be able to find the saved json. I will try to use NJWS to save it in a json that I know where it is.

  • First, you need to add NWJS object to the project.

    NWJS Write Text File action to save.

    Array Load from NWJS.ReadFile("path") to load.

    And of course these will only work in the exported game.

    I believe what I should do then is create an array and a json within the construct, use Ajax to import the json into the array, and then use NJWS to write the array into the json, right?

  • construct.net/en/make-games/manuals/construct-3/plugin-reference/nw-js

    See the section in the manual regarding using file paths correctly on the NW.js page.

    It recommends writing to NWjs.UserFolder & "myfile.txt", however I would additionally recommend putting it in a directory unique to your game, as well as saving the file as .json if you'll be saving data in json format. Alternatively, use an obfuscated/unique/encrypted format you are familiar with.

    You want to use the NW.js Write text file action, with your array.asJSON as the content to write. Or whatever else type/format of data you're saving. Dictionary.asJSON works well as well, and is more similar to LocalStorage in terms of keys and values. Save to your dictionary as you normally would have to LocalStorage, with the additional step of writing the dictionary to disk as a file through NW.js when desired.

    To load, you can use the ReadFile() expression (into your load dictionary or load array action). You can get information about the file location with the NW.js action List files along with the UserFolder, ListCount, and ListAt() expressions to confirm and validate the existence of save files.

    Thank you!

  • Try searching the forum, there were a few posts about this.

    https://www.construct.net/en/forum/construct-3/general-discussion-7/nwjs-save-games-local-storage-178282

    Thanks Dop, I've seen many of your answers here, and I believe you've already answered other questions of mine, congratulations on your dedication to helping others.

  • I'm using Array and Local Storage to save the player's settings and progress as Json, it's working correctly, but I would like to know where this json file is that is saved, I need to know the path so I can edit it or send it to Steam to save it in the Cloud, but I can't find it anywhere, does anyone know where it is?

    I am using NW.JS to export

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello, I'm redoing my game on Steam because of the way it saves, I was using the game's save state and on Steam I sent the entire Appdata folder to the Cloud, this works, but the obvious thing happened, if I perform updates, old players will continue on the version they played the first time.

    So I'm remaking my game the right way, using Local Storage and Arrays, it's saving smoothly. However, I can't find the json file that my Local Storage saves anywhere.

    I found some people saying to use the NWJS object and create a folder to save it, but I didn't find any information or an exact tutorial on how to create, save the json and then load it in the same way that Local Storage does.

    Does anyone who uses NWJS to export games to Windows know how I can save my games in a JSON and load them? And of course, I can work on it, for example after loading send it to my array.

  • You do not have permission to view this post

  • Forget it, I found a mathematical formula that solves this.

  • Check out these examples:

    https://howtoconstructdemos.com/category/slide-bar/

    Note, that for volume you'll need to use log10() expression:

    https://www.dropbox.com/scl/fi/5e5kyap5eqq6g7u1kfksb/VolumeSlider.c3p?rlkey=v8wsfcpi8nw7ntay3qpciod2o&st=hmioppkn&dl=0

    Thanks for the example,

    But using sprite, where the marker for example goes from X:335 to X:575, how could I convert these values ​​to decibels?

  • Ok, I found the solution using the drag and drop behavior in a sprite, but the question would now be the formula to calculate the volume, do you have any suggestions? Maybe using the size or the location in X..., I don't know how I will do this.

  • Hi, I'm creating a volume bar for my settings.

    The problem is that the slide bar is very ugly and has no customization option, I would like to change the bar and the pointer.

    Is there a simple way to do this without having to program HTML/CSS, like sending a png of the pointer and bar like the other construct objects?

    Or even if it's possible to build a volume bar using sprites, I'd be grateful to know.

  • Generally it's fine either way, it may be more suitable to use frames if you need to iterate, but overall it's more readable if you had 2 animations (say you have 2 items, health and ammo, better to have them named like this and clearer in your events when you see "set anim to Health" rather than "set frame to 0").

    Oh, wait, we have animation frame tags now, so I guess either way works fine!

    Perfomance wise, I believe it's not a concern.

    Thanks for the reply

Ginger Cat Studios's avatar

Ginger Cat Studios

Member since 1 Jul, 2024

Twitter
Ginger Cat Studios has 1 followers

Connect with Ginger Cat Studios

Trophy Case

  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

3/44
How to earn trophies