Obi554's Forum Posts

  • Hi.

    So I started a main project a few weeks ago and I'm stuck because my arrays are not loading into the ajax plugin.

    It's a really easy task to setup which takes less than a few minutes - thanks to the help of members of this forum who helped me a few months back showing me how to do it.

    On start layout - ajax - load array.json

    On tag complete - array - load ajax.lastdata

    Whenever I load the debug preview the ajax is showing to have no data. And my 2 arrays are showing as width 10 which is inacurrate, as well as no data.

    I'm not sure what to do. I've tried moving the events to the top of the events sheet, i've deleted the ajax and arrays and started again. It's just not working

    I know there is nothing wrong withvmy events because I have started 3 new projects and made simple arrays and they are working fine in the preview.

    Could my main project be corrupted or is there somethinf I'm missing?

    Have I disabled somethinf that I shouldn't have?

    It's really frustrating because I can't move on with my project as the array function is so useful in so many ways for storing data although it is a steep learning curve for me.

    Just to note. I have 2 layouts and 1 event sheet. I don't think having a second layout would cause the events to not work properly.

    Thank you for any help :-)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks :->

  • Here's a screenshot of the array + the events. If populating a list box with array / dictionary text is gonna be difficult I'm happy to try a simpler method.

  • Thanks for this,

    My list is still showing up blank however when I click on it.

    Im trying to populate it with items from Y=1 to Last item at X=0 on the array

  • Does anyone have this issue?

  • You do not have permission to view this post

  • Hi,

    Thanks so much for this!

    Yeh I was confused with the new forum. Took me a while to get used to it.

    Thanks again :)

  • Hi,

    I want to player to click on the list box and see all the items in his inventory listed from the drop-down menu. The items are currently stored inside an array, with each item's name on the Y axis at X=0.

    I've tried the 'set text' and the At expression for my array, but nothing happens when I preview the game - list box stays empty.

    Thanks for any help with this :)

    Oh - I was wondering if there is a way to set this up so that the list box automatically populates for each item in the inventory, instead of programming the entries for every single array item?

    Thanks

  • There are many ways to do it - with arrays, dictionary, CSV/XML files etc.

    Here is an example where list data is stored in string variables:

    Hi dop2000,

    I was wondering is this demo you created still available for download?

  • > Do you know how I can use the array.At expression to point the return value to a specific line on the array, say the second or third row?

    >

    1 dimensional array: Array.At(1) - returns value at element of index 1

    2 dimentional array: Array.At(1,3) - return value at element of index 1 on the X-axis and index 3 on the Y-axis

    3 dimentional array: Array.At(1,3,5) - return value at element of index 1 on the X-axis and index 3 on the Y-axis and index 5 on the Z-axis

    I highly recommend you reading manual (https://www.construct.net/pl/make-games ... onstruct-3) when you don't get something. You can find there many really useful information. At the beginning you probably should read these two parts:

    https://www.construct.net/pl/make-games ... ves/events

    https://www.construct.net/pl/make-games ... nd-guides/

    It would allow you to get better understanding how evertyhing works in Construct and prevent you from making mistakes that results from many misconceptions <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink" />

    > Also, how do I cycle through the Y axis instead of the X? Some of my buttons will cycle downwards through the array instead of across.

    >

    >

    You make the same things as in my capx but the only difference is that you change Y index instead of X index. So it would be "Set text to Array.At(0,itemNR)" if you want to cycle through elements of index 0 on X-axis.

    Wow it's working now!!

  • itemNR tells you which item is currently selected. "Set item to: (itemNR+1)<=2 ? itemNR+1 : 0" lets you go through your list. It goes like this: 0 (remember that it's the first index in the array), 1, 2... and in my example you don't have 3rd array index, so you have to return to 0 index. So the exact performance is:

    - your current itemNR=2,

    - on touched Sprite the condition is checked: (2+1)<=2; it's not true, so Construct sets itemNR value to 0.

    Take a look at Operators part here:

    https://www.scirra.com/tutorials/77/nat ... onstruct-2

    Thanks I understand it now <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

    Do you know how I can use the array.At expression to point the return value to a specific line on the array, say the second or third row?

    Also, how do I cycle through the Y axis instead of the X? Some of my buttons will cycle downwards through the array instead of across.

    I'm trying to work it out myself but I keep getting incorrect expression etc....

  • Use array.At(X,Y,Z)

    If you have the names stored on x just do Array.At(variable) and every time the button is clicked, increase variable by 1. At the end just make sure that the variable loops back to 0 or stops increasing once you reach the end of the array.

    variable > array.width - 1

    Set variable to 0

    Hi,

    Would you mind explaining this please:

    variable > array.width - 1

    Set variable to 0

  • itemNR tells you which item is currently selected. "Set item to: (itemNR+1)<=2 ? itemNR+1 : 0" lets you go through your list. It goes like this: 0 (remember that it's the first index in the array), 1, 2... and in my example you don't have 3rd array index, so you have to return to 0 index. So the exact performance is:

    - your current itemNR=2,

    - on touched Sprite the condition is checked: (2+1)<=2; it's not true, so Construct sets itemNR value to 0.

    Take a look at Operators part here:

    https://www.scirra.com/tutorials/77/nat ... onstruct-2

    Ok thank you so much! I'll take a good look at this.

  • Here you have an easy way to achieve this:

    https://www.dropbox.com/s/riibqex9fb8wt ... .capx?dl=0

    Thanks,

    Would you mind explaining this code please?

    (itemNR+1)<=2 ? itemNR+1 : 0

    I know itemNR is the global variable, but I don't understand the sequence or other numbers/symbols here.

    Thank you for your help - it will assist me greatly!

  • I'm trying to work out how I display text from the 'next' cell down or across in the array when the player clicks on the 'next item' button. The array is basically storing 'available items' in a player shop, and when the player clicks on 'next item', the text above should list the next item.