Quote: "(maybe by setting o and p to high values once you have a selection)"
Or use exit, or simpler, move that section into a function then exit passing the required variable back.
However, I'd completely restructure your code to remove redundant calls. Based on the code you've provided, I'd probably do an object selecty thing like this...
`Assuming your object type has the following variables.
Type tObject
ObjectNumber
Selected
EndType
Dim Object( 100 ) As tObject
`Object( Obj ).ObjectNumber holds the object number.
`Object( Obj ).Selected flags if the object is selected or not.
`Another assumption: I'm assuming that you set PickObject based on a pick object statement somewhere in your main loop,
`and that you're correctly handling the M_Click variable
If MouseClick() = 1 and PickObject <> 0 and M_click = 0
`Firstly, I'd only call the select object code if you click the mousebutton, and you have clicked on an object.
`Saves on wasted clock cycles, plus you only really want to be reading these once per loop.
For Obj = 1 To ObjNum
`Iterate through your objects
If PickObject = Object( Obj ).ObjectNumber Then Object( Obj ).Selected = 1: M_click = 1: Exit
`If you clicked on an object then it's now selected. Set the mouse click variable then exit the For-Next loop now.
`You could also add a toggle to de-select objects too if you wanted.
Next O
EndIf
If it were my code, this would be in a stand alone function.
My signature is NOT a moderator plaything! Stop changing it!
