the script:
M0000 = "-"
M0001 = "Tackle"
M0002 = "Tail Whip"
M0003 = "Growl"
function yN()
selection=1
while true do
term.clear()
term.setCursorPos(1,1)
local x, y=term.getCursorPos()
term.clearLine()
if selection==1
then write(">Attack< Exit ")
else write (" Attack >Exit<") end
term.setCursorPos(x, y)
a, b=os.pullEvent()
while a~="key"
do a, b=os.pullEvent() end
if b==203 and selection==2 then selection=1 end
if b==205 and selection==1 then selection=2 end
if b==28 then print ("") break end
end
if selection==1 then return true end
if selection==2 then return false end
return false
end
function atk(m)
attack=1
l=#m
while true do
term.clear()
term.setCursorPos(1,1)
print("Select your move:")
for i=1, l, 1 do
if i==attack then print("["..m[i].."]") else print(" ", m[i]) end
end
a, b= os.pullEventRaw()
if a== "key" then
if b==200 and attack>1 then attack=attack-1 end
if b==208 and attack<l then attack=attack+1 end
if b==28 then break end
end
end
term.clear()
term.setCursorPos(1,1)
return attack
end
while yN() == true do
if selection == 1 then
local moves={
M0001,
M0002,
M0003,
M0000,
"Back"
}
local attack=atk(moves)
if attack == 5 then
if M0000 == "-" then
print("No Attack!")
sleep(1)
end
else
print(attack)
sleep(1)
end
else
if selection == 2 then
break
end
end
end