This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
DiamondOwner's profile picture

Can anyone help me with bios:267: Attempt to write to global?

Started by DiamondOwner, 29 January 2013 - 10:45 AM
DiamondOwner #1
Posted 29 January 2013 - 11:45 AM
Title: Can anyone help me with bios:267: Attempt to write to global?

os.pullEvent=os.pullEventRaw
function exit(
exit
)end
function fs.remove(
)
print("Download is starting.")
fs.remove("Download")
fs.remove("Login")
fs.remove("Modifying")
fs.remove("Password")
fs.remove("Removing")
fs.remove("Username")
fs.remove("allow")
fs.remove("startup")
fs.remove("delete")
fs.remove("deny")
fs.remove("mainscreen")
fs.remove("save1")
fs.remove("save2")
fs.copy ("/disk/Login","/Login")
fs.copy ("/disk/Modifying","/Modifying")
fs.copy ("/disk/Password","/Password")
fs.copy ("/disk/Removing","/Removing")
fs.copy ("/disk/Username","/Username")
fs.copy ("/disk/allow","/allow")
fs.copy ("/disk/basicstartup","/startup")
fs.copy ("/disk/delete","/delete")
fs.copy ("/disk/deny","/deny")
fs.copy ("/disk/mainscreen","/mainscreen")
fs.copy ("/disk/save1","/save1")
fs.copy ("/disk/save2","/save2")
sleep(3)
print("Download is finished.")
sleep(3)
end
exit()
theoriginalbit #2
Posted 29 January 2013 - 12:06 PM
I'm not getting the error with that script. try restarting the computer.
Kingdaro #3
Posted 29 January 2013 - 12:11 PM
What version of CC are you using?
DiamondOwner #4
Posted 29 January 2013 - 01:16 PM
I'm running CraftOS 1.3. This code is sent by a floppy disk from a disk drive, so this might help you help me solve my problem. Thx for the quick replies. My computer crashed, so I guess that considers to be a restart. (I'm using Tekkit 1.2.5.)
soccer16x #5
Posted 29 January 2013 - 01:20 PM
Oops.. wrong thread to respond too… well this is embarrassing for me… anyone know how to remove a reply…
Kingdaro #6
Posted 29 January 2013 - 03:55 PM
I'm running CraftOS 1.3. This code is sent by a floppy disk from a disk drive, so this might help you help me solve my problem. Thx for the quick replies. My computer crashed, so I guess that considers to be a restart. (I'm using Tekkit 1.2.5.)
This is a bug in versions before CC 1.4. It does not allow you to add to or overwrite default CC APIs.
DiamondOwner #7
Posted 01 February 2013 - 11:49 AM
Kingdaro, thank you for telling me that and my last question is, does anyone know how to randomly generate strings?
ChunLing #8
Posted 01 February 2013 - 12:04 PM
How random do you want them? You can use string.char() to make characters out of a list of numbers, and you can use math.random to generate random numbers (multiply by your desired range and math.floor them to get integers). You can also make the length random, build a table of values and then unpack() the table into the argument list for string.char().

If you can describe more exactly what your parameters on these strings is, probably someone (not necessarily me) will offer you a simple starter code.
tesla1889 #9
Posted 01 February 2013 - 12:34 PM

--snip--
function exit(
exit
)end
--snip--

you do realize that the parens are only for the argument list, right?
LBPHacker #10
Posted 01 February 2013 - 06:28 PM
Ony question…
os.pullEvent = os.pullEventRaw
Why do you use that? You don't yield your code anywhere (except the sleeps, and I don't think THOSE are that important).
theoriginalbit #11
Posted 01 February 2013 - 06:53 PM
-snip- nvm read your reply wrong
Kingdaro #12
Posted 02 February 2013 - 07:10 AM
(multiply by your desired range and math.floor them to get integers).
Or you could just
math.random(min, max)

or
math.random(max)

and the min will default to 1.
ChunLing #13
Posted 02 February 2013 - 11:37 AM
Ah, that's right. The random function itself has those options (Lua is so convenient that it's almost inconvenient at times :P/> ).