Techrolls and teching-in-place in this game aren't good for Fox or really anyone. A smart player will just react to your techroll, and if they're character is fast enough, you won't be able to do anything. Having said that, it's still possible to escape in certain situations. In the following scenarios, assume it's a nice flat level like DL or middle of Hyrule unless I specifically say otherwise.
-IMO it's almost always better to second-jump out (if you can) than doing a tech roll. Doing this means you won't get grabbed, but this doesn't happen often. This happens to floatier characters a lot.
-Against slower characters, you should almost always tech away from them so they can't grab you. Works well against Puff, DK, Ness. Kirby too sometimes.
-If you're playing a good Ness, and they're trapping you with dair on the side platforms of DL, you need to hard left or right DI so you go past the platform onto the bottom level of the stage. Techrolling on the side platforms means death for Fox.
-Characters like Pika, Falcon, and Fox are fast enough to run you down. If they hit you/throw you away, and you see them sprint towards you, you have three options:
- Tech away, and hope beyond hope that you're far enough away that you can get a jab out before they grab you. This works ok against Pikachu, and jab can lead into an upsmash (or jab-shine-jab like me), Falcon will grab you 95%. Fox will most likely grab you, or laser you then grab you.
- Tech in place and jab/shine. This isn't really a good option when your opponent isn't near you. It's just less ground that they have to cover. I'll talk about this later.
- Tech towards them. This works pretty well if they're sprinting towards you because it's hard for them to stop sprinting and punish your tech in the time it takes you to get up. I can't prove this, but I feel like people are naturally inclined to tech the same way they're thrown which is why I see Falcons always trying to run down their opponent.
-Teching in place is usually good when your opponent is on top of you, and you're facing them when you get up from the tech. You can usually just jab them before they do anything. I'll do this against Ness a lot when Ness is spamming dair and you're just low enough that you don't bounce up in the air.
-So, now to your question about techrolling near walls (and it applies to ledges too). Don't do it. If you're right next to the wall, tech in place or tech away. You'll probably get punished either way, but teching towards the wall is just...so free to punish. You'll feel stupid for just rolling in a ball not going anywhere while you're opponent laughs at you quietly thinking to himself that you're a scrub who techrolls into walls.
-In the rarest occasions, you can even not tech at all. Fox's getup attack isn't terrible unless it's on shield (but that's everyone's getup attack). Or you can roll away and get away sometimes. This isn't Fox, but it's the same idea.
http://www.youtube.com/watch?v=PJEPllJpbrA&feature=player_detailpage#t=703s
You can see Boom was totally prepared to run him down, and he ran past Isai just a little bit. When he saw the no-tech, he jumped backwards. Seeing this, Isai rolled away from Boom leading to a jab. Isai got punished after that, but that was his fault not Mario's.
There isn't ONE good way to techroll for every scenario. 80% of the time you're going to get punished no matter what. In that remaining 20%, 15% of the time you chose the wrong way to get out of the situation and you're getting punished.
Lastly, it's important to remember that when you techroll, it's because you made a mistake and you got hit. If you can figure out why you got hit, and avoid that, then there's no need to techroll. So, don't get hit.