Auto Walking + Speed increase

Hey guys i just need some easy newbie help here,

What part of the Standard First Person Controler ( FPSWALKER ) code do i need to edit to achieve the following.

i want the player to automatically walk in one direction on the X axis ( Left or Right ), and every 10 seconds the walk speed increases.

I would only know how do this in a simple 2D C# code which would be something like

Int Speed = 10 ;

{ Timer (10 seconds)} Speed = Speed + 5; }

Void { Player.Left = Speed; } "

If that makes sense,

Here's one way to do it using a tweaked coroutine from the Penelope tutorial. Should be fairly easy to convert to C#. And there's probably a smarter way to restart the CheckTime().

edit Here's the code from my original response integrated with FPSWalker.js as requested. Note I think the reason you were having trouble is because I had accidentally put a lower-case "s" in start(). Start() needs to be upper-case d'oh!

@script RequireComponent(CharacterController)

var speed = 6.0;
var jumpSpeed = 8.0;
var gravity = 20.0;
var delay = 10.0; // amount of time to wait before increasing speed

private var timeLeft : float;
private var moveDirection = Vector3.zero;
private var grounded : boolean = false;

function Start() {
    timeLeft = delay;
    CheckTime();
}

function FixedUpdate() {
    if (grounded) {
    	// We are grounded, so recalculate movedirection directly from axes
    	moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
    	moveDirection = transform.TransformDirection(moveDirection);
    	moveDirection *= speed;

    	if (Input.GetButton ("Jump")) {
    		moveDirection.y = jumpSpeed;
    	}
    }

    // Apply gravity
    moveDirection.y -= gravity * Time.deltaTime;

    // Move the controller
    var controller : CharacterController = GetComponent(CharacterController);
    var flags = controller.Move(moveDirection * Time.deltaTime);
    grounded = (flags & CollisionFlags.CollidedBelow) != 0;
}

function CheckTime() {
    while (timeLeft > 0) {
        yield WaitForSeconds(1);
        timeLeft -= 1;
        Debug.Log(timeLeft);
    }
    speed += 5; // increase character controller speed
    timeLeft = delay; // reset timeLeft to 10
    TimerExpired();
}

function TimerExpired() {
    CheckTime(); // restart the coroutine
}

Almost forgot to answer your other question. To make your character walk forward automatically, replace this line in fpswalker.js:

moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));

with something like this:

moveDirection = Vector3(1, 0, 0); // moves character along the x axis

var speed = 6.0; var jumpSpeed = 8.0; var gravity = 20.0;

private var moveDirection = Vector3.zero ; private var grounded : boolean = false;

function FixedUpdate() { if (grounded) { // We are grounded, so recalculate movedirection directly from axes moveDirection = Vector3(1, 0, 0); // moves character along the x axis

	moveDirection = transform.TransformDirection(moveDirection);
	moveDirection *= speed;
//	moveDirection + 20;

	if (Input.GetButton ("Jump")) {
		moveDirection.y = jumpSpeed;
	}
}

// Apply gravity
moveDirection.y -= gravity * Time.deltaTime;

// Move the controller
var controller : CharacterController = GetComponent(CharacterController);
var flags = controller.Move(moveDirection * Time.deltaTime);
grounded = (flags & CollisionFlags.CollidedBelow) != 0;
}

@script RequireComponent(CharacterController)

After reading and understand your code i still dont get it , where does it go in fpswalker ( and i think it does conflict with 'var speed 6;'