Jump to content


RoD's Content

There have been 21 items by RoD (Search limited from 29-March 23)


By content type

See this member's

Sort by                Order  

#257132 attempt to index ? (a nil value) problem with program

Posted by RoD on 30 July 2016 - 09:33 PM in Ask a Pro

Allright, you should use the code tags to paste in code :P/> second, tell us the full error message. The error message displays the line of the error, which is very useful for debugging.

Edit: noticed you typed
paintutils.drawImage(handGood, 1 1)

instead of

paintutils.drawImage(handGood, 1, 1)

That missing comma might be the error..



#257131 Made one computer control other computers programs

Posted by RoD on 30 July 2016 - 09:28 PM in Ask a Pro

View PostThe Crazy Phoenix, on 23 July 2016 - 10:01 PM, said:

Rednet automatically handles the modem API for you, don't bother wrapping (or opening) the modem in either program. Are you sure the computers are not out of range?

alright let me give you a starting point:

Computer 1, sender (in this case, with a WIRELESS modem on his back):
rednet.open("back")
rednet.send(5, "ok") -- 5 is the id, as i am sure you already know

Computer 2, receiver (in this case, with a WIRELESS modem on his back):
rednet.open("back")
while true do -- this will run over everytime you get a new message
	senderId, mess = rednet.receive()
	print(mess)
end

If you use this code it will work. 100%,
However, if you are already trying to use the rednet on your existing code there must me some tweaks you need to make (maybe not).
Note: also after running the receiver program on the receiver computer, check if the wireless modem turns red on the side.

Edit: quoted the wrong person xD Sorry, Phoenix.



#256628 Made one computer control other computers programs

Posted by RoD on 21 July 2016 - 10:56 PM in Ask a Pro

You want to interact with other computers? You might want to use rednet. The api is really easy to understand. Give it a try



#239497 Bug with my program

Posted by RoD on 02 December 2015 - 03:38 AM in Ask a Pro

How so it does? I am really not getting how a program name and an api can have anything to do with each other, other than if the api name was renamed to "tute" in this case.



#239465 fs file searching

Posted by RoD on 01 December 2015 - 06:20 PM in Ask a Pro

Actually that's more tricky.
Everytime you run file.readLine() it jumps a line and reads it. So you have to run it in a loop or make a function to return a specific line. Like a while loop that increments 1 in each loop, and when the increment variable is == to the line you want, then return the file.readLine()



#239464 Krist - Minable currency that works across servers (paste updated)

Posted by RoD on 01 December 2015 - 06:16 PM in Programs

So what happened? He's without internet? I guess he's hosting the krist server on his own. I want da kristsss :3



#239462 Bug with my program

Posted by RoD on 01 December 2015 - 06:08 PM in Ask a Pro

View PostCreator, on 30 November 2015 - 07:30 PM, said:

If the program you show is Tute (shouldn't in be turtle?), then it means that turtle is actually nil. (strange)

The program name has nothing to do with the turtle api.



#239419 Secure way to 'sign' programs?

Posted by RoD on 01 December 2015 - 12:42 AM in Ask a Pro

View PostBomb Bloke, on 01 December 2015 - 12:21 AM, said:

Indeed, the next few lines would go something like this:

if code_hash ~= decrypt(signature) then
  error("Signature mis-match.")
end

Every addon, and every update to each addon, requires its own unique signature, provided by Quartz. If one single bit within an addon is changed, the new hash will no longer match the one stored in the old encrypted signature and verification will fail.

thats what i was talking about.



#239407 Secure way to 'sign' programs?

Posted by RoD on 30 November 2015 - 08:57 PM in Ask a Pro

View PostAnavrins, on 30 November 2015 - 08:15 PM, said:

The signature must not be on the server, they should be attached to the add-on in some way.
A good way I can think of is as a comment, in the first line of the add-on's code.
Reading it is as simple as...
local file = fs.open("add-on", "r")
local signature = file.readLine()
local code = file.readAll() #-- Won't contain the first line
local code_hash = sha.digest(code)

That way anyone can copy the first line of the add on :|



#239402 fs file searching

Posted by RoD on 30 November 2015 - 07:38 PM in Ask a Pro

Double kill



#239399 Bug with my program

Posted by RoD on 30 November 2015 - 07:32 PM in Ask a Pro

Are you sure you are using a turtle? Or are you just coding on a normal pc?



#239396 fs file searching

Posted by RoD on 30 November 2015 - 07:29 PM in Ask a Pro

Hey! To check if a file exists do like this:
if fs.exists("filename") then
--Do stuff
end

To read a file you just do the same thing as if writing, but with r instead of w:
file = fs.open("file", "r")
content = file.readAll() --#read all the file
line = file.readLine() --#you can also read only one line at a time
file.close() --dont forget to close

The fs api documentation is pretty easy to understand. Just spend a couple of minutes reading the snippets :)



