- ComputerCraft | Programmable Computers for Minecraft
- → Rwkeith's Content
Rwkeith's Content
There have been 13 items by Rwkeith (Search limited from 10-February 22)
#72371 [API] Mouse and graphic api V1.6.1 beta. Easy to use GUI API with full mouse...
Posted by
Rwkeith
on 11 January 2013 - 08:29 AM
in
APIs and Utilities
Is it possible to draw an image to the screen?
#70272 [API] Mouse and graphic api V1.6.1 beta. Easy to use GUI API with full mouse...
Posted by
Rwkeith
on 07 January 2013 - 07:01 AM
in
APIs and Utilities
Very nice man. Keep up the work. P.S. I got BF3 too for christmas(xbox) =D
#70221 [Lua] Slight problem with my Decrypted output
Posted by
Rwkeith
on 07 January 2013 - 05:06 AM
in
Ask a Pro
imef, on 06 January 2013 - 03:51 PM, said:
Here's a corrected part of the code :
The Problem came from the statement : "keyTable[t] = string.byte(keyTable[t])" in the encryption loop.
This instruction is executed "size" times in the non corrected version whereas it should be done only "ksize" times.
Why only the beginning of the text was affected remains a mystery to me.
Spoiler
for n = 1,kSize do
keyTable[n] = string.byte(string.sub(key,n,n))
end
--Encrypt
for i=1,size do
if i > kSize then
t = (i % kSize) + 1
else
t = i
end
textTable[i] = string.byte(textTable[i])
textTable[i] = bit.bxor(textTable[i],keyTable[t])
textTable[i] = string.format("%c",textTable[i])
end
The Problem came from the statement : "keyTable[t] = string.byte(keyTable[t])" in the encryption loop.
This instruction is executed "size" times in the non corrected version whereas it should be done only "ksize" times.
Why only the beginning of the text was affected remains a mystery to me.
Thanks a ton for catching that
#69942 [Lua] Slight problem with my Decrypted output
Posted by
Rwkeith
on 06 January 2013 - 12:36 PM
in
Ask a Pro
My code syntax is fine. The problem is the output. This program does a simple xor encryption/Decryption with a text string and a key provided. It prints out the decrypted/encrypted text. The output however is messed up.
Just the first few characters of my decrypted string is not right. The rest of my string is intact. The longer my key is, the longer the incorrect characters.
Just the first few characters of my decrypted string is not right. The rest of my string is intact. The longer my key is, the longer the incorrect characters.
--Let's see here
--This might work..
textTable = {}
keyTable = {}
readFile = fs.open("log","r")
text = readFile.readAll()
readFile.close()
print("Unencrypted:")
write(text.."\n")
--Inialize tables
size = string.len(text)
for o=1,size do
textTable[o] = string.sub(text,o,o)
end
key = "string"
kSize = string.len(key)
for n = 1,kSize do
keyTable[n] = string.sub(key,n,n)
end
--Encrypt
for i=1,size do
if i > kSize then
t = (i % kSize) + 1
else
t = i
end
textTable[i] = string.byte(textTable[i])
keyTable[t] = string.byte(keyTable[t])
textTable[i] = bit.bxor(textTable[i],keyTable[t])
textTable[i] = string.format("%c",textTable[i])
end
print("Encrypted:")
for z=1,size do
write(textTable[z])
end
print()
local s = table.getn(textTable)
print("Size of Encrypted:"..s)
print("Size of Original:"..size)
--Decrypt
for i=1,size do
if i > kSize then
t = (i % kSize) + 1
else
t = i
end
textTable[i] = string.byte(textTable[i])
textTable[i] = bit.bxor(textTable[i],keyTable[t])
-- textTable[i] = string.format("%c",textTable[i])
textTable[i] = string.char(textTable[i])
end
print("Decrypted:")
for z=1,size do
write(textTable[z])
end
print()
Quote
pastebin get hQctdisk encrypt
#69895 Index Expected, got Nil.
Posted by
Rwkeith
on 06 January 2013 - 10:09 AM
in
Ask a Pro
I'm assigning values to an array. However, my for loop doesn't seem to be working right.
I've tested my size variable. That's fine. I've also tried to use string.sub(text,o,o), but that gives me a similar error. However, I can assign it to a variable and print the variable. Any advice would be appreciated.
for o=1,size do
textTable[o] = string.sub(text,o,o)
end
I've tested my size variable. That's fine. I've also tried to use string.sub(text,o,o), but that gives me a similar error. However, I can assign it to a variable and print the variable. Any advice would be appreciated.
#68989 KreOS 3.01 Skylark - Old traditions newly defined
Posted by
Rwkeith
on 04 January 2013 - 09:46 PM
in
Operating Systems
People seem to not read your bug list =P I love what your doing here and it's actually the first 'OS' I've used for CC. I like the details as well. I'm interested in seeing more detail in the menu's too. I'm sure you've got plans for this already, but I will definitely continue using this.
#29580 Running a program inside a program?
Posted by
Rwkeith
on 03 September 2012 - 05:37 PM
in
Ask a Pro
Hi, I'm trying to run a program using os.run or shell.run and I have no luck. I'm trying to create a program that will automatically run "gps host x,y,z". But it will only run gps, and not 'gps host'. There's no api for this so im stuck with running it. Can anyone mind telling me what I'm doing wrong?
- ComputerCraft | Programmable Computers for Minecraft
- → Rwkeith's Content


