Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- File: Builder
- -- Author: cmoa
- -- Version: 0.1
- -- Required mod: Computercraft
- --
- -- This is currently an alpha version.
- -- The creator AND ONLY HIM is allowed
- -- to distribute this document. If
- -- you got it from a third person,
- -- you need to ask the creator the
- -- permission to use this file.
- --[[
- Initialisation
- ]]--
- w,h = term.getSize()
- init_args = { ... }
- init_command = init_args[1]
- init_parameter = init_args[2]
- builds_names = {"wood_house","tower","dog_house","cobble_castle"}
- builds_names_village = {"small_1","small_2","small_3","big_1","big_2","library","forge","church","light_post","weel","farm"}
- builds_materials = {{{57,"planks",0},{12,"log",0},{64,"oak_stairs"},{6,"oak_stairs"},{6,"wooden_slab",0},{8,"glass_pane"},{1,"wooden_door"},{1,"crafting_table"},{2,"furnace"},{2,"chest"},{1,"bed"},{4,"torch"},{1,"wooden_pressure_plate"}},{{59,"cobblestone"},{4,"stone_stairs"},{4,"stone_slab",3},{1,"iron_door"},{2,"stone_button"},{5,"ladder"},{1,"crafting_table"},{1,"chest"},{2,"torch"}},{{2,"log"},{3,"planks",0},{5,"oak_stairs"},{5,"wooden_slab",0},{2,"wool"},{1,"torch"},{1,"item_frame"},{1,"bone"}},{{7,"cobblestone"},{1,"water_bucket"},{1,"lava_bucket"}},{}}
- builds_materials_village = {{},{},{},{},{},{},{},{},{{3,"fence"},{1,"wool",15},{4,"torch"}},{{60,"cobblestone"},{8,"fence"},{1,"water_bucket"},{1,"water_bucket"}},{{28,"log",0},{28,"dirt",0},{1,"water_bucket"},{1,"water_bucket"},{1,"water_bucket"},{1,"water_bucket"}}}
- castle_blueprint = "[j(#022~)]q[j(#009~)]np0gpgpglq1gn0gpgpgpgo2ijr0[[[(:~).(#005j.k~)](:~)]s(#005~)]ojqghpgpglnhs[>^(#016~)]q0[[[(:~).(#005j.k~)](:~)]s(#886~)]pjjjjpjjjjjr[[[(!,^)hj(#024~)]jqjj(#004~)](#009~)n][j(#024~)]ooooooq[j(#013~)]psmsmoslslslsosmsmsmsoslslslsp[j(#011~)][[nh(#009~)]pjooooooooo[j(#023~)](#004~)j]p[j(#019~)]nll0[(#016~)>^]r0[[[(:~).(#005j.k~)](:~)]s(#864~)]pjoojjjjjnnpjjjjjr[[[(!,^)hj(#024~)]jjjqjjjj(#004~)](#009~)n]jjjjjqjjjoooooooojjjq0[(#016~)>^]r0[[[[(:~).(#005j.k~)](:~)]s(#064~)](#016~)]rjjjjjjoojjjqjjjjjj[[kg(#031~)]pkgp[kg(#031~)]q(#016~)kgq^]nh5jp[j(#014~)]psmsmsmsnslslslsnsmsmsmsnlslsr[j(#022~)]qjjjjjjjjjoo[>^(#016~)]0qj[[[(:~).(#005j.k~)](:~)]s(#722~)]rjjjjjjjjjjqojj[jjhjhjhjqjhjhjhj(#004qjjjsjurjjjjq)o[nhpjpjhjhjhljhpjmhjhjhljhpjjpjjh(#010~)jjqjj]qjjqjgpn[jjh(#006~)](#002pjooooooooooljjqhjhjhjhqjjpnjhjhjhrnjhjhnhnjhnjhjoooojjhjhjhrnjhjhnhnjhnjhnnnnnm)[jhj(#006~)]pjjjq(#004~)[o(#010~)]][jhljjhjjqjhljjhjjqjhjp[jjh(#006~)][jhj(#006~)]l(#004~)]qjjpoooo[ooooo(#005~)jjj(#002p)(#004p)jrgq(#002r)(#004r)[hgn(#004~)np(:qjjq)rlj]plgpgpgo(#002q)(#004q)gqgmgmgqgqgoijpjsiqjiqjipjirjpjipjsiqjiqjipjiqjp[ijijpsqij(#008~)]i]rjjqvrjjrvr[>^(#016~)]0jjjjjj[[[(:~).(#005j.k~)](:~)]s(#873~)]"
- castle_next = "ljjjjjj[[hj(#011~)]q[hj(#008~)]qhjhjhjhjhjqhjhjhjp[hj(#006~)]qhjhjhjhjh(#008~)njq] qjoooooooqijqsilsipjilsilsipjihpjihrgqjijiqjijiqjijihqjigrg pjnnhjgnghpjjjqsqjjjpnghnhpjjpgrgmgpgpglgqgqgmgkgkg "
- castle_next2= "nhnq[hgm(#)]"
- builds_blueprints = {"jhjhjhjhjhqjhqjhjhjhpjhpjhjhjhjqjnr1hj0hjhjhj1hpj0hjhjhjhj1hpjj0hjhj1hpj0hjhjhjhjnp1hj5hjhjhj1hpj0hj5hjhj0hj1hpjj0hj5hj1hpj0hj5hjhj0hjnp1hj0hjhjhj1hpj0hjhjhjhj1hpj0hjhjhj1hpj0hjhjhjhnl3hlhlhplhlhpjhl2hlhplhlhrjooqbgrjgoorjq9glgqjr7grjl8gmgmj6grjagrcglnnnnljj0hqjhjhrglglglglglhjhjhrgn4glglglglglgljop2ioriqjjjoorimimimimimimimijnnnlghlghlghlghlghlghlgooioriknirjbijjnnr2glghlghlghlghlghlghljjpiorilqijjriorirjbij2ijriorirjjjjnriorijrimimimimimimimjjnrijriorijrijjpo","mjjjrgnhnhgnhgnhgkgqjrgoigoigoigoigkgqjrgnhgnhgnhgnhgkgkgogogogk4goj0gmjjr0hjh3gr5gngngng0hnh5gnj7grj6hjnp0hjhj2hpj0hjhjhj2hpj0hjhjhj2hpj0hjhjhj2hk0grjjgrgpjjp0gqjr8gqm0grjjgrgpjjpgmjooioqjqjjq1ipjjqjjqipjjqjjqipjjqjjqi8hmoojp4gpjr0grjqjqo","j4hjhq1gpgpgpjqjn0hnr2hpjjorh3gpjjrgpg2hnjqjqhrj3hlqgoojq5gqjr6g7gn0hn2hljqoo",castle_blueprint,castle_next,castle_next2}
- builds_blueprints_village = {"jj3hjhjhqjqhjhjhj2hqjhjhqjhjhjhjhqjhjhjhqjhjhjhjhn0hqj1hjj0hqj1hjhjhj0hqj1hjhj0hqj1hjhjhjn0hqj1hjj0hqj1hj5hj1hj0hqj1hjhj0hqj1hj5hj1hjn0hqj1hjhj0hqj1hjhjhj0hqj1hjhj0hqj1hjhjhjnrj0hjhjhjpjphjhjhjhjhqjqhjhjhjooo6hn7hnn0hjhpjpjhjhjhljjoooor4g","j0hqjhjhpjhjhjhjhpjhjhjhjhpjhjhjhjhpjhpjhjhjhqjhjhqjhqjhpjhpjhmn1hj0hpj1hjhjhj0hpj1hjhjhj0hpj1hjhjhj0hpj1hjjnhj0hpj1hj3hj1hj0hpj1hj3hj1hj0hpj1hj3hj1hj0hpj1hjjnhj0hpj1hjhjhj0hpj1hjhjhj0hpj1hjhjhj0hpj1hjhlq4hjnp2hjhjhpjhjhjhjhpjhjhjhjhpjhjhjhjhpjhpj1hjhjhqjhqjhjhpjhpjhjhrmjjjjroooo","j0hqjhjhpjhjhjhjhpjhjhjhjhpjhjhjhjhpjhpjhjhjhqjhjhqjhqjhpjhpjhmn1hj0hpj1hjhjhj0hpj1hjhjhj0hpj1hjhjhj0hpj1hjjnhj0hpj1hj3hj1hj0hpj1hj3hj1hj0hpj1hj3hj1hj0hpj1hjjnhj0hpj1hjhjhj0hpj1hjhjhj0hpj1hjhjhj0hpj1hjhlq4hjnp2hjhjhpjhjhjhjhpjhjhjhjhpjhjhjhjhpjhpj1hjhjhqjhqjhjhpjhpjhjooo5hnhnhnrhrnjq6hjqhjhjhjhjqhjhjhjhjqhjhjhjhjqhjhjhqjjjjjrooooo","j1hqjhjhpjhjhjhjhj0hpjhjhqjhjhjhjhjhpjhjhjhjhjhjhpjhjhjhjhjhjhjhjhjhjhpjhjhjhjhjhjnjhjhpjhjhjhjhjhpjhjhqjhjhjhjhjhpjhjhjhjhjhjhpjhjhjhjhjhjhjhjhjhjhpjhjhjhjhjhn4hjjhj1hpj7hj8hjhj7hj1hpj2hjhqj7hj8hjhj7hj1hpjhjhjhjhjhjphj7hj8hjhj7hj4hj7hj8hjhj7hj1hpj4hj7hj8hj7hjnjjjp1hjhjhjhjhjphj2hjhqj1hjhjhjhjphjhjhjhjhjhjphjhjhjhjhjhjhjhjhjhjphj2hjhjhjhjhjhjloqgqagosoq2hjhjhjhpjhpjhjhjhqjhqjhjhjhjhjhjhjhjhpjhpjhjhjhjhjhjhjhjhqjhqjhjhjhjhjhjhjhjhpjhpjhjhjhjhjhjhjhjhqjhqjhjhjhjhjhjhjhjh mnnnjp3glgilgilgilgilgilgilgilglgmpgilgilgilgilgilglgmpgilglgmpgilgilgilijijqgilgilgilgilgilgn7hrj8hj7hrj3grgnhnhpjhjhjhjhjhjhjohnhpjjjjjo4hqjhqjjjjjjjjloqhjhjhjhnrjhjhpjhpjhjjor5gmghpglghlghlghlghlghnjgmgmgmgmgmgqmjglglgnphjjjjjlllooooqglgqgmgmgmgnnjjghlghlghlghlghljpglqgpghlghlghnjgmgmgmgmglqgmgmgmgmgmgmgnpjjjjjjjjjpjjjopglglglgl6glglglglgkoghmghmghmghmghmghmghmghmghrjjrooglglglglglglglglgojoqjjjjjjp9g","","","","","gngngn1gn2hljqhljqhljqhloooojq","pjjqhjhjhjhjhjhqjqhjhjhjhjhjhpjphjhj2hjtj0hjhqjqhjhj3hjtj0hjhpjphjhjhjhjhjhqjqhjhjhjhjhjhqjqjnhjhjhjhpjhjhjhpjhjhjhpjhjh1gngrjgogqjjjpgngrjgognnnjq0hjhjhjhqjqhjhjhjhpjphjhjhjhqjqhjhjhjhrjjjjpjpoooo","njphjhjhjhjhqjhjhjhjhjhjhqjhjhjhjhjhjhjhjhqjhjhjhjhjhjhqjhjhjhrjjpjp1hjhjhjhjhjhjhqjqhjhjhjhjhjhjhpjjphjhjhjhjhjhjhqjqhjhjhjhjhjhjhqjjq2hjtj3hjtj4hjtj5hpjjjjpjjjpo"}
- --[[
- Blueprint help
- 0-f = select slot
- g = break and place
- h = break and place down
- i = break and place up
- j = break and move forward
- k = break and move back
- l = break and move left
- m = break and move right
- n = break and move up
- o = break and move down
- p = turn left
- q = turn right
- r = half turn
- s = break
- t = break down
- u = break up
- v = place
- w = place down
- x = place up
- . = wait 1s
- < = suck
- > = drop
- ^ = select next slot
- ? = select random slot
- ( = if x then ...
- ! = NOT
- # = loop counter is xxx
- : = block in front
- _ = refuel
- , = block in slot
- ) = if end
- [ = loop ...
- ] = end loop
- ~ = break loop
- ]]--
- --[[
- Sub fonctions
- ]]--
- function mid(mid_string, mid_place)
- return string.sub(string.reverse(string.sub(string.reverse(mid_string),string.len(mid_string)-mid_place+1)),mid_place)
- end
- function inString(instr_string, instr_item)
- for instr_i = 1,string.len(instr_string) do
- if(mid(instr_string,instr_i) == instr_item) then
- return instr_i
- end
- end
- return false
- end
- function lenth(len_item)
- if(type(len_item) == "string") then
- return string.len(len_item)
- else
- return table.maxn(len_item)
- end
- end
- function index(index_list, index_item)
- for index_i = 1,lenth(index_list) do
- if index_list[index_i] == index_item then
- return index_i
- end
- end
- return nil
- end
- function online(onl_url)
- if(type(onl_url) ~= "string") then error("Called function online() but got "..onl_url.."instead of an URL string.") return end
- onl_blueprint = ""
- onl_materials = {}
- return onl_blueprint,onl_materials
- end
- function refuel(refuel_blueprint)
- turtle.select(1)
- refuel_fuel = 0
- for refuel_i = 1,string.len(refuel_blueprint) do
- if(inString("jklmno",mid(refuel_blueprint,refuel_i))) then refuel_fuel = refuel_fuel +1 end
- end
- if(refuel_fuel > turtle.getFuelLevel()) then
- print("Need "..math.ceil((refuel_fuel-turtle.getFuelLevel())/80).." coal (="..refuel_fuel.." levels.)")
- repeat
- sleep(0)
- turtle.refuel(1)
- until turtle.getFuelLevel() >= refuel_fuel
- if(turtle.getItemCount() > 0) then
- print("Please remove fuel.")
- repeat until turtle.getItemCount() == 0
- end
- end
- end
- function wait_materials(mat_build,mat_type)
- turtle.select(1)
- if mat_type == 1 then
- if mat_build > 0 then
- mat_list = builds_materials[mat_build]
- else
- mat_list = builds_materials_village[-mat_build]
- end
- end
- if(turtle.getItemCount() ~= 0) then
- if(turtle.getItemDetail().name == "minecraft:coal") then
- print("Please remove fuel.")
- repeat until turtle.getItemDetail().name ~= "minecraft:coal"
- end
- end
- if(mat_list == nil) then
- print("WARNING: No material list found. Running blind! You have 10 seconds to feed the correct materials.")
- os.sleep(10)
- return
- end
- print("Please give the folowing materials:")
- for mat_i = 1,lenth(mat_list) do
- turtle.select(mat_i)
- mat_count = mat_list[mat_i][1]
- mat_name = mat_list[mat_i][2]
- mat_damage = mat_list[mat_i][3]
- if mat_damage == nil then
- print("Slot "..mat_i..": "..mat_count.."x "..mat_name)
- else
- print("Slot "..mat_i..": "..mat_count.."x "..mat_name..":"..mat_damage)
- end
- repeat
- repeat
- while turtle.getItemCount() == 0 do
- os.queueEvent("turtle_inventory")
- os.pullEvent()
- end
- until turtle.getItemDetail().name == "minecraft:"..mat_name
- until turtle.getItemDetail().count == mat_count
- end
- end
- function empty()
- empty_remaining = false
- for empty_i=1,16 do
- turtle.select(empty_i)
- if turtle.getItemCount() ~= 0 then empty_remaining = true end
- end
- if empty_remaining then
- print("Emptying items!")
- turtle.turnLeft()
- turtle.turnLeft()
- for empty_i=1,16 do
- turtle.select(empty_i)
- turtle.drop()
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- turtle.select(1)
- end
- --[[
- Here are all the functions that
- you can use.
- ]]--
- function help()
- term.clear()
- textutils.pagedPrint('Use "builder build <number|name|url>" to start building.\nUse "builder list ["village"]" to get a list of the possible builds.\nUse "builder materials <number|name|url>" to get the list of the required resources.\nUse "builder tutorial" to get a tutorial on how to use this program.\nUse "builder infos" for more informations/credits.',h-3)
- end
- function credits()
- term.clear()
- term.setCursorPos(1,1)
- print("This program is supposed to help you construct a large quantity of builds automatically.")
- print("The turtle knows the required amount of fuel and items.")
- print("Just give it, sit back and relax while it build you the build of your dreams.")
- print()
- print()
- print("Created by cmoa. V0.1 (under construction)")
- term.setCursorPos(1,h)
- end
- function list()
- if(init_parameter ~= "village") then
- lst_len = lenth(builds_names)
- print("There are "..lst_len.." builds availiable")
- for lst_i = 1,lst_len do
- print(lst_i..": "..builds_names[lst_i])
- end
- print('You can download custom ones using "builder build <url>".')
- else
- print("There are 11 village houses availiable")
- for lst_i = 1,11 do
- print("-"..lst_i..": "..builds_names_village[lst_i])
- end
- end
- end
- function materials(materials_build,materials_type)
- if materials_type == 1 then
- if materials_build > 0 then
- print("Materials for "..builds_names[materials_build]..":")
- materials_list = builds_materials[materials_build]
- else
- print("Materials for village house "..builds_names[-materials_build]..":")
- materials_list = builds_materials_village[-materials_build]
- end
- end
- if materials_type == 2 then
- print("Materials for online build:")
- materials_list,a = online(materials_build)
- end
- materials_to_print = ""
- for materials_i = 1,lenth(materials_list) do
- materials_count = materials_list[materials_i][1]
- materials_name = string.lower(materials_list[materials_i][2])
- materials_damage = materials_list[materials_i][3]
- if materials_damage == nil then
- materials_to_print = materials_to_print..materials_count.."x "..materials_name.."\n"
- else
- materials_to_print = materials_to_print..materials_count.."x "..materials_name..":"..materials_damage.."\n"
- end
- end
- materials_to_print = string.reverse(string.sub(string.reverse(materials_to_print),2))
- textutils.pagedPrint(materials_to_print,h-3)
- end
- function move()
- print("Under construction")
- return
- end
- function tutorial()
- print("Under construction")
- return
- end
- function build(build_build,build_type)
- build_blueprint = nil
- if(build_type == 1 or build_type == 3) then
- if build_build > 0 then
- build_blueprint = builds_blueprints[build_build]
- else
- build_blueprint = builds_blueprints_village[-build_build]
- end
- else
- if(build_type == 2) then
- build_blueprint = build_build
- print("building: "..build_build)
- else
- end
- end
- build_len = string.len(build_blueprint)
- refuel(build_blueprint)
- wait_materials(build_build,build_type)
- turtle.select(1)
- build_progress = true
- loop_start,loop_end,loop_counter = {},{},{}
- loop_number = 0
- if_start,if_end = {},{}
- if_number = 0
- if(inString(build_blueprint,"[") or inString(build_blueprint,"(")) then
- print("Warning: Build contains loops or/and conditions which changes the amount of steps. This is why progress messages won't be desplayed. Also make sure to have enough fuel!")
- build_progress = false
- end
- print("Building...")
- os.sleep(2)
- build_i = 0
- step_i = 0
- stats_moves,stats_turns,stats_place = 0,0,0
- repeat
- sleep(0)
- build_i = build_i + 1
- if build_progress then if(math.fmod(build_i,10) == 0) then print(build_i.."/"..build_len) end end
- build_char = string.lower(mid(build_blueprint,build_i))
- print(build_char.." "..build_i)
- local slot = inString("0123456789abcdef",build_char)
- if(slot) then turtle.select(slot) end
- if(inString("ghivwx",build_char) and turtle.getItemCount()==0) then turtle.select(turtle.getSelectedSlot()%16+1) print(switched) end
- if(build_char == "g") then turtle.dig() turtle.place() stats_place=stats_place+1 end
- if(build_char == "h") then turtle.digDown() turtle.placeDown() stats_place=stats_place+1 end
- if(build_char == "i") then turtle.digUp() turtle.placeUp() stats_place=stats_place+1 end
- if(build_char == "j") then turtle.dig() turtle.forward() stats_moves=stats_moves+1 end
- if(build_char == "k") then turtle.turnLeft() turtle.turnLeft() turtle.dig() turtle.forward() turtle.turnRight() turtle.turnRight() stats_moves=stats_moves+1 stats_turns=stats_turns+4 end
- if(build_char == "l") then turtle.turnLeft() turtle.dig() turtle.forward() turtle.turnRight() stats_moves=stats_moves+1 stats_turns=stats_turns+2 end
- if(build_char == "m") then turtle.turnRight() turtle.dig() turtle.forward() turtle.turnLeft() stats_moves=stats_moves+1 stats_turns=stats_turns+2 end
- if(build_char == "n") then turtle.digUp() turtle.up() stats_moves=stats_moves+1 end
- if(build_char == "o") then turtle.digDown() turtle.down() stats_moves=stats_moves+1 end
- if(build_char == "p") then turtle.turnLeft() stats_turns=stats_turns+1 end
- if(build_char == "q") then turtle.turnRight() stats_turns=stats_turns+1 end
- if(build_char == "r") then turtle.turnLeft() turtle.turnLeft() stats_turns=stats_turns+2 end
- if(build_char == "s") then turtle.dig() end
- if(build_char == "t") then turtle.digDown() end
- if(build_char == "u") then turtle.digUp() end
- if(build_char == "v") then turtle.place() stats_place=stats_place+1 end
- if(build_char == "w") then turtle.placeDown() stats_place=stats_place+1 end
- if(build_char == "x") then turtle.placeUp() stats_place=stats_place+1 end
- -- Special characters
- if(build_char == ".") then os.sleep(1) end
- if(build_char == "<") then turtle.suck() end
- if(build_char == ">") then turtle.drop() end
- if(build_char == "^") then turtle.select(turtle.getSelectedSlot()%16+1) end
- if(build_char == "?") then turtle.select(math.random(16)) end
- if(build_char == "[") then
- sleep(0)
- table.insert(loop_start,build_i)
- table.insert(loop_counter,1)
- loop_index = 1
- loop_i = 0
- for loop_j = build_i+1,build_len do
- loop_char = mid(build_blueprint,loop_j)
- if(loop_char=="[") then
- loop_index = loop_index + 1
- end
- if(loop_char=="]") then
- loop_index = loop_index - 1
- if(loop_index==0) then loop_i = loop_j break end
- end
- end
- table.insert(loop_end,loop_i)
- loop_number = loop_number + 1
- end
- if(build_char == "]") then
- build_i = loop_start[lenth(loop_start)]
- loop_counter[loop_number] = loop_counter[loop_number] + 1
- end
- if(build_char == "~") then
- while true do
- if(if_number == 0) then break end
- if(if_end[if_number] > loop_end[loop_number]) then break end
- table.remove(if_start,if_number)
- table.remove(if_end,if_number)
- if_number = if_number - 1
- end
- build_i = loop_end[loop_number]
- table.remove(loop_start,loop_number)
- table.remove(loop_end,loop_number)
- table.remove(loop_counter,loop_number)
- loop_number = loop_number - 1
- end
- if(build_char == "(") then
- if_index = 1
- if_i = 0
- for if_j = build_i+1,build_len do
- if_char = mid(build_blueprint,if_j)
- if(if_char=="(") then
- if_index = if_index + 1
- end
- if(if_char==")") then
- if_index = if_index - 1
- if(if_index==0) then if_i = if_j - 1 break end
- end
- end
- build_i = build_i + 1
- if_condition = false
- if_not = false
- if(mid(build_blueprint,build_i) == "!") then if_not = true build_i = build_i + 1 end
- if_char = mid(build_blueprint,build_i)
- -- print(if_char)
- if(if_char == "#") then
- if(tonumber(string.reverse(string.sub(string.reverse(string.sub(build_blueprint,build_i+1)),build_len-build_i-2))) == loop_counter[loop_number]) then
- if_condition = true
- end
- build_i = build_i + 3
- end
- if(if_char == ":") then if(turtle.detect()) then if_condition = true end end
- if(if_char == "_") then if(turtle.refuel()) then if_condition = true end end
- if(if_char == ",") then if(turtle.getItemCount() ~= 0) then if_condition = true end end
- -- print(if_condition)
- if if_condition ~= if_not then
- table.insert(if_start,build_i)
- table.insert(if_end,if_i)
- else
- build_i = if_i
- end
- if_number = if_number + 1
- end
- if(build_char == ")") then
- table.remove(if_start,if_number)
- table.remove(if_end,if_number)
- if_number = if_number - 1
- end
- -- os.sleep(0.5)
- until build_i >= build_len
- -- empty()
- print()
- print("Success !")
- print()
- print("Moves: "..stats_moves..", Turns: "..stats_turns.." Place: "..stats_place)
- end
- --[[
- Calling the correct function.
- ]]--
- if(init_command == nil) then print('You need to specify a command. To see the complete list use "builder help"') return end
- local init_build,init_type
- if(init_parameter ~= nil) then
- init_build = tonumber(init_parameter)
- if(init_build == nil) then init_build = index(builds_names, init_parameter) end
- if(init_build == nil) then init_build = index(builds_names_village, init_parameter) if(init_build) then init_build = -init_build end end
- --if(init_build == nil) then init_build = online(init_parameter) end
- if(init_build == nil) then print('Building "'..init_parameter..'" not found. Please use "builder list" to get the list of all the possible buildings') end
- if(type(init_build) == "number") then
- init_type = 1
- if(init_build >= 0) then
- if(init_build == 0 or init_build > lenth(builds_blueprints)) then
- print('Building "'..init_parameter..'" not found. Please use "builder list" to get the list of all the possible buildings.')
- return
- end
- else
- if(init_build < -11) then
- print('Village house "'..init_parameter..'" not found. Please use "builder list village" to get the list of all the possible houses.')
- return
- end
- end
- else
- init_type = 2
- end
- end
- if init_command == "help" then help() return end
- if init_command == "build" then build(init_build,init_type) return end
- if init_command == "custom" then build(init_parameter,2) return end
- if init_command == "list" then list() return end
- if init_command == "materials" then materials(init_build,init_type) return end
- if init_command == "move" then move() return end
- if init_command == "tuto" or init_command == "tutorial" or init_command == "start" or init_command == "started" then tutorial() return end
- if init_command == "infos" or init_command == "credits" then credits() return end
- if init_command == "refuel" then for i=1,16 do turtle.select(i) repeat until not turtle.refuel() end turtle.select(1) return end
- if init_command == "empty" then empty() return end
- print('No command with the name "'..init_command..'" found. Use "builder help" to get a list of all possible commands.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement