Jump to content


Bomb Bloke's Content

There have been 147 items by Bomb Bloke (Search limited from 29-March 23)


By content type

See this member's


Sort by                Order  

#279097 TechCorp 5: World of Corporations II

Posted by Bomb Bloke on 29 June 2019 - 07:22 AM in Servers

Post the mod list, please.



#279069 JSON API v2.0.1 for ComputerCraft

Posted by Bomb Bloke on 01 June 2019 - 04:30 AM in APIs and Utilities

Sounds like you're after a pairs loop.



#279043 Weird program error on reboot

Posted by Bomb Bloke on 25 May 2019 - 07:07 AM in Ask a Pro

Remember that scripts execute from top to bottom. When you initially run your script on boot, the first thing it tries to do is build your ACTIONS table: but none of the variables you're trying to copy into it contain anything yet, so you "fill" the table with a bunch of nils.

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

View PostMrObsidy, on 22 May 2019 - 03:29 PM, said:

To do this I override every single function in fs to prefix the root directory.

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

View PostSquidDev, on 18 May 2019 - 06:39 AM, said:

Tables are compared by reference, which means that tables with the same entries aren't always equal.

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

 SquidDev, on 02 May 2019 - 03:07 PM, said:

I realise this is the only way to do it

Is it really? I mean, even regular modem messages don't arrive until the next server tick. Obviously this can go faster, but does it need to?



#278961 Are tables passed by reference or by value?

Posted by Bomb Bloke on 26 April 2019 - 08:25 AM in Ask a Pro

View PostMrObsidy, on 24 April 2019 - 06:17 PM, said:

EDIT: By testing, I found out that Lua indeed is pass-by-reference (the above code outputs "bar".)

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

Ok so I threw the latest Project Red files into my MC1.12.2 set up and:

Posted Image

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

I think I can answer at least a part of that:

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

Note that you need to be using wired modems in order to wrap remote peripherals. If you want to do it wirelessly, you'll need to place another computer next to the screen in order to relay your commands.



#278864 [MC1.12+][Fork] CC: Tweaked

Posted by Bomb Bloke on 09 March 2019 - 01:27 PM in Peripherals and Turtle Upgrades

FTP lol. You've got downloads on the brain. ;)

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:

This is 1.7, You just craft a turtle with a crafting table to get a crafty turtle. No attaching of anything that I know of.

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:

Apparently I've copied the code wrongly to this forum. The line is actually under the select and not above it. It's literally just above the turtle.craft call

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

io.read() always returns strings, but 1 is a number: so your condition will never be true.

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

View PostSquidDev, on 23 February 2019 - 11:02 AM, said:

The "big" change is that Cobalt got a lot of long-needed attention, meaning it's even more compliant to standard Lua

Well THAT sounds ominous...



#278808 [LanteaCraft / SGCraft] == ccDHD ==

Posted by Bomb Bloke on 20 February 2019 - 07:45 AM in Programs

View Postweirdwolf, on 19 February 2019 - 05:33 PM, said:

EDIT: I had a more experienced friend of mine look over the code, he found out it was an issue with ComputerCraft itself, and then he pointed out you recommended using CC: Tweaked, i guess this is why.. I fixed the issue by changing over to CC: Tweaked.

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

It looks like the script installs a few other files, but tries to load at least one of them before it could've possibly been downloaded. Guess Bruno didn't test a clean install with the latest build.

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

Since MC 1.3 the game's always been "multiplayer". SP transparently starts a server for you to play on, so you'd practically have to go out of your way to make a non-MP mod.



#278770 [MC1.12+][Fork] CC: Tweaked

Posted by Bomb Bloke on 24 January 2019 - 10:39 PM in Peripherals and Turtle Upgrades

Oh hey, you added turtles! :D

;)



#278742 Old Program new errors?

Posted by Bomb Bloke on 17 January 2019 - 12:15 AM in Ask a Pro

Yes, that's the issue SquidDev's referring to. Update using one of the links he provided.



#278739 Old Program new errors?

Posted by Bomb Bloke on 16 January 2019 - 11:17 AM in Ask a Pro

Guessing games don't seem like an efficient way to solve your problem. Perhaps you'd like to just tell us what error (or other unexpected behaviour) you're seeing?



#278735 Self-Replicating Turtle - Revisited

Posted by Bomb Bloke on 14 January 2019 - 11:47 PM in Turtle Programs

Given that it reserves the first half of its inventory for "whatever it happens to carry down from the surface", there are still enough that it can max out the remaining slots before finding diamonds. It's just "less likely" to do so.



#278729 Self-Replicating Turtle - Revisited

Posted by Bomb Bloke on 13 January 2019 - 12:55 PM in Turtle Programs

Also using a 1.7.10 pack, CC 1.74, and the script build from 12/12/2018, I tested it out and eventually received the same error on 2794. I was AFK standing near the start point when it died, came back to find a couple of computers and pick axes had been dropped close enough that my character had picked them up. Not sure if the turtle made a disk drive, it might've dropped one and had it despawn. It would've had all the ingredients on hand to make another turtle if it hadn't chucked the computers away.

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

I don't believe so, but you could fake it: coding up a virtual modem peripheral to use with multishell would allow you to simulate a network of systems on the one machine.



#278661 [MC1.12+][Fork] CC: Tweaked

Posted by Bomb Bloke on 21 December 2018 - 08:50 AM in Peripherals and Turtle Upgrades

There's a 1.14 already? Oy vey.



#278651 [SOLVED]trouble with error handling

Posted by Bomb Bloke on 18 December 2018 - 02:50 AM in Ask a Pro

View PostCreeperGoBoom, on 17 December 2018 - 08:32 PM, said:

THis is what happens when the output is empty:
 <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

View PostCreeperGoBoom, on 17 December 2018 - 08:32 PM, said:

the following code just seems to throw my custom error regardless.

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.