38 posts
Location
Massachusetts USA
Posted 20 March 2016 - 11:24 PM
when i run this
sleep(1)
--Wraps Peripherals
wm = peripheral.wrap("top")
mm = peripheral.wrap("bottom")
l1 = peripheral.wrap("computer_35")
l2 = peripheral.wrap("computer_34")
l3 = peripheral.wrap("computer_36")
l4 = peripheral.wrap("computer_37")
l5 = peripheral.wrap("computer_38")
r1 = peripheral.wrap("computer_39")
r2 = peripheral.wrap("computer_40")
r3 = peripheral.wrap("computer_41")
r4 = peripheral.wrap("computer_42")
r5 = peripheral.wrap("computer_43")
--Defines Variables
--Turns On All Computers
l1.turnOn()
l2.turnOn()
l3.turnOn()
l4.turnOn()
l5.turnOn()
r1.turnOn()
r2.turnOn()
r3.turnOn()
r4.turnOn()
r5.turnOn()
--Opens Channels
wm.open(0)
wm.open(1)
wm.open(2)
wm.open(3)
wm.open(4)
--Checks That The Modems Are The Right Ones
if wm.isWireless() == false then print("wm.err") end
if mm.isWireless() == true then print("mm.err") end
--rednet
rednet.open("bottom")
--Loop
--Sets Sign Text To Default
wm.transmit(1,1,"Computer")
wm.transmit(1,1,"Room")
wm.transmit(2,2,"Armor")
wm.transmit(2,2,"Room")
wm.transmit(3,3,"Animal")
wm.transmit(3,3,"Farms")
wm.transmit(4,4,"Plant")
wm.transmit(4,4,"Farms")
--Listens For rednet
inp = rednet.receive(1)
--Decifers Rednet
--Redirects Rednet
rednet.send(2,"fixme")
--end
--Closes Channels
wm.closeAll()
--Terminates
it says
"Startup:8 :attempt to call nil
what did i do wrong. i have gone through it many times and found no flaws
8543 posts
Posted 21 March 2016 - 12:02 AM
Did you copy and paste the exact code you're using here, or did you re-type it?
7083 posts
Location
Tasmania (AU)
Posted 21 March 2016 - 06:59 AM
The error is telling you that the eighth line of your script is attempting to call a function that doesn't exist. That's not possible within the code you're showing us.
If you still can't see the problem in the original code, I suggest using "pastebin put startup" and providing the ID that gives you here.
38 posts
Location
Massachusetts USA
Posted 21 March 2016 - 11:52 AM
The error is telling you that the eighth line of your script is attempting to call a function that doesn't exist. That's not possible within the code you're showing us.
If you still can't see the problem in the original code, I suggest using "pastebin put startup" and providing the ID that gives you here.
so it is just a bug/glitch
7083 posts
Location
Tasmania (AU)
Posted 21 March 2016 - 12:07 PM
Indeed, your code is bugged - but it's difficult to make suggestions about what to do about it as the error you're showing us isn't from the code you're showing us.
41 posts
Posted 21 March 2016 - 12:17 PM
Probably one of the peripheral.wrap function calls failed and returned nil. Try checking if you get a table instead of nil before calling functions.
l1 = peripheral.wrap("computer_35")
if l1 then
l1.turnOn()
end
.
.
wm = peripheral.wrap("top")
if wm then
wm.open(0)
.
.
end
38 posts
Location
Massachusetts USA
Posted 21 March 2016 - 12:22 PM
The error is telling you that the eighth line of your script is attempting to call a function that doesn't exist. That's not possible within the code you're showing us.
If you still can't see the problem in the original code, I suggest using "pastebin put startup" and providing the ID that gives you here.
It Did Not Work:(
same problem
339 posts
Location
Computer, Base, SwitchCraft, Cube-earth, Blockiverse, Computer
Posted 21 March 2016 - 12:40 PM
Is computer_37 actually computer_37? Try clicking on the computer's modem to check the name shown in chat, then modify line 8 accordingly.
7083 posts
Location
Tasmania (AU)
Posted 21 March 2016 - 01:34 PM
It Did Not Work:(
same problem
So you're saying you got the exact same error when trying to run the "pastebin" script?
I'm starting to think there's some sort of language barrier here - it may be a good idea to post a screenshot of what you typed and what the result was.
Probably one of the peripheral.wrap function calls failed and returned nil. Try checking if you get a table instead of nil before calling functions.
Is computer_37 actually computer_37? Try clicking on the computer's modem to check the name shown in chat, then modify line 8 accordingly.
I'm afraid you guys are on the wrong track; attempting to wrap a peripheral that doesn't exist won't immediately error; peripheral.wrap() simply returns nil, as opposed to the usual "table filled with functions".
Even if you later attempt to call a function inside of that non-table, you won't get an "attempt to call nil" - you'll get an "attempt to index nil".
2427 posts
Location
UK
Posted 21 March 2016 - 01:47 PM
It Did Not Work:(
same problem
So you're saying you got the exact same error when trying to run the "pastebin" script?
I'm starting to think there's some sort of language barrier here - it may be a good idea to post a screenshot of what you typed and what the result was.
Probably one of the peripheral.wrap function calls failed and returned nil. Try checking if you get a table instead of nil before calling functions.
Is computer_37 actually computer_37? Try clicking on the computer's modem to check the name shown in chat, then modify line 8 accordingly.
I'm afraid you guys are on the wrong track; attempting to wrap a peripheral that doesn't exist won't immediately error; peripheral.wrap() simply returns nil, as opposed to the usual "table filled with functions".
Even if you later attempt to call a function inside of that non-table, you won't get an "attempt to call nil" - you'll get an "attempt to index nil".
thing that got wraped is not expected peripheral? function doesn't exist in this version of mod?
7083 posts
Location
Tasmania (AU)
Posted 21 March 2016 - 01:55 PM
thing that got wraped is not expected peripheral?
As mentioned, if you attempt to wrap a peripheral that doesn't exist, peripheral.wrap() returns nil. This would not lead to an "attempt to call nil".
function doesn't exist in this version of mod?
Obviously some function somewhere doesn't exist; which one is entirely up in the air. The function called on line 8 of the displayed code obviously exists when the earlier lines call it, so…
1080 posts
Location
In the Matrix
Posted 21 March 2016 - 07:30 PM
Basically what Bomb Bloke is trying to convey is that somewhere you have a typo. Perhaps you did peripheral.warp, perhaps that isn't the first eight lines of your code given how there's a sleep right at the start. If anything just do what he asked and type this into your computer:
pastebin put Startup
And then give us that string of characters that it should print out, capitalization matters.
38 posts
Location
Massachusetts USA
Posted 21 March 2016 - 08:13 PM
To Paste-binthe code J2rXvfnd
1080 posts
Location
In the Matrix
Posted 21 March 2016 - 08:18 PM
If that's your file that was uploaded through cc's inbuilt pastebin script then that error shouldn't occur at all. Try restarting your in game computer and see if that fixes it, otherwise I have no clue what's going on.
38 posts
Location
Massachusetts USA
Posted 21 March 2016 - 08:26 PM
it is on a server
the server restarts periodicly
If that's your file that was uploaded through cc's inbuilt pastebin script then that error shouldn't occur at all. Try restarting your in game computer and see if that fixes it, otherwise I have no clue what's going on.
1080 posts
Location
In the Matrix
Posted 21 March 2016 - 08:33 PM
Go to your in game computer, the one this script is on, and press and hold ctrl and r.
38 posts
Location
Massachusetts USA
Posted 21 March 2016 - 08:44 PM
the error only happens when it starts up
if i run the program after it starts up it is fine
also all the computers connected don't turn on. half turn off and the other half do nothing
Go to your in game computer, the one this script is on, and press and hold ctrl and r.
yah and that did nothing. same error
1080 posts
Location
In the Matrix
Posted 21 March 2016 - 08:49 PM
Try adding this to the top of your script:
if not peripheral.wrap then
if peripheral then
os.unloadAPI("peripheral")
end
os.loadAPI("rom/apis/peripheral")
end
And see if that fixes your on startup error. Basically what this will do is make darn sure that the peripheral api is loaded.
Edit: You had mentioned you were on a server, so I assumed you thought that you could only restart it on the server restart.
Edited on 21 March 2016 - 07:52 PM
38 posts
Location
Massachusetts USA
Posted 21 March 2016 - 09:01 PM
i thought you meant the world. to restart the world.
Edit: You had mentioned you were on a server, so I assumed you thought that you could only restart it on the server restart.
same error
PastebinEdit: Ill Try Running it Sp and see if that helps
8543 posts
Posted 21 March 2016 - 09:04 PM
Is this the script named "startup" on the computer?
38 posts
Location
Massachusetts USA
Posted 21 March 2016 - 09:14 PM
Is this the script named "startup" on the computer?
yes it is the startup script
1080 posts
Location
In the Matrix
Posted 21 March 2016 - 09:26 PM
I don't get this error at all, if peripheral.wrap is giving you an attempt to call nil and it's spelled correctly, then you'd think that it doesn't exist. But if the other calls that happen before it are not erroring so it must exist. Are there any script in rom/autorun ?
38 posts
Location
Massachusetts USA
Posted 21 March 2016 - 09:29 PM
maby ill check
I don't get this error at all, if peripheral.wrap is giving you an attempt to call nil and it's spelled correctly, then you'd think that it doesn't exist. But if the other calls that happen before it are not erroring so it must exist. Are there any script in rom/autorun ?
Edit: nothing in rom/autorun
7083 posts
Location
Tasmania (AU)
Posted 21 March 2016 - 09:31 PM
Is there a disk drive attached to the network?
38 posts
Location
Massachusetts USA
Posted 21 March 2016 - 09:33 PM
yes.. two
Is there a disk drive attached to the network?
ohhh Isee
i have programs on those called startup
should i delete them?
edit Allbetter :P/> i was dumb
1080 posts
Location
In the Matrix
Posted 21 March 2016 - 09:33 PM
Yeaaah, that would cause your error entirely. Perhaps just rename them to something else.
If they're startup specific scripts for the other sets of computers, just wire those into a separate set of wire for those computers.
Edited on 21 March 2016 - 08:34 PM
38 posts
Location
Massachusetts USA
Posted 21 March 2016 - 09:34 PM
how do i close this?
they were old i removed them