--Newbie Trainer
--By SrgtCorn
--A simulation of an online player to help Newbies get better.
local function start()
helloworld()
end
local function helloworld()
local a = "Newbie Trainer"
echo(a)
end
local function hello()
draw_text("Good luck against my bot! It shouldn't be too hard to beat...", 0, 300
end
local function joint_state, x, y, z = 0, 0, 0, 0, 0
local player_index, hand_id, grip_state = 0, 11, 1
set_grip_info( player_index, hand_id, grip_state)
echo ("set_grip_info (" .. player_index .. ", " .. hand_id .. ", " .. grip_state .. ")")
local player_index, hand_id, grip_state = 0, 12, 1
set_grip_info( player_index, hand_id, grip_state)
echo ("set_grip_info (" .. player_index .. ", " .. hand_id .. ", " .. grip_state .. ")")
set_joint_pos (player_index, joint_index, x, y, z)
local player_index, joint_state = 0, 1
local player_index, joint_state = 1, 1
local player_index, joint_state = 2, 1
local player_index, joint_state = 3, 1
local player_index, joint_state = 4, 1
local player_index, joint_state = 5, 1
local player_index, joint_state = 6, 1
local player_index, joint_state = 7, 1
local player_index, joint_state = 8, 1
local player_index, joint_state = 9, 1
local player_index, joint_state = 10, 1
local player_index, joint_state = 11, 1
local player_index, joint_state = 12, 1
local player_index, joint_state = 13, 1
local player_index, joint_state = 14, 1
local player_index, joint_state = 15, 1
local player_index, joint_state = 16, 1
local player_index, joint_state = 17, 1
local player_index, joint_state = 18, 1
local player_index, joint_state = 19, 1
for i=0,19 do
echo ("set_joint_state (" .. player_index .. ", " .. i .. ", " .. joint_state .. ")")
set_joint_state (player_index, i, joint_state)
end
run_cmd("exportworld jointsWide.tbm")
end
add_hook("new_game", "unique_group_name", hello)
local function pain()
local a = get_player_info(0)
local b = get_player_info(1)
if b.injury > 20000 then
centerprint("Ouch","","I think you may have won!",100)
else
if a.injury > 10000 then
centerprint("Ouch,"","Try again",100)
end
end
end
echo("Newbie Trainer 0.1 Alpha")
echo("By SrgtCorn")
end
Here's an alpha prototype of my script "Newbie Trainer". It doesn't work, and I know that probably everything is wrong with it. Some hints or help on what to do/fix would be useful. (I didn't set the joints to any position yet, but I'm not sure if I wrote the joint number in the right spot, anyway.)
P.S. If this script is a completly embarassing disaster that is nearly unfixable, I'll just not bother anymore.
--Newbie Trainer --By SrgtCorn --A simulation of an online player to help Newbies get better. local function start() helloworld() end local function helloworld() local a = "Newbie Trainer" echo(a) end local function hello() draw_text("Good luck against my bot! It shouldn't be too hard to beat...", 0, 300 end local function joint_state, x, y, z = 0, 0, 0, 0, 0 local player_index, hand_id, grip_state = 0, 11, 1 set_grip_info( player_index, hand_id, grip_state) echo ("set_grip_info (" .. player_index .. ", " .. hand_id .. ", " .. grip_state .. ")") local player_index, hand_id, grip_state = 0, 12, 1 set_grip_info( player_index, hand_id, grip_state) echo ("set_grip_info (" .. player_index .. ", " .. hand_id .. ", " .. grip_state .. ")") set_joint_pos (player_index, joint_index, x, y, z) local player_index, joint_state = 0, 1 local player_index, joint_state = 1, 1 local player_index, joint_state = 2, 1 local player_index, joint_state = 3, 1 local player_index, joint_state = 4, 1 local player_index, joint_state = 5, 1 local player_index, joint_state = 6, 1 local player_index, joint_state = 7, 1 local player_index, joint_state = 8, 1 local player_index, joint_state = 9, 1 local player_index, joint_state = 10, 1 local player_index, joint_state = 11, 1 local player_index, joint_state = 12, 1 local player_index, joint_state = 13, 1 local player_index, joint_state = 14, 1 local player_index, joint_state = 15, 1 local player_index, joint_state = 16, 1 local player_index, joint_state = 17, 1 local player_index, joint_state = 18, 1 local player_index, joint_state = 19, 1 for i=0,19 do echo ("set_joint_state (" .. player_index .. ", " .. i .. ", " .. joint_state .. ")") set_joint_state (player_index, i, joint_state) end run_cmd("exportworld jointsWide.tbm") end add_hook("new_game", "unique_group_name", hello) local function pain() local a = get_player_info(0) local b = get_player_info(1) if b.injury > 20000 then centerprint("Ouch","","I think you may have won!",100) else if a.injury > 10000 then centerprint("Ouch,"","Try again",100) end end end echo("Newbie Trainer 0.1 Alpha") echo("By SrgtCorn") end
--Newbie Trainer
--By SrgtCorn
--A simulation of an online player to help Newbies get better.
function grip(hand)
if(hand == "left") then
h = 11
elseif(hand == "right") then
h = 12
else
h = 11
end
player_index, hand_id, grip_state = 0, h, 1
set_grip_info( player_index, hand_id, grip_state)
echo ("set_grip_info (" .. player_index .. ", " .. hand_id .. ", " .. grip_state .. ")")
end
function set_joints()
for i=0,19 do
joint_index, joint_state = i, 1
echo ("set_joint_state (" .. player_index .. ", " .. i .. ", " .. joint_state .. ")")
set_joint_state (player_index, i, joint_state)
end
end
function hello()
echo("Blam :D")
grip("left")
grip("right")
set_joints()
end
add_hook("new_game", "unique_group_name", hello)
local function pain()
local a = get_player_info(0)
local b = get_player_info(1)
if b.injury > 20000 then
centerprint("Ouch","","I think you may have won!",100)
else
if a.injury > 10000 then
centerprint("Ouch","","Try again",100)
end
end
end
add_hook("enter_frame","bees",pain)
echo("Newbie Trainer 0.1 Alpha")
echo("By SrgtCornhole")
you need to check your ends and such.
check stderr.txt for better errors.
SrgtCornhole--Newbie Trainer --By SrgtCorn --A simulation of an online player to help Newbies get better. function grip(hand) if(hand == "left") then h = 11 elseif(hand == "right") then h = 12 else h = 11 end player_index, hand_id, grip_state = 0, h, 1 set_grip_info( player_index, hand_id, grip_state) echo ("set_grip_info (" .. player_index .. ", " .. hand_id .. ", " .. grip_state .. ")") end function set_joints() for i=0,19 do joint_index, joint_state = i, 1 echo ("set_joint_state (" .. player_index .. ", " .. i .. ", " .. joint_state .. ")") set_joint_state (player_index, i, joint_state) end end function hello() echo("Blam :D") grip("left") grip("right") set_joints() end add_hook("new_game", "unique_group_name", hello) local function pain() local a = get_player_info(0) local b = get_player_info(1) if b.injury > 20000 then centerprint("Ouch","","I think you may have won!",100) else if a.injury > 10000 then centerprint("Ouch","","Try again",100) end end end add_hook("enter_frame","bees",pain) echo("Newbie Trainer 0.1 Alpha") echo("By SrgtCornhole")