Code presenting problems in mobile device browsers but working on desktops

0 favourites
  • 6 posts
From the Asset Store
A futuristic device, can be used as radarscreen, optionscreen, infodisplay, research device, ...
  • The code below is working normally in desktop browsers and presenting a duplication error in the first digit when opened in mobile device browsers. It also happens on edge in the latest version when opened on a laptop (the same version works normally on a PC).

    Could anyone take a look and see if they can find any possible problems in the code?

    [LettersS_Interval]

    ----+ System: Trigger once

    -----> System: Set totalCharacters to 0

    -----> System: Set countDigits to 0

    -----> System: Set count to 1

    -----> System: Set amount to 10

    -----> System: Set totalCharacters to amountOfDigits

    -----> Array: Set size to (10, 1, 1)

    -----> Array: Set value at 0 to "A"

    -----> Array: Set value at 1 to "B"

    -----> Array: Set value at 2 to "C"

    -----> Array: Set value at 3 to "D"

    -----> Array: Set value at 4 to "E"

    -----> Array: Set value at 5 to "F"

    -----> Array: Set value at 6 to "G"

    -----> Array: Set value at 7 to "H"

    -----> Array: Set value at 8 to "I"

    -----> Array: Set value at 9 to "J"

    -----> System: Create object timer on layer "PanelTXT" at (34, -37), create hierarchy: False, template: ""

    -----> AdvancedRandom: Create permutation with amount values starting at 0

    -----> timer: Start Timer "changeDigit" for 1.5 (Regular)

    ----+ timer: On Timer "changeDigit"

    --------+ System: totalCharacters > 0

    ------------+ System: Pick panelText where panelText.id = countDigits+1

    -------------> panelText: Set text to Array.At(AdvancedRandom.Permutation(countDigits-1))

    -------------> textTemp: Append Array.At(AdvancedRandom.Permutation(countDigits-1))

    ----------------+ System: Trigger once

    -----------------> System: Wait 0.75 seconds

    -----------------> panelText: Set text to "*"

    -----------------> System: Wait 0.75 seconds

    -----------------> System: Add 1 to countDigits

    -----------------> System: Subtract 1 from totalCharacters

    --------+ System: Else

    ---------> System: Set countDigits to 0

    ---------> System: Wait 0.75 seconds

    ---------> System: Set keyActive to True

    ---------> timer: Stop Timer "changeDigit"

    ---------> timer: Destroy

    ---------> System: Set group "LettersS_Interval" Deactivated

    ------------+ System: Is timerController

    -------------> System: Set group "Timebar" Activated

    ----+ System: Repeat amount times

    --------+ System: Pick keyText where keyText.id = count

    ---------> keyText: Set text to Keyboard.StringFromKeyCode(64+count)

    ---------> System: Add 1 to count

  • Maybe the problem could be the "Timer"? Has anyone experienced this type of problem before?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is there anyone who could help me solve this problem? I've been stuck on this for over 3 days now. I just need some ideas.

  • It's always hard to debug projects without actually having the project at hand. The codeblock you copypasted is also just kinda hard to read, a screenshot of the events is better. But ideally you can provide a project file that demonstrates the issue.

    One guess could be that "Wait 0.75 seconds" leads to some kind of issue. Wait in general is tricky to use and can lead to a bunch of problems.

    Also what exactly is a "duplication error in the first digit"? Can you post a comparison between the error and what the result actually should look like?

  • Thanks for answering.

    Sorry for only including this part of the code, but it is long and only this part presents an error. I'm including a printscreen to make it easier to read.

    Regarding the error: this part of the code should display a total (totalCharacters) of digits (letters or numbers) one by one with a pause of 1.5 seconds between them and as it shows each digit, it then shows an asterisk in its place.

    Example with 3 digits:

    Step 1: 7

    Step 2: *

    Step 3: * 4

    Step 4: * *

    Step 5: * * 1

    Step 6: * * *

    The error that occurs is that the first digit (7 in the example) is repeated 2 times, generating 4 digits in the result, instead of 3

    Example of a 3-digit error:

    Step 1: 7

    Step 3: *

    Step 4: 7

    Step 5: *

    Step 6: * 4

    Step 7: * *

    Step 8: * * 1

    Step 9: * * *

    I replaced the timer for every second event to see if the error could be in the behavior, but it didn't solve it. The strangest thing is that this problem only appears in mobile device browsers. In the 3 desktop browsers (edge/chrome/firefox) this system works perfectly

  • Still kind of hard to tell what actually is going on but regardless, it's very unusual that mobile browsers would work different.

    Wild guess, but you have 2 "wait 0.75 seconds" actions inside the every "1.5 seconds" condition. So perhaps there is some weird overlap happening due to some rounding error. Maybe changing the second wait to be slightly shorter could fix it?

    Otherwise you'll have to post the project to check out because I don't think anyone can find out what would cause this without being able to check out the project myself.

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