I require assistance with this script!

Hello everyone!
So I have been working with blender for a while now, and I need a little help creating a script that will allow the user to modify the force at which an object moves, in the game engine. I have been working on this for a while now, and I have gotten a skeleton of the script done, but it’s not working and I have a few questions

First off, here’s what I have:
Code:

import GameLogic as g
from g import *

cont = getCurrentController() 
ow = cont.owner # new syntax
sc = g.getCurrentScene()
hud = sc.objects['grav'] 

senslist = cont.sensors # new syntax 
actlist = cont.actuators # new syntax
mousesensor = senslist[0] 
force = actlist[0]

forcex = 0
forcey = hud['Text']
forcez = 0 
forcel = 0

mousesensor = cont.sensors['W']
force = cont.actuators['Forward']

I’m not really sure about everything that is wrong, but I have a feeling that the issue is that the script is written in the Python 2.6 API and blender 2.53 uses the 3.1 API