Jump to content

Recommended Posts

Posted

Hallo ich habe in minecraft und mit der Mod Computercraft ein Programm geschrieben ich weiß man hätte es noch mit denn ganzen Print`s anders machen können aber das ist so

Mein Problem Zeile 40 ich rufe die Funktion Time auf aber in Minecraft kriege ich nur eine Fehlermeldung "test: 40 : attempt to call nil" ich weiß nicht mehr was ich machen soll


i = 0

    side = "top" 


    term.redirect(peripheral.wrap(side))

m = peripheral.wrap("top")

m.setTextScale(2)


term.setBackgroundColor(colors.green)

term.setCursorPos(1,1)

  print("A")

term.setBackgroundColor(colors.green)

term.setCursorPos(2,1)

  print("N")  

term.setBackgroundColor(colors.red)

term.setCursorPos(1,2)

  print("A")

term.setBackgroundColor(colors.red)

term.setCursorPos(2,2)

  print("U")

term.setBackgroundColor(colors.red)

term.setCursorPos(3,2)

  print("S")

term.setBackgroundColor(colors.yellow)

term.setCursorPos(1,3)

  print("T")

while true do

event,side,x,y = os.pullEvent()

  if event == "monitor_touch" then

    if x == 1 and y == 1 then

    rs.setOutput("left", true)

  elseif x == 2 and y == 1 then

    rs.setOutput("left", true)

  elseif x == 1 and y == 2 then

    rs.setOutput("left", false)

  elseif x == 2 and y == 2 then

    rs.setOutput("left", false)

  elseif x == 3 and y == 2 then

    rs.setOutput("left", false)

  elseif x == 1 and y == 3 then

    Time()

    end

  end

end

local function Time()

for i=1,0 do

    rs.setOutput("right", true)

sleep(2)

    rs.setOutput("right", false)

end

end
Posted

"attempt to call nil" => Befehl nicht erkannt wegen Tippfehler im Befehl selber, im Skript oder in der Zeile. Schaue mal, ob du einen Tippfehler im Skript gemacht hast.

Posted (edited)

Wenigstens mal ein Thema, welches nichts mit irgendwelchen PC Problemen zu tun hat.

Dein Code ist leider nicht expertenlevel, aber das wird mit der Zeit.

definiere die funktion "Time()" bevor du sie aufrufst. Lua ist eine Skriptsprache und keine kompilierte anwendung.

Edited by Corona

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...
B
B