Posted 17 September 2016 - 08:40 PM
il try to explain this the best way i can. If i want to make a program that works kinda like edit, you put a string/int behind the program name and use that input to do something, like this.
commandturtle <workerId>
also if you need the program this is used for.
workerId = 98
function toMoveCommand(keycode)
if keycode == keys.w then
return {"go", "forward"}
elseif keycode == keys.a then
return {"go", "left"}
elseif keycode == keys.d then
return {"go", "right"}
elseif keycode == keys.s then
return {"go", "back"}
elseif keycode == keys.space then
return {"go", "up"}
elseif keycode == keys.leftShift then
return {"go", "down"}
else
return nil
end
end
function remoteMove()
local action, keycode = os.pullEvent("key")
command = toMoveCommand(keycode)
if command == nil then
print("Ukjent knapp: " .. keycode)
else
print("Sender ".. unpack(command))
rednet.send(workerId, command)
end
end
function main()
print"Venter på kommando ..."
rednet.open"back"
while true do
remoteMove()
end
end
main()
so basicly i want workerId to be the input behind the program name to become what the workerId wil be in the script
commandturtle <workerId>