I think I can get you started a little bit.
Firstly, will there be a limit to number of units you can select at one time? That could greatly reduce calculations if you're going to have 500 units.
To select units, get the four corners of a selection box(sx,sy,etc.):
amount_selected = 0
for obj = 1 to number_of_units
x = object screen x(obj)
y = object screen y(obj)
if x>sx1 and x<sx2 and y>sy1 and y<sy2
inc amount_selected, 1
select_unit(obj)
endif
rem exits the FOR loop
if amount_selected = max_allowed then exit
next obj
To assign group numbers is easy:
REM Assigns group number specified to the current selected units
_Assign_Group_Number:
if controlkey()
number=scancode()
endif
select number
case 2 : UN=1 : endcase
case 3 : UN=2 : endcase
case 4 : UN=3 : endcase
case 5 : UN=4 : endcase
case 6 : UN=5 : endcase
case 7 : UN=6 : endcase
case 8 : UN=7 : endcase
case 9 : UN=8 : endcase
case 10: UN=9 : endcase
case default : UN=0 : endcase
endselect
if UN > 0 then write code to select units of that group
And finally, how to draw a box!
_object_selection:
if mouseclick()=1 and selection_flag = 0
sx1 = mousex()
sy1 = mousey()
selection_flag = 1
endif
if selection_flag = 1
sx2 = mousex()
sy2 = mousey()
outline(sx1,sy1,sx2,sy2)
gosub _get_selected_units
if mouseclick()=0 then selection_flag = 0
endif
RETURN
REM Draw unit selection box
function outline(x1 as float, y1 as float, x2 as float, y2 as float)
b = 0
if sx1 > sx2
b=sx1
sx1=sx2
sx2=b
endif
if sy1 > sy2
b=sy1
sy1=sy2
sy2=b
endif
line x1,y1,x2,y1
line x1,y2,x2,y2
line x1,y1,x1,y2
line x2,y1,x2,y2
endfunction
That about cover all your questions for now?
"eureka" - Archimedes