Would like some pointers. How do I make a diary or notes collection?

  • Hi all,

    I would like to make a collection of notes that you find throughout the game which you could look up in a journal that you carry with you. You know the type, sketches, writings, the whole bunch.

    I don't mind making it (obviously) but I would like some pointers on how to handle such a system and by using which resources.

    - I want a note to be added on the next possible page depending which one you pick up. So playthrough 1 might have a different order of notes than playthrough 2. Not that it matters a lot, but I just want to avoid weird gaps in between the notes if I would give each one its own absolute fixed space. Something with a dictionary or library?

    - I assume that on each pickup I would give the new note a variable (number) and then when clicking on ''next page'' button I could just use that variable and +1, same as previous button and -1 for the variable. But I struggle to figure out how to store information for each page and connect them to the variable. I'm eager to learn something new about Construct every day so if you guys could just point me into the right direction I would be thankful! :)

  • To provide you guys with a visual that I made so far ^^

  • You probably want to look into Arrays.

    construct.net/en/make-games/manuals/construct-3/plugin-reference/array

    Basically you have an initially empty array, and whenever you pick one of the notes up, you push that to the array. This way there will be no gaps and the notes will appear in the order you picked them up.

  • You probably want to look into Arrays.

    https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/array

    Basically you have an initially empty array, and whenever you pick one of the notes up, you push that to the array. This way there will be no gaps and the notes will appear in the order you picked them up.

    Thanks! I'm going to look into it soon :)

  • I'm finding it hard to mess around with this ^^ So I'm just going to think out loud here.

    Ok I have 3 different types of notes basically. I have Objectives, which I want to form a list where items get crossed out once they are completed and new items get added as they are found.

    Then I have Notes and Dreams which are essentially two of the same type of pickups that give you Notes containing useful hints or Dreams which are basically background story.

    Sooooo I guess I need an array for each, right? Starting with Objectives, I created an array with one dimension (x) of about 50 spaces that will serve as a testing ground (I have no idea how many spaces I will need so I just picked a number)

    I need 3 things?

    1. I need to know what's the current X value and then pop up the information belonging to that value. This is already where it's getting weird for me since the actions set from an array seem to be very limited to me. I created a variable for each array to keep track of the current number. Then I made a condition that says:

    If current array value = IndexObjectives (the variable which holds the value that's supposed to track what page we are on), and then at the action I want to load the right information. Should I do this with a JSON string?

    2.If the player finds a new objective it has to be a value that's added as ObjectivesArray.CurX+1 I guess? So you store a value in the next index space that way right?

    3.When I click on ''Next Page'', I want the IndexObjectives variable to go IndexObjectives+1, and for "Previous Page", IndexObjectives needs to go IndexObjectives-1. Then a check on every tick should connect the right information to the new IndexObjectives when it changed?

    I think I kind of understand what needs to happen but it's honestly rather daunting and complicated right now ^^

  • construct.net/en/forum/construct-3/your-construct-creations-9/kids-stories-book-153428

    Sorry but what am I supposed to do with this? It's not really helpful as it's a finished Android file.

  • Sooooo I guess I need an array for each, right?

    Well, probably not. I´d use one array for all of them. Of course there could be a use case where you need them separated. For simplicity, I´d just say 1 page = 1 note.

    So each entry on the X axis is a note, and entries on the Y axis are the notes contents. Let´s assume each note has title, type, content

    You start out with an empty array on the X axis and you need 3 fields on the Y axis so that would be a 0,3,1 sized array.

    You find any note, you use the arrays push action. Most likely you´ll want to push back on X axis. Push the title of the note.

    Right after, you need to set the type and content, for that you can use Set at XY. X = array.width-1 (arrays are 0-based) and Y = 1 for the type and 2 for the content.

    And for the notebook navigation, you just need one variable (e.g. currentPage) that tells you what page you are on. Since you always show two pages at once, you can increment the variable by two whenever you navigate and simply repeat the actions below.

    So you start out on page 1. You can now read the values of the array based on the currentPage variable. Again, don´t forget that arrays are 0-based.

    Array.At(currentPage-1, 0, 1) = title of the note

    Array.At(currentPage-1, 1, 1) = type of the note

    Array.At(currentPage-1, 2, 1) = content of the note

    (This is for the left page, for the right page use Array.At(currentPage, 0,....)

    Now you need to just fill in the data on the pages. So probably something like, get the title, add it into a textfield on top of the page. Get the type (since you said there are different kind of notes you probably want to know how to handle the content), basically IF type = A do this, IF type = B do something a bit different. Then you get the content and also fill it in.

    What data you save into the content is up to you, could just be a tokenized string A|B|C where you can use tokenat to split it up, could be some JSON content that you then parse and use, could be an image that you then show on the page,...

  • Thank youuuu WackyToaster I think I can manage with this explanation. I will let you know later :)

  • Ok I thiiink I get it but I would like to get back to you with one question in particular.

    So, by doing as you stated you basically start out with a grid that's 3 vertical squares in a row and unable to store any information, right?

    So at the start of my first layout, I want a note added. I do this as seen below:

    I understand that by pushing and setting the values you first create an extra row of 3 vertical squares (or in the initial call, you simply allow the first row to store information), and set three types of information directly afterward. In this case, the first horizontal row is a title, the second is the type (i.e. "Dreams"), and the third is the content itself. Each vertical row is basically a page by doing so. Correct? This would also mean I could use the array.X as the variable to set the page navigation right?

    What I don't fully understand is why you subtract 1 from the 0-based X? Set at XY. X = array.width-1?

    Wouldn't it have to be +1 to simply add a new row on the array grid? This seems to make way more sense to me as you would also fill in the X properties as ''1'' or ''2'' depending on how much rows you want. Or is this something with the 0-based concept that I don't understand?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What I don't fully understand is why you subtract 1 from the 0-based X? Set at XY. X = array.width-1?

    Wouldn't it have to be +1 to simply add a new row on the array grid? This seems to make way more sense to me as you would also fill in the X properties as ''1'' or ''2'' depending on how much rows you want. Or is this something with the 0-based concept that I don't understand?

    Mmmm is this because when you push a new value on the X array you essentially get a 0 and a 1 vertical column at the start (so a grid of 2x3) and the first row is still empty so you do a -1 to fill in the first empty row? ^^

  • Each vertical row is basically a page by doing so. Correct? This would also mean I could use the array.X as the variable to set the page navigation right?

    Exactly :)

    What I don't fully understand is why you subtract 1 from the 0-based X? Set at XY. X = array.width-1?

    When X is set to 0, it basically means the width of the array is 0, as in 0 fields. As it shows in your screenshot, Elements: 0. The moment you push your first note, your array becomes width 1. So right after when you want to set the type/content, you need to access the 0th field and you need to subtract 1 from width to get the last field that was added.

    In other words, an array with a width of 3 has three elements that you can access with X=0, X=1, X=2. An array with width 1 has one element that is X=0. And an array with width 0 has no elements to access.

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