You are getting off base and getting confused by the different posts. Klaus was helping you fix basic errors. Dunbarx was talking about fixing the intersecting buttons. Their advice was good but you are mixing up the suggestions. If you pre-arrange your buttons to spots that do not intersect, you will not need to perform and corrective actions. Right now, the locations you are using are messed up and overlapping or incorrect.
I was working with your original code. It was basically correct. What you are running into now are the result of your original list. It has become corrupted or your buttons misplaced. Let us start fresh
Go back to your first post and that code. Change it to the following:
Code: Select all
global tLocList
on preOpenCard
scrambleBtns
end preOpenCard
on scrambleBtns
repeat with i = 1 to 10
put the loc of button i & CR after tLocList
end repeat
delete char -1 of tLocList
sort lines of tLocList by random(100)
repeat with i = 1 to 10
set the loc of button ("b" & i) to line i of tLocList --this line is changed
end repeat
end scrambleBtns
(What I have done is moved your code to a separate handler so that you can test it and play with it. You do not have to close and open up the stack everytime to test your code. )
Make sure that your buttons are named "b1", "b2", ...."b10". Arrange them as you want.
To test your code, open up the message box and type "scrambleBtns".
If you get an error, look at your data (tLocList) and see what is wrong with it. Let us know what error you get and what the list looks like.
To look at your data (tLocList) at any time do the following: At the bottom window of your code screen is a tab labelled "variables". Click on that and scroll down to your variable "tLocList". Click on the magnifying glass to the right and you can see what your list looks like.
Is it correct? Do the points all look good?