[help] random script not working

this is the full code that im working on currently.
as you can see after it states the new x,y coordinates, that i have a “battle(m+1);” statement, would i be correct in saying that this ads +1 to the value of ‘m’ every time the script is exicuted?

therefore with the code down the bottom.
t = m + 9
would become:
t = 1 + 9
which = 10
and put that into the ‘p’ value
p = ((t/10)-1)*5
((10/10)-1)*5
=0
or say that he took 11 steps
p = ((20/10)-1)*5
=5


hero = _root.character;  //name of mc for the hero
s = 4;
b = _root.character.getBounds(_root.character);
function move(x, y) {
	if (!_root.walls.hitTest(hero._x+x+b.xmin+1, hero._y+y+b.ymin+1, true)) {
		if (!_root.walls.hitTest(hero._x+x+b.xmax-1, hero._y+y+b.ymin+1, true)) {
    		if (!_root.walls.hitTest(hero._x+x+b.xmin+1, hero._y+y+b.ymax-1, true)) {
			if (!_root.walls.hitTest(hero._x+x+b.xmax-1, hero._y+y+b.ymax-1, true)) {
					hero._x += x;
					hero._y += y;
					battle(m + 1);
				}
			}
		}
	}
}
if (Key.isDown(Key.UP)) {
	move(0, -s);
	with(character){
	  gotoAndStop("char_bk");
	  }
}
if (Key.isDown(Key.DOWN)) {
	move(0, s);
	with(character){
	  gotoAndStop("char_fwd");
	}	
}
if (Key.isDown(Key.LEFT)) {
	move(-s, 0);
	with(character){
	  gotoAndStop("char_lft");
}	
}
if (Key.isDown(Key.RIGHT)) {
	move(s, 0);
	with(character){
	  gotoAndStop("char_rt");
}	
}
if (!Key.isDown(key.UP) & !Key.isDown(key.DOWN) & !Key.isDown(key.LEFT) & !Key.isDown(key.RIGHT)) {
	with(character){
		gotoAndStop("char_stl");
	}
}

//make the battle happen!! \m/
var t, m, p, r
function battle(m){
t = m + 9		 	// t = steps take + 9 ( to give =>10 to allow for small numbers )
m = 0				   //steps taken
p = ((t/10)-1)*5		//percentage of battle
r = random(100)+1;		//random integer between 1-200


if (p > r) then
	battle = false;
if (p <= r) then
	battle = true;
	
if (battle = true) then
	gotoAndPlay("battle");
if (battle = false) then
	
}

cheers
AnniHilatE:ninja: