66 posts
Posted 10 October 2012 - 05:31 AM
hello i want to know if someone can make a program that makes it so the startup runs the GPS host in the background but looks like a normal startup screen where you can run anyprogram and have the host running in the background
231 posts
Posted 10 October 2012 - 05:51 AM
I think that this will work:
parallel.waitForAny(function() os.run({print = function() end}, "rom/programs/gps", "host", "<x>", "<y>", "<z>") end, function() term.clear() term.setCursorPos(1,1) shell.run("shell") end)
Just put it in the startup.
You'll have to substitute the <x>, <y>, and <z> with the coordinates you want for the gps host.
66 posts
Posted 10 October 2012 - 10:20 PM
i already have a program that is named "host" that runs the gps program with the cords, so how would i make it so i runs "host" in the background
231 posts
Posted 10 October 2012 - 10:41 PM
where it says
"rom/programs/gps", "host", "<x>", "<y>", "<z>"
Just replace "rom/programs/gps" with the full path to "host" and put any arguments to host after that, where "host", "<x>", "<y>", "<z>" is now.
66 posts
Posted 10 October 2012 - 11:38 PM
did, and it gave me a error
231 posts
Posted 10 October 2012 - 11:43 PM
Do you have the path and all arguments in quotes, with commas, like in the code above? What was the error?
66 posts
Posted 11 October 2012 - 03:36 AM
error is
host:1: attempt to index ? (a nil value)
but if i just run host it works fine
8543 posts
Posted 11 October 2012 - 04:43 AM
error is
host:1: attempt to index ? (a nil value)
but if i just run host it works fine
You'll probably need to modify the table passed to os.run to have an __index metamethod pointing to _G.
66 posts
Posted 11 October 2012 - 04:48 AM
error is
host:1: attempt to index ? (a nil value)
but if i just run host it works fine
You'll probably need to modify the table passed to os.run to have an __index metamethod pointing to _G.
what?
8543 posts
Posted 11 October 2012 - 05:15 AM
backEnvMeta = {__index = _G}
backEnv = {write = function() end}
setmetatable(backEnv, backEnvMeta)
parallel.waitForAll(function() os.run(backEnv, "host", 12, 13, 14) end, whateverElseYouAreRunning)
231 posts
Posted 11 October 2012 - 02:51 PM
Doesn't os.run automatically set the index to _G? The code I put works fine when I tested it. It still can't hurt to set the index metamethod to _G though.