All pastes #590132 Raw Edit

Stuff

public lua v1 · immutable
#590132 ·published 2007-06-26 11:20 UTC
rendered paste body
--                       TAMS--Toribash Automated Move System--     coded by NewbLuck and Veb--Define globalsflag = { }        --Define and set flag states and globalstimer = { }flag['lp'] = 0flag['rp'] = 0flag['lk'] = 0flag['rk'] = 0timer['lp'] = 0timer['rp'] = 0timer['lk'] = 0timer['rk'] = 0move_lp = { }     --Define and set moves (simple for now, will do frame by frame later)for foo = 0 , 20 do move_lp[foo] = "31333333333333122333" endfor foo = 21 , 26 do move_lp[foo] = "12312312312312314444" endmove_lp['frames'] = 26local function on_frame()     --Finite state machine processing		if flag.lp == 1 then    --Start our Left Punch state block		local fooz = 0		local joint_foo = 0		freeze_game()		for fooz = 0, 19 do 			joint_foo = string.sub(move_lp[timer.lp],fooz + 1,fooz + 1)		    joint_num = tonumber(joint_foo)    		echo(fooz .. " " .. joint_num)			set_joint_state(0, fooz, joint_num) 		end		timer.lp = timer.lp + 1				if timer.lp == (move_lp.frames + 1) then			timer.lp = 0			flag.lp = 0		end	    unfreeze_game()	end		endlocal function key_pressed(key)    echo("keydown")	if (key == string.byte('k') and flag.lp == 0) then		flag.lp = 1		timer.lp = 0	    echo("Pressed " .. string.byte('k') )	endendlocal function start()flag['lp'],timer['lp'] = 0flag['rp'],timer['rp'] = 0flag['lk'],timer['lk'] = 0flag['rk'],timer['rk'] = 0echo(move_lp.frames)endadd_hook("new_game","TAMS", start)add_hook("key_down","TAMS", key_pressed)add_hook("enter_frame", "TAMS", on_frame)