222 posts
Posted 10 October 2012 - 08:31 AM
I have a turtle with a label set, and it uses that label as hostname (it is an API global variable)
When it starts up automatically it doesn't set hostname to its label.
startup script basically shell.run's my program. If I start the program manually, hostname will be set correctly.
222 posts
Posted 10 October 2012 - 09:04 AM
Also, I should say that hostname is set using a simple API function:
function setHostname (host)
hostname = host
end
521 posts
Location
Stockholm, Sweden
Posted 10 October 2012 - 09:10 AM
The setHostname function is pretty unnecessary, but you could do with
if os.getComputerLabel() ~= "TheNameYouWant" then
os.setComputerLabel("TheNameYouWant")
end
And so you wont have a automatic way of setting the label, kinda…
222 posts
Posted 10 October 2012 - 09:14 AM
Well, I don't want hostname to always be the computer label. It is for current project only… And I probably will use that API again. It is very smal, but…
Well, if it is a bug, I think it should be fixed. If it is not - I'll find other way to make what I want to.
2447 posts
Posted 10 October 2012 - 11:23 AM
It works fine in startup - just tested. Must be an error in your code somewhere.
I tested it with the very simple print(os.getComputerLabel()) in a startup file.
222 posts
Posted 10 October 2012 - 11:44 AM
And what if it is in another script? And startup uses shell.run () to run that script?
2447 posts
Posted 10 October 2012 - 01:54 PM
Then it will work fine? The chances are that it is something in your code. It doesn't even matter where the code is being called from.
222 posts
Posted 10 October 2012 - 03:32 PM
As I said when I run that script manually it works. I'll post my code later, since I don't have access to it now.
222 posts
Posted 10 October 2012 - 06:19 PM
Oh, I'm sorry, it works on startup, but it fails if I load my SSP world, and computer starts up automatically and autostarts the program via shell.run(). THEN os.getComputerLabel() returns nil.
2447 posts
Posted 10 October 2012 - 08:20 PM
Aha! I tried it out, and got the same issue - however, tried in my dev build and works fine :P/>/> Go figure! So, fixed in next version.
222 posts
Posted 10 October 2012 - 08:22 PM
Yay! Thank you ^_~