To skip to the actual issue, look in the last paragraph. But you may need some backstory to the issue which I have provided here.
So I have slowed down with this recently but still plucking away when time permits. I am going to post a link to access my project here: Thunkable
Some of you may look at it and be horrified at the way I am trying to do it but it’s all I understand how to do at the moment. I’m not sure how to use the information from API’s to achieve what I want so this is my next best option.
I feel reasonably confident I am on the right track with it but can’t figure out why certain things happen.
For example, when a user clicks on the black king piece I have the code set the king to “app variable active piece or reference point”. The code should then check the surrounding squares to see if they are compromised or not. If they are then no move possibility should show here. If the square is not compromised then a button is created called “M” for move.
I tried to streamline the code to make it quicker by skipping over certain checks. For example; the code checks “UR1” first of all which stand for up and right of the active piece (in this case the piece called BK). It does this by creating another button called “KS” (Kings Scout) that the user will never be aware of it’s existence. The code uses KS as a reference point to check up, left, right etc. for any threats to that square. If it spots a threat it sets “app variable ‘UR1 is patrolled’” to true. It then does this for U1 etc.
Later the code detects whether ‘UR1 is patrolled’ is true or false. If true then it should not display an ‘M’ button at this location. If false, it should.
This appears to work for the most part as far as I can see. However, the issue is that U1 is displaying when it should not be. Has anyone got any idea why? Am I missing something silly? I will keep the code as is for now until I receive an answer so you can see what I am referring to.