First off, Welcome to TRS!
well your automatic hubs are probably shot. it is very common because they are a weak link in the system. To make sure your tranfer case is acctually engaged in 4wd you can do this easy process. in 2wd, climb under your truck. you can rotate the front drive shaft (going from the transfer case to the front differential) you can also rotate the front axle (drive shaft going to each wheel).
Now turn the truck on, select 4hi and repeat process. if your transfer cases is engaging, the front drive shaft should no longer be able to spin freely. This is because it is now locked in. To tell if your front hubs are any good, try and spin the front axle. if these spin then your hubs are shot and need to be replaced. if your front axle and drive shaft do not spin then your 4wd is working fine.
Also repeat in 4wd low to make sure that the transfer case is still able to select 4wd low.
Now I am going to assume that your hubs are no longer working as that was the problem with my 97 ranger and many others on this site. I would replace them with a set of Manuel locking hubs. These are much stronger and will no longer become the weakest link in your 4wd truck.
I know of two companies that make hubs for the ranger, First is WARN and second is MileMarker. I have warn hubs on mine and have never had a problem. Almost everyone seems to praise warn. I have also heard decent things about milemarker, however they are a little cheeper than warn.
Here are some links that will tell you how to replace the hubs
Hub Trouble shooting
Tech Library How-To
Standard vs Jeep Hub (a even better alternative)
Hope this helps.