#239383 Comunity program

Posted by RoD on 30 November 2015 - 04:20 PM in Forum Games

I was thinking in making something that we can all help. I think it would be interesting to see what different skills/ideas do in the same program. The program is in CC lua (duh :P).

The game goes like this:
- You copy the code from the previous person;
- You add one line OR a loop/function and its respective end;
- You may sign your line with a comment and your name;
- Post it in the forum thread;

If something is giving an error you can edit ONE line to fix it and add a comment with "fixed: your name" but do not remove any name in that line if there's one.
You can alternatively add ONE line to fix the code (even if that one line does not fix it, lets see if someone follows up your way of thinking)

Shall i start?

function beCool() --Rodsn
end



#239332 newline with term.blit()

Posted by RoD on 29 November 2015 - 11:51 PM in Ask a Pro

isn't print() the easiest way?



#239322 Secure way to 'sign' programs?

Posted by RoD on 29 November 2015 - 11:10 PM in Ask a Pro

I was thinking in generating a checksum of the program, uploading it to a webserver and whenever you want to install a program just compare its checksum with the one on the webserver.



#239026 Calculator

Posted by RoD on 26 November 2015 - 11:20 PM in Ask a Pro

This code is so big. You should probably want to:
1-Make a function to gather the NUMBER input.
2-Ask for 2 numbers AND then the operation.
That will make it easier for you to understand your code. If you need help doing that just say, but i would rather like to leave it to you so you can learn it better.



#239010 Rabbit Browser

Posted by RoD on 26 November 2015 - 06:41 PM in Programs

This has a lot of potential / pretty interesting, if your problem is paying for the hosts you can try free web hosts like 00webhost.



#238813 HaxType -- HackerTyper in ComputerCraft!

Posted by RoD on 24 November 2015 - 02:46 AM in Programs

Cool, just one quick suggestion:
Add diferent speeds.
Instead of the constant 3 chars per type speed:
	  dex = dex + 1
	  if dex <= len then
	    write(string.sub(code,dex,dex))
	  end
dex = dex + 1
    if dex <= len then
	  write(string.sub(code,dex,dex))
    end
dex = dex + 1
    if dex <= len then
	  write(string.sub(code,dex,dex))
    end
    dex = dex + 1
    if dex <= len then
	  write(string.sub(code,dex,dex))
    end

Having a customizable speed:
speed = 4
for i = 1, speed do
	  dex = dex + 1
	  if dex <= len then
	    write(string.sub(code,dex,dex))
	  end
end



#238809 Rabbit Browser

Posted by RoD on 23 November 2015 - 10:33 PM in Programs

Getting attempting to index ? (a nil value) at 157



#233398 NexCore Network V3 [MC: 1.7.10][CC: 1.75][BungeeCord][Thermos]

Posted by RoD on 24 September 2015 - 07:02 PM in Servers

Ok i try to play but my client crashes after a couple of seconds... I guess its the amount of mods in the server idk...



#228806 Attention: Translators!

Posted by RoD on 03 August 2015 - 02:09 PM in Wiki Discussion

View Postlogsys, on 24 May 2014 - 05:56 PM, said:

Portuguese/portuguese here!

Tuga?