# Freeze on Array loop Mathematical equation

Bugs will be moved here once resolved.

### » Sun Jul 30, 2017 5:04 pm

Problem Description
- Freezes the entire browser without error warning.
- Aparently caused for trying to do an ecuation in an array inside a loop (any kind of ecuation, example "Array.at(x,y)+1")

Attach a Capx
needed pluggin (error not affected by puggin): https://drive.google.com/open?id=0B7w6u ... EI0UEhNa2s

Description of Capx
It creates a noise array

Steps to Reproduce Bug
• Run the CapX to see it freeze
• Change action "Set Value getground to 1"
• Run CapX to see it work
• Change action back to "Set value getground to Array.At(getx,gety)+1"
• Change the Array action to "Set Value at (0,0) to getground"
• Run CapX to see it work

Observed Result
The CapX freezes if an ecuation uses the array value.

Expected Result
Resolve the math ecuation.

Affected Browsers
• Chrome: (YES)
• FireFox: (YES)
• Internet Explorer: (YES)

Operating System and Service Pack
Win 7 SP1 64bit

Construct 2 Version ID
Beta 245
B
27
S
4
Posts: 120
Reputation: 1,539

### » Sun Jul 30, 2017 8:57 pm

If you intend to write more events to this (dont know if thats gonna be the case), that wait will bring you hopeless problems.

Besides that.

Use Browser plugin to log Sprite.UID&"/"&loop&"**"&Pico to the console in your last loop.
'loop' in there is a global variable you add 1 to in that last event.
Watch it run in Chrome's console.

At any iteration you (mostly) write a bigger number on a 'next' index in the array. It rarely resets.
So next iteration, when that next index is used, pico grows according, and keeps growing.

When the sprite 50 is picked, it allready does like 120.000 iterations. At that moment you write the same value on the same place in the array like 3000 times.

It is freezing because you created a near endless loop.
B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

### » Tue Aug 01, 2017 3:14 am

Intresting, ill check the logic again, thanks
B
27
S
4
Posts: 120
Reputation: 1,539

### » Fri Sep 15, 2017 2:33 pm

The .capx uses a third-party addon "Gashapon". Please see the bug report requirements, we don't accept projects depending on third-party addons. Closing.
Scirra Founder
B
414
S
245
G
92
Posts: 25,198
Reputation: 200,327