Okay...3D...Just make sure that your camera is at a fixed angle. If it is not then mouse control can be extrememly difficult.
Also, to do it in 3D, you can either have a 3D object as a cursor, or use trigonometry to position the mouse to a 3D plain, which can be very complex.
I am writing this on the fly, so I hope you understand it. First I will explain, then I will write it in pseudo-code. I will write some code for you later, I can't at the moment...
1-When the mouse is clicked, store its position and tell the program that the mouse button is down
2-Wait until the mouse button is unclicked, then store the new mouse position
3-Use the two mouse positions to see if any of the units are within the rectangle that was selected.
4-When the mouse button is being held down, draw a box around the selection area
The following code is not a program, but should help you out a little
mousedown=0
do
if mouseclick()=1 and mousedown=0
startx=mousex():starty=mousey():mousedown=1
endif
if mouseclick()=1 and mousedown=1
line startx,starty,mousex(),starty
line mousex,starty,mousex(),mousey()
line mousex(),mousey(),startx,mousey()
line startx,mousey(),startx,starty
endif
if mouseclick()=0 and mousedown=1
endx=mousex():endy=mousey():mousedown=0
for a=1 to numunits
if unit_on(a)=1
unit_selected(a)=0
inboundsx=0
if (unit_x(a)>startx and unit_x(a)<endx) or (unit_x(a)<startx and unit_x(a)>endx) then inboundsx=1
inboundsy=0
if (unit_y(a)>starty and unit_y(a)<endy) or (unit_y(a)<starty and unit_y(a)>endy) then inboundsy=1
if inboundsx=1 and inboundsy=1 then unit_selected(a)=1
endif
next a
endif
loop
This is quite simple, you should be able to understand it if you understand simple code. It uses arrays, if-then statements, a for-next loop, and a do-loop. I used mousex() and mousey() positions just for simplicity, if you use a 3D cursor then mousex() and mousey() will be replaced with object screen x(cursorobject) and object screen y(cursorobject).
Sorry if this was confusing, I will cut some code from Firewall to show you how to do it as soon as I get some time. In the mean time, check out Firewall for a sample of a Dark Basic 3D RTS game (web site below)
Xander Moser of Bolt Software
Firewall: Your Computer's First Defense - Real Time Strategy game
[href]

[/href]