But the servo swipes only fraction of what it should (like 75-90) and motors spin continuously in one direction without stopping and changing direction
Now we are into having time-sliced programs.
If you test things with just a PAUSE 20 in the 'DoSomething' routine the back and forth of the servo should be quite consistent; about 3 seconds in each direction. A larger PAUSE value slows it down, a smaller value speeds it up.
The key to making it work is that the 'DoSomething' routine only lasts for 20 ms or however long you need things to last.
Thus, when you add things like setting motor direction and then pausing for a few seconds the routine won't return, the servo motion will drop to an imperceptible crawl. With the code you have I calculate over 10 minutes for one sweep of the servo from left to right and back again.
You need to code 'DoSomething' in a manner which it doesn't excessively delay, doesn't include any PAUSE command longer than you need to make the servo move at the right rate.
One way to do that is to track time. For the first 1000ms you want the buggy to move forward, to stop for 500ms, reverse for 1000ms and stop again for 500ms. A sequence length of 3000ms, with the motor being set at 0ms, 1000ms, 1500ms and 2500ms.
This, untested, should do that repeatedly while still sweeping the servos at the desired rate -
Code:
Symbol varB = w1
buggymove:
Select Case varB
Case 0
low B.0,B.1 'motor forward
low B.3: high B.2
low B.4,B.5
low B.7: high B.6
Case 1000
low B.2,B.3 'motor stop
low B.6,B.7
Case 1500
low B.2: high B.3 'motor reverse
low B.6: high B.7
Case 2500
low B.2,B.3 'motor stop
low B.6,B.7
End Select
Pause 20
varB = varB + 20 // 3000
Return
But, before that. You need to figure out why the code you had doesn't stop and reverse the motors. Write a program which just tests the motors, ignore the servo, ignore trying to make motors and servo work together for now.
There are three possibilities. Either the code isn't right, you are not setting the correct HIGH and LOW states for the motor pins, there is some conflict breaking things, or the motors turning on is causing the PICAXE to reset and start again, which turns the motors on, causes a reset, and you never escape that endless cycle.
It would be worth letting us know what hardware you have, the motor controllers used and how everything is wired.
I do note you are using B.4 as the servo signal but that also appears to be used as one of the motor control signals. This may be the conflict which is causing things not to work.