I'm not entirely sure how things work in AGS but generally declaring int x in repeadetly execute always isn't a good idea. It should be declared once and then one should change the value in the repeatedetly execute always function. I'm sorry if this is too off topic but I would really like someone to confirm that (pm is fine too)
Anyway, it's great to watch you work. A lot can be learned!