- ComputerCraft | Programmable Computers for Minecraft
- → Bomb Bloke's Content
Bomb Bloke's Content
There have been 147 items by Bomb Bloke (Search limited from 31-March 23)
#279097 TechCorp 5: World of Corporations II
Posted by Bomb Bloke on 29 June 2019 - 07:22 AM in Servers
#279069 JSON API v2.0.1 for ComputerCraft
Posted by Bomb Bloke on 01 June 2019 - 04:30 AM in APIs and Utilities
#279043 Weird program error on reboot
Posted by Bomb Bloke on 25 May 2019 - 07:07 AM in Ask a Pro
Your script then proceeds to define all of your functions into the global scope, where they remain even when your script terminates. This is why re-running your script then allows you to assign some actual data into the ACTIONS table - the global scope only clears when you reboot your computer.
Note that in later versions of ComputerCraft, the global scope is cleared when a script ends. Generally you should be localising everything you can.
Edit:
It may also help to know that Lua always assigns by value, never by reference. Confusingly, when you attempt to assign a function/table/coroutine you end up assigning a pointer value leading to the relevant area in memory, but working with that pointer value in the variable is not the same as being able to use a variable as a reference.
#279032 Overriding fs functionality
Posted by Bomb Bloke on 22 May 2019 - 04:39 PM in Ask a Pro
MrObsidy, on 22 May 2019 - 03:29 PM, said:
Just glancing through the fs API, this looks like it'll at least break fs.combine() and fs.complete().
It's very difficult to comment on your issue without seeing the relevant lines in OneOS in addition to your own code.
#279030 Endless nan errors in calculator program (+ WarpDrive Integration)
Posted by Bomb Bloke on 22 May 2019 - 07:58 AM in Ask a Pro
SquidDev, on 18 May 2019 - 06:39 AM, said:
To clarify, the values you're comparing are your table pointers, as opposed to what's in your tables (their contents). Unless you compare a table pointer to itself you won't ever find an "equal match" that way; whether your tables contain the "same entries" isn't at all relevant.
A primitive but simple example of a check that looks at table contents might look like this:
local function compareTables(table1, table2) for i = 1, #table1 do if table1[i] ~= table2[i] then return false end end return true end if compareTables(disp, {0, 0, 0}) then ...
It'd be helpful to know what values you're actually expecting to get out of your script. Providing example input alongside the "correct" output would make it a lot easier to figure out which alterations need to be made.
#278986 Disknet: "Modem" communications through a disk drive!
Posted by Bomb Bloke on 03 May 2019 - 07:09 AM in APIs and Utilities
#278961 Are tables passed by reference or by value?
Posted by Bomb Bloke on 26 April 2019 - 08:25 AM in Ask a Pro
MrObsidy, on 24 April 2019 - 06:17 PM, said:
Just to make sure you're clear on this, Lua always passes values.
When you attempt to assign a table (or function, or coroutine...) to a variable, you actually end up assigning a pointer to it instead - which you can see if you try printing the variable's contents. Copying such values means that you then have multiple pointers leading to the one memory object: you can't actually pass copies of tables themselves because you never actually assign tables in the first place.
#278925 Bundled Cable Support
Posted by Bomb Bloke on 08 April 2019 - 03:52 AM in Ask a Pro
I haven't played with this build of MineCraft for a while so I'm still sitting on CC:T 1.80pr1.5, although I doubt there've been any breaking changes since I installed that (even if it is about a year old...).
My best guess is that you folks have simply neglected to install all the relevant packages from PR. In particular, did you nab Project Red - Compat?
Edit:
Decided not to be lazy and updated CC:T + Plethora as well. Still working.
Latest MC 1.12.2 builds at time of writing:
#278920 Bundled Cable Support
Posted by Bomb Bloke on 06 April 2019 - 03:50 AM in Ask a Pro
Initial RedPower cable support was added in by Dan. After that came support for MFR RedNet cables, and after that came an API for other mod authors to add support for their own cables instead (with the introduction of CC1.6 for MC1.6.4).
Catch was, no one was really interested in adding support from their end, and so for a few builds after this change it wasn't possible to use bundled cables at all. Support did start to come in after the jump to MC1.7.10, but as far as I'm aware, compatibility hasn't been determined from CC's end since then.
http://www.computerc...#Bundled_Cables
http://www.computerc...direct-support/
I haven't done much experimentation with inter-mod compatibility since MC1.7.10, as it's seemed to me that it's been relatively easy to find working combinations from MC1.8 onwards. Certainly it looks to me like ProjectRed should be working in MC1.12 (so long as you don't make the mistake the linked user did!).
#278867 Odd turtle.craft issue.
Posted by Bomb Bloke on 09 March 2019 - 11:34 PM in Ask a Pro
#278864 [MC1.12+][Fork] CC: Tweaked
Posted by Bomb Bloke on 09 March 2019 - 01:27 PM in Peripherals and Turtle Upgrades
Long since past time that CC:T made it into a mainstream pack, though.
#278843 Odd turtle.craft issue.
Posted by Bomb Bloke on 03 March 2019 - 09:14 AM in Ask a Pro
Purple, on 02 March 2019 - 11:27 PM, said:
That's one way of attaching things, but you can also do it using the turtle.equipLeft() and turtle.equipRight() calls. This allows you to choose exactly where the accessory will be placed.
Purple, on 03 March 2019 - 12:03 AM, said:
So in this bit of code:
turtle.select(1) turtle.craft()
... you're saying the error is occurring below the select call, but above the craft call?
What? :S
If you mean to say you still believe the craft call is throwing the error, simplify matters by rebooting the turtle to its command prompt and test turtle.craft() through the Lua console, see how it behaves there. If it works like that, show your full code.
Also bear in mind that you can't use slot 4 to hold "spare items" while crafting - turtle.craft() requires the turtle to be holding an exact recipe pattern and nothing else. And are you forgetting to put ingredients into slot 1...?
#278835 Big reactor
Posted by Bomb Bloke on 27 February 2019 - 02:45 PM in Ask a Pro
http://lua-users.org...uaTypesTutorial
You could do:
if a=="1" then
Or, instead:
a = tonumber(io.read())
#278826 [MC1.12+][Fork] CC: Tweaked
Posted by Bomb Bloke on 25 February 2019 - 09:46 AM in Peripherals and Turtle Upgrades
#278808 [LanteaCraft / SGCraft] == ccDHD ==
Posted by Bomb Bloke on 20 February 2019 - 07:45 AM in Programs
weirdwolf, on 19 February 2019 - 05:33 PM, said:
To be clear, "pr1" stands for "pre-release 1": you were using a testing build of ComputerCraft, not a stable release.
Beats me how people keep stumbling across that one. Has someone decided to put it in a modpack or something?
#278800 Ore Collecting Miner - a very advanced mining program
Posted by Bomb Bloke on 12 February 2019 - 09:03 AM in Turtle Programs
You may be able to work around this by grabbing the file manually:
pastebin get cR9vEiTc database/OCM/lang
#278784 ComputerCraft + LuaJIT = CCLuaJIT = WINNING
Posted by Bomb Bloke on 03 February 2019 - 10:08 PM in Media
#278770 [MC1.12+][Fork] CC: Tweaked
Posted by Bomb Bloke on 24 January 2019 - 10:39 PM in Peripherals and Turtle Upgrades
#278742 Old Program new errors?
Posted by Bomb Bloke on 17 January 2019 - 12:15 AM in Ask a Pro
#278739 Old Program new errors?
Posted by Bomb Bloke on 16 January 2019 - 11:17 AM in Ask a Pro
#278735 Self-Replicating Turtle - Revisited
Posted by Bomb Bloke on 14 January 2019 - 11:47 PM in Turtle Programs
#278729 Self-Replicating Turtle - Revisited
Posted by Bomb Bloke on 13 January 2019 - 12:55 PM in Turtle Programs
I'd hoped to speed up the resource harvesting process by specifically "making sure" the turtle would find what I thought it wanted (it'd be nice if the terminal counted down the resources it needs), but it still roamed around a large area on the surface and dug out three large areas underground (despite overloading on redstone / diamonds / iron / whatever on its first trip down). It also seems to ignore its limited inventory space while mining (continuing to dig even after all slots were filled), and seemed quite happy to lug stacks of logs down into the mine with it (instead of leaving them in the surface chests) - it might get away with this in vanilla (maybe), but mod packs tend to add a lot of blocks, so "assuming" it won't be full when it finds its first diamond is very risky!
On my first test, the turtle got overenthusiastic in clearing out a large seam of sandstone (aka the bottom of the beach), eventually making so many recursive function calls that it crashed out. I also found it likes to mine out entire seams of Chisel blocks for no apparent reason - I guess it just gobbles up anything that isn't cobble / stone / dirt.
#278693 Mimic - ComputerCraft Web Emulator (HTML5)
Posted by Bomb Bloke on 25 December 2018 - 11:59 PM in General
#278661 [MC1.12+][Fork] CC: Tweaked
Posted by Bomb Bloke on 21 December 2018 - 08:50 AM in Peripherals and Turtle Upgrades
#278651 [SOLVED]trouble with error handling
Posted by Bomb Bloke on 18 December 2018 - 02:50 AM in Ask a Pro
CreeperGoBoom, on 17 December 2018 - 08:32 PM, said:
<program name>:7: bad argument, table expected, got nil.
getStackInSlot returns a table if something's in the specified slot, or nil if there's not. You're trying to pass the output to pairs without checking which type of value you got, hence the crash when nothing's there.
In a comparison statement, pretty much all data types count as true except for false and nil. You can hence do stuff like this to check whether you got a nil return value:
if furn.getStackInSlot(3) then print("Something's in the slot.") else print("Nothing's in the slot.") end
CreeperGoBoom, on 17 December 2018 - 08:32 PM, said:
pcall expects to be passed a function, followed by any parameters you want it to pass to that function when executing it for you. Eg:
pcall(furn.getStackInSlot, 3)
You're calling the function and then passing its output to pcall.
- ComputerCraft | Programmable Computers for Minecraft
- → Bomb Bloke's Content