Following Arcade Advanced - but getting unusual random error?

Hey hey!

Loving the Makecode Arcade Advanced tutorials. Was just recently reverse engineering the ‘Fishing Game’ as soon on this stream here - https://www.youtube.com/watch?v=TjpuN35u4-U&t=756s

However, after following the build guide almost exactly, I’m getting a ‘Program Error, Cannot read property of ‘field’ undefined’. However, if you keep refreshing the game console, it works after x amount of refreshes and without changing the code, but then it randomly doesn’t at other times. My code seems exactly like the video. Is there any logic to this? Can anyone help?

Pasting code for reference.

oo okay so this is the bit of code that is problematic!

This is what it is:

and this is what it should be:

(the difference is the -1 is inside the pick random’s right block, instead of picking a random one, and then minus-ing one)

happy to hear that you’ve been enjoying the streams! lemme know if you need any other help :smiley:

As a side note, this bug is fairly common / it’s hard to debug! In the next release we should have a new block that makes this a bit easier:

image

One other thing you can do when you see a crash like this, is to just open debug mode; when there is a crash in debug mode it stops immediately, just like if there was a breakpoint set there:

1 Like

Ah! I see now. Legends!

Again, thanks for the advanced streams. Something that was definitely missing to upskill users. Gaining a lot from it and also thank you for being so active on the forums so people like myself can continue to move forward with our projects in a timely manner! :slight_smile:

1 Like