2 Things.
Firstly you don't need to use
else if together like that
if x=20
do something
else
do something else
endif
Is how its supposed to work. It took me a while to work out why you had an extra endif command.
This is what you'd put
if Flag=0
Ellipse screenposx,screenposy,10,10
else if Flag=1
Ellipse screenposx,screenposy,5,5
Endif
Endif
where as the compiler is seeing it like this...
if Flag=0
Ellipse screenposx,screenposy,10,10
else
if Flag=1
Ellipse screenposx,screenposy,5,5
Endif
Endif
and secondly, I didn't really have enough of your code to run it. But I think what your problem is is that you'r reseting the selected variable every loop.
You have these two lines right next to each other, so even on a slow pc we're talking thousandths of a second; not enough time for the user to let go of the button.
if mouseclick()=1 and object(T).selected=0 then object(T).selected=1
if mouseclick()=1 and object(T).selected=1 then object(T).selected=0
Are you sure you want to make object(T).selected=0? Or have I misread your code?
I made a short example of what I think your trying to do; so please look through it and see if it can help in your program
//**************************************
// Highlighting example
// For: Lucifer 1101
// By: =PRoF=
//**************************************
` system stuff
sync on
sync rate 60
` set a variable
selected=0
do
` clears the screen
cls
` draws some boxes for buttons
box 10,10,20,20
box 30,10,40,20
box 50,10,60,20
` saves me typing mousex() & mousey() again and again :P
mx=mousex()
my=mousey()
` Is LMB pressed
if mouseclick()=1
` check button 1
if mx>10 and mx<20 and my>10 and my<20
selected=1
endif
` check button 2
if mx>30 and mx<40 and my>10 and my<20
selected=2
endif
` check button 3
if mx>50 and mx<60 and my>10 and my<20
selected=3
endif
endif
` draw the ellipses if a button is selected
if selected=1
ellipse 14,14,9,9
endif
if selected=2
ellipse 34,14,9,9
endif
if selected=3
ellipse 54,14,9,9
endif
` debug information
text 0,40,str$(selected)
` update screen
sync
loop
Did you want a selected object to become unselected when the user clicks on an empty space?
Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@