I am still new to Computercraft programming, so if this code is extremely long for what it should be doing, or it has terrible formatting, I am sorry.
--testproj
--Made by Zoroark173
local var = 0
local var2 = 10
local var3 = 7
local var4 = 1
local i = 1
function clean()
term.clear()
term.setCursorPos(1,1)
end
function creature()
var = math.random(1,6)
if var==1 then
monster = "Goblin"
elseif var==2 then
monster = "Giant Spider"
elseif var==3 then
monster = "Dragon Hatchling"
elseif var==4 then
monster = "Evil Guy"
elseif var==5 then
monster = "Zombie"
elseif var==6 then
monster = "Skeleton"
end
end
--Declaring variables and functions
--------------------------------------
--Bulk of the program
clean()
print("Hello, welcome to SwordQuest!")
print("Type 1 to start the game!")
print("Or 2 to see the Help section!")
startmenu = read()
if startmenu == "2" then
print("Type 1 at the main screen to start the game")
print("Commands avalible in-game are Move, Attack, and Potion")
print("Move brings you to a new monster.")
print("Attack attacks the monster.")
print("Potion uses a healing potion.")
print("Contact Zoroark173 for more info!")
sleep(7)
print("Please restart me")
end
--Help section
--------------------------------
--In battle
if startmenu == "1" then
repeat
clean()
creature()
print("A "..monster.." is attacking!")
print("Move, Attack, or Potion?")
battle = read()
if battle == "Potion" then
var2 = 10
print("Heal Complete!")
print("HP: "..var2)
print(monster.." attacks!")
var2 = var2-1
print("HP: "..var2)
end
elseif battle == "Attack" then
var3 = var3-1
print("Did 1 damage to "..monster)
var2 = var2-1
print(monster.." did 1 damage to you.")
end
elseif battle == "Move" then
clean()
creature()
i = i+1
end
until var4 == 100
end












