grossd's Recent Forum Activity

  • jayderyu, and I forgot to mention -- indeed, I do iterate through the dictionary and insert values into an array. The issue I ran into there is that this iteration is only a first step in additional processing -- such as then sort the array, and transfer the array into the list.

    However, there is no direct way to know when the for dictionary loop has ended, i.e. no direct trigger that would continue the processing. This is my item (5) in the list in my initial posting of this thread.

    Instead, i used the exit condition (when array has reached the size of the dictionary) as the trigger (and trigger once) to do the next processing. It works, but it would be better to have an event that triggers when a loop ended.

  • Hi all,

    Many thanks for all those useful comments.

    Fimbul, jayderyu, indeed dictionaries don't by definition have a sorting order. However, you can have a method that returns keys or values in some sorted way, or to have an "iterator" that iterates through keys or values in a sorted manner, or returns keys or values as an array.

    I am not sure I understand why we need Array as a primitive. Is this a performance (processing, memory) consideration, or would offer cleaner programming concepts.

    PixelRebirth, the documentation states that arrays must have at least dimension 1,1,1, otherwise they don't work; and indeed they don't work if you set one dimension to zero. Why this is the case is unclear to me.

    Overall, i find the 3D dimension array object a bit confusing. It might have been better to have three types of array objects, a Array1D, Array2D and Array3D. Is there any benefit of having one Array objects that "servers" all dimensions?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello,

    I've labored the day of yesterday to get something rather simple to work, to display in a listbox, in a sorted manner, names stored in a webstore, and have a text entry field, add and remove button, to add and remove names in the list.

    It turns out to be complex due to a number of reasons:

    1. Only array supports a sort method. Without array I would need to program the sort.

    2. Array always starts with at least one "zero" element (dimension 1,1,1), which show up in the list, when transfering values from the array to the list

    3. webstore can only be conveniently loaded via json to a dictionary, so if i want it sorted, i have to transfer the dictionary to an array

    4. to delete selection items in a list from the webstore its necessary to either keep track of the key of each item in the list, or to use the name of the item in the list as ke

    5. there is a need to use loops extensively but there is no event that indicates when a loop completed, in order to continue the next step in processing

    All in all, a surprising difficult task to program

    Here are some suggestions to simplify this, perhaps Ashley might find some of interest:

    1. Ideally, like in other modern GUI environments, there could be a binding between elements in one list, such as the visual list and another list, such as elements in a web store

    2. alternatively, there could be a sort function on the Dictionary, treating the dictionary keys, like an array, as if it had some order, since the for loop, iterates through some predefined order

    3. having a for (sorted) that does the sorting for the dictionary, by key or value

    4. support a generic "asjson" that supports loading keys or values from a dictionary into another elements via json (e.g. from dictionary to array, from array to list). Currently there are limits on loading json from one element to another

    re: 4, here is one way the task could be accomplished with Json:

    1. Load json string of webstore items into an array

    2. sort the array

    3. load json string of the array into the list

    thanks,

    Dan

  • Hi,

    In the meantime I wasn't able to understand why the json based code doesn't work, but was able to solve the sorting the following way:

    ButtonAdd onClick & not TextBox is ""

    • Array Push back TextBox.Text on X axis
    • Array Sort X axis

    -- Array For each X element

    --- Array Current value =/= 0 List Add Item Array.CurValue

    Also in the Array property menu the dimension of the array has to be set to 1 on each dimension: Width=1, Height=1, Depth=1 otherwise this doesnt work.

    Note that I had to set the condition Array Current value =/= 0, otherwise an empty line would appear in the listbox. This is because the array is prefilled with a first value of zero, because i had to set Width to 1, for the array to receive add values.

    It works, but since i am always interested in learning new techniques, any ideas how to do this better would be much appreciated.

  • Hi,

    I need to add, remove names in list box. The names need to be sorted, no more than 20 names right now. I tried to us Array for sorting and then load the sorted values into the listbox, but it didnt work. Any idea why not?

    Here is the essential code:

    ButtonAdd onClick & not TextBox is ""

    Array Push back TextBox.Text on X axis

    Array Sort X axis

    List set from JSON string Array.AsJSON

    thanks,

    Daniel

  • Hello,

    I experienced this a number of times now, that the autosaved version of the project includes the latest changes to the project, while the saved version is an earlier version -- and this is despite the fact that the saved version has a more recent time stamp.

    What I usually then do is rename the auto-saved version, and save it in a newly created new project folder.

    Dan

  • Hi Ashley and the rest of the SCIRRA gang,

    Just wanted to mention how much I enjoy working with C2. Its an amazing tool and a real life and time saver in working out those subtle quiz games I am doing (for persons with moderate dementia, for a non-profit).

    Keep up the amazing good work and spirit of C2.

    Dan

  • Ahh, great! thanks. I missed the operators.

  • thanks.

    But the behavior i need is as follows:

    Button pressed --> show next frame unless already at max frame, then show frame 0

    I imagine loop would just loop through all frames without "waiting" for the button to be pressed. Or, is there another way to use loops?

  • Hi,

    I don't see a "mod" (for modulu) system function, to find the remainder for division. Is very useful for creating additions that stay in a range. For exampe, suppose i want to create a little game that pressing a button steps through all frames of an animation. If i know that there are say animations 0 to 5, then you can use a mod function as follows:

    current frame = (current frame + 1) mod 6

    set animation frame to (current frame)

    this will conveniently guarantee that you circle through the frames.

    But, i guess there is no mod system function. Could one be offered?

    Dan

  • How good is speech recognition in recognizing, say predefined words. What languages are supported?

    Who does the speech recognition is this C2 or Javascript library or HTML5/browser?

    thanks,

    Dan

  • sorry , didn't do a search ...

    I am quite apparently new to C2.

grossd's avatar

grossd

Member since 4 Feb, 2014

Twitter
grossd has 1 followers

Trophy Case

  • 10-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies