Jump to content


LeviM's Content

There have been 69 items by LeviM (Search limited from 29-March 23)


By content type

See this member's


Sort by                Order  

#236724 Rednet not communicating... after it communicates.

Posted by LeviM on 31 October 2015 - 03:51 AM in Ask a Pro

 Bomb Bloke, on 31 October 2015 - 12:48 AM, said:

In which case you may need to pick your "random" randomseed at a different time - check when checksum() is called, and have the last pixelcrypt function involved in the chain before returning control to your script pick a new seed.

Or better yet, get pixelcrypt's author to correct the original.
I thought it would be easier to just change encryption apis. However it still has the original problem of both computers having to be restarted. The API I am now using for encryption can be found here (and in that API it loads this API). For some reason it can't encrypt serialised tables or normal tables so you will find that in my code I have used some fancy methods of sending tables over rednet :D I have updated the pastebin links in the O.P.



#236713 Rednet not communicating... after it communicates.

Posted by LeviM on 31 October 2015 - 12:40 AM in Ask a Pro

 Bomb Bloke, on 30 October 2015 - 10:33 PM, said:

 LeviM, on 30 October 2015 - 02:11 PM, said:

I didn't make pixelcrypt, it's an API I got from a friend so.... I have no idea what any of this means.

It means stick a math.randomseed(os.clock()) down the bottom of pixelcrypt.checksum(), replacing line 114.

I did that but now there is an error on startup line 116. attempt to index ? (a number value)



#236672 Rednet not communicating... after it communicates.

Posted by LeviM on 30 October 2015 - 02:11 PM in Ask a Pro

 Bomb Bloke, on 30 October 2015 - 01:08 PM, said:

 Creator, on 30 October 2015 - 06:15 AM, said:

Use os.pullEvent instead of rednet.receive

Why would you expect that to make a difference?

C'mon, dude. You're a fairly competent programmer, so I'm more than a bit curious as to what your train of thought was there.

Throwing out "guesses" as if they were "solutions" isn't helpful, if that's what you were thinking.

 Glass Systems, on 30 October 2015 - 08:50 AM, said:

Like Creator said,just use os.pullEvent like this:

os.pullEvent() returns event types before the rest of the data. That's also not even remotely how you would make use of protocol strings.

@LeviM:

The problem is pixelcrypt's use of math.randomseed().

When a ComputerCraft computer boots, it picks a random seed to generate math.random() results with (presumably based on what the system clock is set to at the time the computer starts, as that's the most common source, but it could be based on something else - point is it's not immediately easy to guess, and is therefore unpredictable).

Values returned by math.random() will always follow an entirely predictable pattern so long as the seed is known. If you set the seed to 1 and generate ten "random" numbers, then set the seed to 1 again and generate another ten "random" numbers... then you'll get exactly the same results.

You, however, are setting it to something entirely predictable, within your checksum function. This has system-wide effects.

For one thing, it means that the unique identifiers attached to rednet messages your client sends - which are supposed to be random, in order to prevent messages from getting the same ones (or at least, make it really unlikely that they get the same ones) - become entirely predictable, to the point where your script will use the same UUID for the message it sends every time.

And if your server gets two messages with the same UUID within half a minute, then it assumes the extra copies were transmitted by the repeat script, and since it already got one with that UUID recently that means it ignores it.

