John Cutter's Recent Forum Activity

  • Thanks 99instances2go, I appreciate the help -- but I've never had any issues sorting my array. I only need to sort by the "score" and it's as simple as "sort x". Works perfectly.

    Oh, and thanks for the help with "push", blackhornet. With your help I got my app working last night. It has taken me almost a month (for something I thought I could do in a weekend), but it's almost finished now.

    Most of my Flashcard app was super simple to make using C2, but I struggled with array handling, loading/saving data, the dictionary object, and local storage. The next project should go a LOT smoother.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, blackhornet. I tried using push last night and failed. Came online to learn more and saw some posts that said its not really for multidimensional arrays, so I gave up on the idea. Will look at it some more tonight, but if anyone has any advice...

  • I have an array with a width of 440 and a height of 5. It looks like this:

      [score, text1, text2, category, id]

    For my app I need to sort the array by score but also filter it by whichever category the user chooses. To accomplish this I created another array and set it to have the same dimensions. Then I iterate through the array that has my data and copy ONLY the rows that match the chosen category into the new array. That part works great.

    Unfortunately, since both arrays have the same dimensions, my new filtered array isn't as big and so has a bunch of "0,0,0,0" lines at the end.

    How do I fix this? I suppose I could set all the "0" scores to a really high number so they would get sorted to the bottom, but there has to be a more elegant solution. Can I search through and delete the "0,0,0,0" rows?

    Not sure if it will be useful but here's a picture of my function:

    NOTE: On 'Start of layout' I load all my data into "array2" and this function copies everything that matches category "x" into the original array ("array")

  • Looks like this bug is closed, but I found THIS online:

    -----------------------------------------------------------------------------

    My question was: why does window.speechSynthesis.getVoices() return empty array, after page is loaded and onready function is triggered? As you can see if you click on the link, same function returns an array of available voices of Chrome by onclick triger?

    It seems Chrome loads window.speechSynthesis after the page load!

    The problem is not in ready event. If I remove the line var voice=... from ready function, for first click it shows empty list in console. But the second click works fine.

    It seems window.speechSynthesis needs more time to load after first call. You need to call it twice! But also, you need to wait and let it load before second call on window.speechSynthesis. For example, following code shows two empty arrays in console if you run it for first time:

    // First speechSynthesis call

    var voices = window.speechSynthesis.getVoices();

    console.log(voices);

    // Second speechSynthesis call

    voices = window.speechSynthesis.getVoices();

    console.log(voices);

  • Ashley: Usually, the first time I run the Speech Synthesis app on my iPhone or iPad the voices show up in the list box. But when I refresh the page the list doesn't populate. If I refresh it enough times (usually 5 to 8 or so) the list will appear again.

    Not sure if this helps but the French voice I need shows up like this: "fr-FR: Thomas (com.apple.ttsbundle.Thomas-compact)"

    My workaround is to look up the "platform" using the Browser object and then use the French voice that I manually set at design time. That seems to be working so far, but I need to get the platform name (and voice name) for Android and Mac.

  • I'm clearly struggling to understand C2's arrays. Here's how MY array looks in the debugger:

    0        [119,Pour,For,354]
    1        [125,Bonjour,Hello,128]
    2        [133,Comment,How,45]
    ..
    439      [450,Vingt,Twenty,235]
    [/code:1v028imz]
    
    Seems really straightforward.  There are 440 "rows" and each one I'm treating like a record.  The first column is a score, the second is a French word, the third is the English equivalent, and the last is my index.  Every 5 cards or so I sort everything by the score column.  That's all working great.
    
    But the C2 debugger reports an array WIDTH of 439 and a HEIGHT of 4.  So I guess I just have my vertices mixed up, right?
    
    In any event, I was able to get this working.  Thanks again for the help!
  • Thanks a lot dsminor. I really appreciate you taking the time to do that for me!

  • I have a 2 dimensional array with a width of 4 and a height of 438. (If I'm using those terms correctly, and I believe I am.) Imagine it looks something like this:

    [100,text,text,0]

    [124,text,text,1]

    [198,text,text,2]

    [113,text,text,3]

    [256,text,text,4]

    ...

    I have two variables called "over_100" and "under_100". How do I iterate through my array, row by row, and increment those two variables based on the data in the first column? (100, 124, 198, etc.)

    Another quick question: I've written a lot of stuff in Excel VBA over the years. Do C2's arrays work the same way? To iterate through a spreadsheet I use: "cells(row,col)" but I think that makes the height "x" and the width "y" which is backwards compared to C2, right?

  • Problem Description

    I'm working on a web app that uses speech synthesis. Unfortunately, the UserMedia function to add voices to a listbox does not work reliably on my iPad Plus or my iPhone 6+. (It only populates the list about 20% of the time.)

    Please not that this feature seems to work every time on my PC. I'm only having issues with my iOS devices.

    Attach a Capx

    To make sure it wasn't MY code causing the problem, I was using the "Speech Synthesis.capx" file in the Examples folder that comes with C2.

    Description of Capx

    The capx grabs a list of voices available on the device/browser and adds them to a listbox.

    Steps to Reproduce Bug

    • Go to my website using an iPhone 6+ or an iPad Plus (http://www.jmcdesign.orgfree.com).
    • Look at the voices in the listbox
    • Refresh the page over and over again (the listbox will frequently be empty)

    Observed Result

    The listbox is frequently empty when I reload the page. (About 75-80 percent of the time.)

    Expected Result

    The listbox should ALWAYS contain voices, so my users can choose an appropriate voice for their device.

    Affected Browsers

    I have seen similar results on both Safari and Chrome

    Operating System and Service Pack

    9.2.1

    Construct 2 Version ID

    r221 (64-bit)

  • My browser app includes speech synthesis which requires me to pick different "voices" depending on whether the user has a PC, an iPhone, an iPad, etc. The Browser object allows me to test for the platform ("Win32", "iPhone", or "iPad"), but I don't know what to use for Android. Does anyone know?

    NOTE: In a perfect world I would fill a list box with the voices available on the user's device, but this feature only seems to work reliably on PC. I'll enter a bug on that when I get some extra time.

  • I've been trying to wrap my head around the Local Storage object, but many of the tutorials only show how to save and retrieve a single value. But the asynchronous nature of this feature is the main thing throwing me for a loop -- at first I thought I had to request and retrieve values in sequence. Fortunately, last night I think it finally "clicked".

    This works, right? (I also need to check if the items exist and create them if they are missing, but I know how to do that.)

    [START GROUP]

    On start of layout:

      get item "player" get item "score" get item "sound"

    Set group "START GROUP" Deactivated

    [OPTIONS GROUP]

    On item "player" get

      System -> Set item global_player to localstorage.itemvalue

    On item "score" get

      System -> Set item global_score to localstorage.itemvalue

    On item "sound" get

      System -> Set item global_sound to localstorage.itemvalue

    I think I can even deactivate OPTIONS GROUP using "On All Gets Complete" right?

  • Nice game! Love the screen transition between levels. Very professional!