Jump to content

Welcome to FTB Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

computercraft problems


2 replies to this topic

Poll: computercraft problems (1 member(s) have cast votes)

can some one decode this and tell me what is rong on line 21 and what ever other 1 is mest up

  1. find what you can out of what is rong and send me back a better version (0 votes [0.00%])

    Percentage of vote: 0.00%

  2. try it out on you own computer in ftb (0 votes [0.00%])

    Percentage of vote: 0.00%

  3. the pastebin website for it is http://pastebin.com/09CMRNeS (1 votes [100.00%])

    Percentage of vote: 100.00%

Vote Guests cannot vote

#1
kiletoe

kiletoe

    Newbie

  • Members
  • Pip
  • 4 posts
  • Modpack:FTB Ultimate

can someone look at this program i called it 3dprint it says bios :338:  [string "3dprint"] :21: enexpected symbol. here is the codes i put in/ got off pastebin.

 

--[[
        3D Print
        A printing program for use with NPaintPro
        But makes for a nice remote-control routine too
        
        By NitrogenFingers
]]--

local activeCommander = -1
local operatingPrint = false

--Whether or not the print can be ended
local function endPrint()
    operatingPrint = false
end

--The list of all commands the printer can be ginve
local commandList = {
    ["FW"] = { turtle.dig, turtle.forward };
    ["BK"] = turtle.back;
    ["UP"] = { turtle.digUp, turtle.up };
    ["DW"] = { turtle.digDown, turtle.down };
    ["TL"] = turtle.turnLeft;
    ["TR"] = turtle.turnRight;
    ["TU"] = { turtle.turnLeft, turtle.turnLeft };
    ["PF"] = { turtle.dig, turtle.place };
    ["PU"] = { turtle.digUp, turtle.placeUp };
    ["PD"] = { turtle.digDown, turtle.placeDown };
    ["SS"] = turtle.select;
    ["DE"] = endPrint;
}

--Splits a string according to a pattern into a table                
local function split(str, pattern)
  local t = { }
  local fpat = "(.-)" .. pattern
  local last_end = 1
  local s, e, cap = str:find(fpat, 1)
  while s do
    if s ~= 1 or cap ~= "" then
      table.insert(t,cap)
    end
    last_end = e+1
    s, e, cap = str:find(fpat, last_end)
  end
  if last_end <= #str then
    cap = str:sub(last_end)
    table.insert(t, cap)
  end
  return t
end

--Listens for any instructions given referring to identification and activation. Once activated, the mode exits.
local function respondToQuery()
    while true do
        print("Listening for ACT/ID query")
        local id,key = rednet.receive()
        print("Received : "..key)
        
        if key == "$3DPRINT IDENTIFY" then
            print("Requested Identification")
            rednet.send(id, "$3DPRINT IDACK "..os.getComputerLabel())
        
        elseif key == "$3DPRINT ACTIVATE" then
            print("Requested Activation")
            activeCommander = id
            rednet.send(id, "$3DPRINT ACTACK")
            break
        end
    end
end

--Performs the print. Follows instrutions as given, and responds as necessary
local function performPrint()
    operatingPrint = true
    while operatingPrint do
        local id,msg = rednet.receive()
        
        if id == activeCommander and string.find(msg, "$PC") == 1 then
            local cmds = split(msg, " ")
            
            if(tonumber(cmds[3])) and turtle.getItemCount(tonumber(cmds[3])) == 0 then
                rednet.send(id, "$3DPRINT DEP")
            else
                if type(commandList[cmds[2]]) == "function" then
                    commandList[cmds[2]](tonumber(cmds[3]))
                elseif type(commandList[cmds[2]]) == "table" then
                    for i=1,#commandList[cmds[2]] do
                        commandList[cmds[2]][i](tonumber(cmds[3]))
                    end
                end
            
                rednet.send(activeCommander, "$3DPRINT ACK")
            end
        end
    end
end

rednet.open("right")
term.clear()
term.setCursorPos(1,1)
if not os.getComputerLabel() then
    term.write("Name this computer:")
    os.setComputerLabel(io.read())
end
print("3D printer online")

while true do
    --Wait for activation
    respondToQuery()
    --Perform the print
    performPrint()
end



#2
ViperSRT3g

ViperSRT3g

    Advanced Member

  • Moderators
  • 212 posts
  • IGN:ViperSRT3g
  • Modpack:Unlisted Pack
You may want to clarify on what "["SS"] = turtle.select;" is selecting. It expects a number to be passed as an argument.
Vanilla Server: vanilla.vipersrt3g.net
banner-13472.png
Snapshot Server: snap.vipersrt3g.net
banner-25377.png

#3
kiletoe

kiletoe

    Newbie

  • Members
  • Pip
  • 4 posts
  • Modpack:FTB Ultimate

ok


"Thank You!!!!!"




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users