In short, if you feel pixelcrypt.checksum() MUST use math.randomseed() with a non-random argument (and I don't see any obvious reason why it should), then at least feed it a somewhat random value (such as os.clock()) once you're done with it so that it's not so predictable afterwards!

I didn't make pixelcrypt, it's an API I got from a friend so.... I have no idea what any of this means.



#236656 Rednet not communicating... after it communicates.

Posted by LeviM on 30 October 2015 - 12:22 PM in Ask a Pro

I tried this but the errors remained



#236635 Rednet not communicating... after it communicates.

Posted by LeviM on 30 October 2015 - 03:41 AM in Ask a Pro

I have two computers, they are sended (encrypted) information to each other. One of these computers is a server, the other is a client. The client sends a command to the server and it responds with information. Then, if the client sends the command again then the server never responds or even receives the message. If the server restarts but the client does not then the server says it receives the message and it has responded but the client never receives the message.

The client was made to test the server, not as a fully functional client and the server was created to handle bank accounts. The code for the client is here and the code for the server is here.

Both programs load some API's when they are ran. The two APIS are 'hashing' and 'randcrypt' (randcrypt loads this 'random' API)

In advanced, thank you for your help and patience.



#236618 Computer freezes then shuts down

Posted by LeviM on 29 October 2015 - 10:14 PM in Ask a Pro

View PostBomb Bloke, on 29 October 2015 - 09:45 PM, said:

When a computer/turtle starts running code, ComputerCraft starts a ten second timer. If that code doesn't yield before that timer ends then ComputerCraft will either crash the script or the whole computer (depending on the nature of the functions your script is calling). After each yield, any other systems waiting to run code may do so, then after they've all yielded, processing continues with a new time limit.

The reason why is that running your code chews up valuable server processing power, and so it shouldn't be able to monopolise it. In fact, only ONE CC device can run code at a time: While one is doing something, none of the others can do anything until it yields.

Whether or not it takes more than ten seconds for your code to execute has a little to do with the power of the Minecraft server it's running on, and a lot to do with how often you allow your code to yield. Pulling events (eg getting typed characters or checking timers) triggers a yield, and many commands (eg turtle movements, sleeping, or getting text input from the user) have to pull events to work anyway. Basically, anything that triggers a pause is pulling an event in order to do it, and in order to pull an event the code yields.

In your code, these loops here are your problem:

  while true do
	local tWidth = width
	while true do
	  local temp = string.sub(text, done, tWidth)
	  if string.sub(temp, #temp) == " " then
		temp = string.sub(text, done, tWidth - 1)
		table.insert(lines, temp)
		done = tWidth + 1
	  else
		tWidth = tWidth - 1
	  end
	end
  end

They never yield, and they also never stop - there's no way the code underneath them will ever run.

It looks like you were perhaps trying to take every word in "text", and place them sequentially into a table? If so, you could replace the whole thing with:

for word in string.gmatch(text, "%w+") do lines[#lines + 1] = word end

View PostBomb Bloke, on 29 October 2015 - 09:45 PM, said:

When a computer/turtle starts running code, ComputerCraft starts a ten second timer. If that code doesn't yield before that timer ends then ComputerCraft will either crash the script or the whole computer (depending on the nature of the functions your script is calling). After each yield, any other systems waiting to run code may do so, then after they've all yielded, processing continues with a new time limit.

The reason why is that running your code chews up valuable server processing power, and so it shouldn't be able to monopolise it. In fact, only ONE CC device can run code at a time: While one is doing something, none of the others can do anything until it yields.

Whether or not it takes more than ten seconds for your code to execute has a little to do with the power of the Minecraft server it's running on, and a lot to do with how often you allow your code to yield. Pulling events (eg getting typed characters or checking timers) triggers a yield, and many commands (eg turtle movements, sleeping, or getting text input from the user) have to pull events to work anyway. Basically, anything that triggers a pause is pulling an event in order to do it, and in order to pull an event the code yields.

In your code, these loops here are your problem:

  while true do
	local tWidth = width
	while true do
	  local temp = string.sub(text, done, tWidth)
	  if string.sub(temp, #temp) == " " then
		temp = string.sub(text, done, tWidth - 1)
		table.insert(lines, temp)
		done = tWidth + 1
	  else
		tWidth = tWidth - 1
	  end
	end
  end

They never yield, and they also never stop - there's no way the code underneath them will ever run.

It looks like you were perhaps trying to take every word in "text", and place them sequentially into a table? If so, you could replace the whole thing with:

for word in string.gmatch(text, "%w+") do lines[#lines + 1] = word end

That's an an amazing explanation :D Thanks!



#236584 Computer freezes then shuts down

Posted by LeviM on 29 October 2015 - 07:38 PM in Ask a Pro

But, I don't know why.



#236572 Computer freezes then shuts down

Posted by LeviM on 29 October 2015 - 05:05 PM in Ask a Pro

Hi, I'm making a bank on my multiplayer server and I have written a small text formatting based API for controlling a monitor. However when I run one of the functions the computer freezes for a little bit and then shutsdown. During this time you can terminate the program.

The API is here and it's the last function, I've placed a comment above it.



#236462 [1.74] Multiple bugs on my server

Posted by LeviM on 28 October 2015 - 12:51 AM in Bugs

View PostHPWebcamAble, on 28 October 2015 - 12:49 AM, said:

View PostLeviM, on 28 October 2015 - 12:26 AM, said:

In a project I'm working on to remake the rednet API but with encryption I load the new rednet API

Could you post the code of the test program and the API you wrote?
(You can put it on pastebin and link it here if they are more than a few hundred lines)

I've got a funny feeling you did this:
local api = os.loadAPI("apiFileName")

api.funcName()

You need to do this:
local isLoaded = os.loadAPI("apiFileName") --# os.loadAPI returns true or false, depending on whether or it actually was able to load the API

apiFileName.funcName()

WOW. That's exactly what I did. It's also what both me and other people did. Must be a common error..... so sorry to post this here although it was a code error.



#236455 [1.74] Multiple bugs on my server

Posted by LeviM on 28 October 2015 - 12:26 AM in Bugs

View PostBomb Bloke, on 27 October 2015 - 11:12 PM, said:

View PostLeviM, on 27 October 2015 - 11:05 AM, said:

This is very strange, os.loadAPI does return something, and it returns a boolean; which is true. However, using the API functions return a nil statement.

You might've got an "attempt to index nil" error ("no such API table to index into"), or an "attempt to call nil" error ("API table exists but that function isn't in there"); they're quite different.

It may be worth providing the name of the API along with its content.

View PostLeviM, on 27 October 2015 - 11:05 AM, said:

Also, the trick to fix the monitor didnt work...

Did you specifically change the text scale? Just doing mon.setTextScale(whatEverItAlreadyWas) won't work.

I did specifically change the scale, I even write something in that scale. In a project I'm working on to remake the rednet API but with encryption I load the new rednet API and then ran rednet.send() however that returns the error
startup:4: attemt to index ? (a boolean value)



#236418 [1.74] Multiple bugs on my server

Posted by LeviM on 27 October 2015 - 11:05 AM in Bugs

View PostBomb Bloke, on 27 October 2015 - 01:51 AM, said:

The monitor bug is known, and is triggered by adding/removing blocks from the frame. Changing the text scale and then setting it back to what you want it to be sorts it out.

Beats me what's up with os.loadAPI(), it should be working ok unless some other mod is somehow messing with it (what about resource packs?). You can review its source here - as you can see, it shouldn't be capable of returning anything other than true or false. Did you specifically type() check it?
This is very strange, os.loadAPI does return something, and it returns a boolean; which is true. However, using the API functions return a nil statement. Also, the trick to fix the monitor didnt work...



#236417 [1.74] Multiple bugs on my server

Posted by LeviM on 27 October 2015 - 10:55 AM in Bugs

View PostSquidDev, on 27 October 2015 - 07:54 AM, said:

View PostLeviM, on 27 October 2015 - 01:11 AM, said:

[01:13:39] [Client thread/WARN] [CCTweaks]: Cannot find custom rewrite /org/squiddev/cctweaks/core/patch/BlockPeripheral_PatchBase.class

That isn't important/anything to worry about: I'm checking for all classes starting with BlockPeripheral, and so BlockPeripheralBase is also found despite I've never patched it. CCTweak's binary mode shouldn't be mucking anything up - though it is the only mod I can think of that does anything fancy on that list. Have you enabled luaJC by mistake? - that can cause issues.

However, the fact that it only happens with CC is very odd.
I haven't changed the settings.

View PostBomb Bloke, on 27 October 2015 - 01:51 AM, said:

The monitor bug is known, and is triggered by adding/removing blocks from the frame. Changing the text scale and then setting it back to what you want it to be sorts it out.

Beats me what's up with os.loadAPI(), it should be working ok unless some other mod is somehow messing with it (what about resource packs?). You can review its source here - as you can see, it shouldn't be capable of returning anything other than true or false. Did you specifically type() check it?
No, I didn't type check it. But I will do that ASAP!



#236392 [1.74] Multiple bugs on my server

Posted by LeviM on 27 October 2015 - 01:11 AM in Bugs

Over the last few days me and a few friends have been playing on my server and have noticed a few bugs, they have been listed below:
  • Computers unable to load new (new meaning it loads everything from rom/apis without fault) API's. We do not receive an error when loading the API however os.loadAPI returns nil.
  • Certain parts of monitors wont display anything. So far it has happened to the top quarter of a 4(h)x5(w) monitor and the top three quarters of a 4(h)x5(w) monitor.
I have removed all mods except CC from my client and I still get the error in SP. Here is a list of the mods I am using:
  • Computercraft 1.74
  • Open Peripherals (OpenModsLib 0.8 and AIO 5)
  • CCTweaks (0.2.3.1)
  • BiblioCraft (1.11.2)
  • Forge Multipart (1.2.0.345)
Thank you in advance for your help!


UPDATE: Often, in the logs I see things like
[01:13:39] [Client thread/WARN] [CCTweaks]: Cannot find custom rewrite /org/squiddev/cctweaks/core/patch/BlockPeripheral_PatchBase.class



#236374 Reading and printing tables stored in files

Posted by LeviM on 26 October 2015 - 08:07 PM in Ask a Pro

View Postvalithor, on 26 October 2015 - 08:03 PM, said:

The reason those two are the only two that do not have the [""] around them is because they are single worded keys to the table. You can not have a multi-word variable, so in order for the key to work for those that are multi-worded the brackets must be there. However, they are not needed for those two single worded ones so they are removed.

Thanks!



#236372 Reading and printing tables stored in files

Posted by LeviM on 26 October 2015 - 07:56 PM in Ask a Pro

View PostTYKUHN2, on 26 October 2015 - 07:52 PM, said:

First issue I notice is both links are the same.
Though with a little Ctrl-C Ctrl-V I found the right link.
fixed, sorry



#236370 Reading and printing tables stored in files

Posted by LeviM on 26 October 2015 - 07:33 PM in Ask a Pro

I have a few files stored on disk drives that look like these: http://pastebin.com/g5MqaN79
And I read and display them with this file: http://pastebin.com/GWE1YsDq

However, when I run this file it gets displayed as this:
Posted Image

My question is, why do the networth and owner values display like that? And how do I fix it?



#236198 CC Server (W/ Peripheral Mods) Creative

Posted by LeviM on 24 October 2015 - 08:05 PM in Servers

Due to the fact that for some reason worldedit's //replace doesn't work, the spawn city is covered in anvils.



#235666 CC Server (W/ Peripheral Mods) Creative

Posted by LeviM on 18 October 2015 - 12:44 AM in Servers

View PostMrScissors, on 17 October 2015 - 08:18 PM, said:

What openperipherals addons it operates on? And, can you put up pack on technic launcher?
Putting a pack up on the technic launcher is a bit extreme since it uses very little mods.

You can get the open peripherals core here and the mod here.



#235602 CC Server (W/ Peripheral Mods) Creative

Posted by LeviM on 17 October 2015 - 03:31 PM in Servers

I started a computercraft server and was wondering if anyone wanted going to join. The world was randomly generated because I kind of have a towny feel in mind. The server also has dynmap which you can view here.

Server Specs:
  • 7GB RAM
  • Dual Core
  • 2.4GHz
  • SSD Drives
Mods:
  • Computercraft (1.74)
  • Open Peripherals (OpenModsLib 0.8 and AIO 5)
  • CCTweaks (0.2.3.1)
  • BiblioCraft (1.11.2)
  • Forge Multipart (1.2.0.345)
Creative IP: mastermeredith.com



#233215 I started a small CC server.

Posted by LeviM on 22 September 2015 - 05:45 PM in Servers

View Postgollark8, on 22 September 2015 - 05:18 PM, said:

What actually caused it to go down?
Read the post... No money.



#233129 I started a small CC server.

Posted by LeviM on 21 September 2015 - 09:21 PM in Servers

View Postwojbie, on 21 September 2015 - 08:32 PM, said:

View PostLeviM, on 21 September 2015 - 08:28 PM, said:

Let's not care about it when the server's not even up :D

Yea attempted to join right after posting this. :lol: Damn this one was fun. Also it seems i can't read big red font stuff.
Hopefully it will return soon.



#233123 I started a small CC server.

Posted by LeviM on 21 September 2015 - 08:43 PM in Servers

View Postwojbie, on 21 September 2015 - 08:32 PM, said:

View PostLeviM, on 21 September 2015 - 08:28 PM, said:

Let's not care about it when the server's not even up :D

Yea attempted to join right after posting this. :lol:Damn this one was fun. Also it seems i can't read big red font stuff.
:D



#233120 I started a small CC server.

Posted by LeviM on 21 September 2015 - 08:28 PM in Servers

View Postwojbie, on 21 September 2015 - 08:20 PM, said:

View Postgollark8, on 21 September 2015 - 06:41 PM, said:

I do know that this greasemonkey guy did it. I got a peek at the code before wiping anything that had been near the computer. Whoever greasemonkey is, he should be banned from every CC server in existence.

View Postwojbie, on 20 September 2015 - 09:44 PM, said:

Fact that it was made by GreaseMonkey means nothing. This virus code is all over Internet (even on this forums) anyone could have found it. I don't think there is a point in messaging him.

You can even see his topic about here: http://www.computerc...resident-virus/ . No point in pointing fingers at guy. He was not active from 2012. Anyone could have done it. Lets just stop pointing fingers and stuff.
Let's not care about it when the server's not even up :D



#232839 I started a small CC server.

Posted by LeviM on 19 September 2015 - 01:21 AM in Servers

I spent hours making a program that changes the password of a door everytime you open it and lets you know that password by use of OpenPeripherals glasses.... that was wiped because of the virus.



#232551 I started a small CC server.

Posted by LeviM on 14 September 2015 - 03:55 PM in Servers

View PostVassious, on 13 September 2015 - 08:11 PM, said:

To anyone interested, this is a great server. The community is friendly and people are willing to help you.

View PostLDDestroier, on 14 September 2015 - 04:37 AM, said:

View PostVassious, on 13 September 2015 - 08:11 PM, said:

To anyone interested, this is a great server. The community is friendly and people are willing to help you.

Agreed. This server rules.
:)