Jump to content


remiX's Content

There have been 469 items by remiX (Search limited from 10-February 22)


By content type

See this member's


Sort by                Order  

#113766 Help needed removing cursor from code

Posted by remiX on 24 April 2013 - 04:29 AM in Ask a Pro

View PostLBPHacker, on 24 April 2013 - 04:20 AM, said:

That ">" has been put there by the Shell - that's because your program reaches its end immediately. There's no call to read in your program. BTW calling read sets the cursor-blink on again - you have to write your own read function if you want the cursor to disappear.
Hmm, just overriding the function should work?

local oldCurBlink = term.setCursorBlink
term.setCursorBlink = function() oldCurBlink(false) end
local user = read()

Then where you want to have it blink use oldCurBlink(true)



#113747 [Question] Encrypt a string from input?

Posted by remiX on 24 April 2013 - 03:10 AM in Ask a Pro

View PostMackan90096, on 24 April 2013 - 03:04 AM, said:

Is there a decryption using this too?

Yes, this would be the decryption function.
function decrypt(str)
	local temp = ""
	for i = 1, str:len() do
		local char = str:sub(i,i)
		for i, v in pairs(lookup) do
			if v == char then temp = temp .. char break end
		end
	end
	return str
end

Untested



#113719 [Question] Encrypt a string from input?

Posted by remiX on 24 April 2013 - 01:40 AM in Ask a Pro

They need to be in " " btw :P

But don't use this, it isn't secure at all...
Something like this would be better



#113675 (Video) GUI Tutorials [New video: Metatable Basics]

Posted by remiX on 23 April 2013 - 06:53 PM in Tutorials

Yeah I thought you were just going to do a simple right click menu xD

That will be quite difficult, well goodluck :P



#113670 Tron game [WIP][Multiplayer]

Posted by remiX on 23 April 2013 - 06:24 PM in Games

Wow this is pretty sick xD Nice



#113562 Parallel Api

Posted by remiX on 23 April 2013 - 09:32 AM in Ask a Pro

Yeah just to ignore it because you won't be using it



#113559 Parallel Api

Posted by remiX on 23 April 2013 - 09:26 AM in Ask a Pro

When you pull an event, even if you put a 'filter' within the function call, the event still gets returned with the first variable.
People use any short character like _ to just 'ignore' that returned variable by putting it it's place because you won't be using it.

Not sure If i explained it properly xD



#113504 Controlling Minecraft Lights With Cellphone [VIDEO]

Posted by remiX on 23 April 2013 - 07:10 AM in General

Does this SMS'ing work in all Countries?



#113499 [lua][question] Create a program with a program

Posted by remiX on 23 April 2013 - 07:06 AM in Ask a Pro

Haha. You probably overwrote something sometime...



#113490 [lua][question] Create a program with a program

Posted by remiX on 23 April 2013 - 06:49 AM in Ask a Pro

Hmmm...if your full code is the above with just the "w" replacement. It really should work...

Have you tried restarting the PC? Lol typical IT solution. Might you have edited io somehow.

Try fs?
local f = fs.open("startup","w")
w.write([[print"Starting...."
sleep(1)]]
)
w.close()

Really the same thing...
Have you changed any ComputerCraft files?



#113473 Controlling Minecraft Lights With Cellphone [VIDEO]

Posted by remiX on 23 April 2013 - 06:29 AM in General

Wow from your phone?
Really curious as to how this works :P



#113470 [lua][question] Create a program with a program

Posted by remiX on 23 April 2013 - 06:23 AM in Ask a Pro

Yeah

local handle = io.open("outfile", "w")
if handle then
    handle:write(
[[
-- Declare a function
local function foo( s )
    print( s )
end

foo( "Hello!" )
]])
    handle:close()
end



#113414 [LUA][Error(?)] Code wont work.

Posted by remiX on 23 April 2013 - 02:57 AM in Ask a Pro

View PostLBPHacker, on 23 April 2013 - 02:44 AM, said:

View PostMackan90096, on 22 April 2013 - 11:41 PM, said:

the login info is correct
What makes you sure about that exactly?
It would error here if the username didn't exist...
local file2 = fs.open("users/"..usrName.."/bg", "r") local logoPath = file2.readLine() logo = paintutils.loadImage(logoPath) file2.close()
Therefor answers my question... Add some debug lines, try this:
function login()
    term.clear()
    term.setCursorPos(math.floor(w-string.len("Logging in")/2), 1) -- was checking the length of Username: :?
    write("Logging in")
    term.setCursorPos(math.floor(w-string.len("Username:")/2), 4) -- you had the brackets wrong. you were using math.floor on an integer all the time, the /2 needs to be inside
    write("Username: ")
    local usrName = read()
    term.setCursorPos(math.floor(w-string.len("Password:")/2), 6)
    write("Password: ")
    local pass = read("*")

    if not fs.exists("users/"..usrName.."/"..usrName) then
        term.clear()
        term.setCursorPos(math.floor(w-string.len("Login failed"))/2, 2)
        print("Login failed")
    elseif fs.exists("users/"..usrName.."/"..usrName) then
        -- if the username exists, shouldn't the bg file exist too?
        local file2 = fs.open("users/"..usrName.."/bg", "r")
        local logoPath = file2.readLine()
        logo = paintutils.loadImage(logoPath)
        file2.close()

        local file = fs.open("users/"..usrName.."/"..usrName,"r") -- Only open if it exists..
        local fileData = {} -- if the file has only the password, there is no point of this :P/>
        for line in file.readLine do -- cleaner way, i think this is right. If not try adding the () after readLine
            table.insert(fileData,line)
        end
        file.close()

        local passFromFile = fileData[1]
        if pass == passFromFile then
            term.clear()
            term.setCursorPos(math.floor(w-string.len("Login succeded!"))/2, 2)
            print("Login succeded!")
        else
            term.clear()
            term.setCursorPos(math.floor(w-string.len("Login failed!"))/2, 2)
            print("Login failed!")
            error( pass .. " - " .. passFromFile ) -- debug line, if it reaches here, check what the variables are
        end
    end
    -- put this here so you don't have to repeat it all the time
    sleep(1)
    term.clear()
    drawDesktop()
end



#113404 [LUA][Error(?)] Code wont work.

Posted by remiX on 23 April 2013 - 02:44 AM in Ask a Pro

From which block is it failing? THe first if or the elseif?



#113311 some math functions

Posted by remiX on 22 April 2013 - 06:12 PM in Ask a Pro

Anything to the log of a number to the base of the same number is 1



#113126 [HELP][LUA] Text wont print.

Posted by remiX on 22 April 2013 - 06:37 AM in Ask a Pro

View Posttheoriginalbit, on 22 April 2013 - 06:35 AM, said:

View PostremiX, on 22 April 2013 - 06:33 AM, said:

Please remove the code in the code tags
At the very least put it in a spoiler! :P

Lol yeah xD

EDIT: When is it supposed to display the version, which screens



#113123 [HELP][LUA] Text wont print.

Posted by remiX on 22 April 2013 - 06:33 AM in Ask a Pro

Please remove the code in the code tags, pastebin was enough xD

Will go over it now...



#113062 [HELP][LUA] Text wont print.

Posted by remiX on 22 April 2013 - 05:00 AM in Ask a Pro

What's the last colour that get's printed with the icon paintutils image?
What does the function titleBar2 do?

My feeling is that the text colour is the same colour as the background making you unable to see it, have you checked that?



#113005 Floppy disk installation/shop

Posted by remiX on 22 April 2013 - 02:38 AM in Ask a Pro

fs.copy( "doorLock", "disk/startup" )



#113000 Floppy disk installation/shop

Posted by remiX on 22 April 2013 - 02:08 AM in Ask a Pro

Missing an end riiight at the end :P

local option1 = "1"
local describe1 = "1*"
local exit = "exit"

print("Welcome, customer.")
print("Please pick a card type to be burned: ")
print("")
print("1. Door Combo")
print("")
print("Add a '*' after your order to view product description.")
print("Example: '1*'")
print("")
term.write(">")
local input = read()
if input == option1 then
	term.clear()
	term.setCursorPos(1,1)
	print("Burning Disk...")
	sleep(5)
	print("")
	print("Please collect your disk at the door.")
	disk.eject("back")
	sleep(5)
	os.shutdown()
elseif input == describe1 then
	term.clear()
	term.setCursorPos(1,1)
	print("Door Combination Lock")
	print("Censors input characters with stars.")
	print("Program termination locked without password.")
	print("Automatic shutdown to reset program")
	print("")
	print("Type 'exit' to return to the main menu")
	print("")
	term.write(">")
	local input = read()
	if input == exit then
		os.reboot()
	end
end -- missing an end here

Indentation helps a lot.



#112790 [Forum] Adding a Screenshot to a Thread

Posted by remiX on 21 April 2013 - 03:29 PM in Forum Discussion

Or click add attachment near the bottom of the post box thingy (limit of 500kb's globally)



#112731 How can I use the parallel API in my case?

Posted by remiX on 21 April 2013 - 12:47 PM in Ask a Pro

View PostSuicidalSTDz, on 21 April 2013 - 12:00 PM, said:

View PostFreack100, on 21 April 2013 - 09:37 AM, said:

View PostSuicidalSTDz, on 21 April 2013 - 08:35 AM, said:

Most likely a variable not being defined properly (buttons would be my guess from the looks of it)

Of course, it could be anything above or below the snippet.
buttons is a table in the head of my code.
It contains two tables. In each of them are "(minX, maxX, minY, maxY, Name)"
I meant button -- However, remiX just pointed out that it is defined in the snippet, which I poorly read..

I would guess that's where he would define it. I might be wrong :P



#112724 How can I use the parallel API in my case?

Posted by remiX on 21 April 2013 - 11:57 AM in Ask a Pro

Yeah, but ID and API_path need to be variables, obviously.

Wheres the button variable defined in the register program? -- Nevermind, within the snipped part.



#112693 How can I use the parallel API in my case?

Posted by remiX on 21 April 2013 - 10:04 AM in Ask a Pro

Oh okay, cool :)
Will help you then :P



#112692 [Lua] Same code not working twice o_O

Posted by remiX on 21 April 2013 - 10:04 AM in Ask a Pro

It makes it local to the block.

Like so:

local var = "sup"
moo = true

if moo then
	local ifvalue = "what?"
	print(ifvalue) -- "what?"
	for i = 1, 2 do
		local test = "yeah!"
		print(test) -- "yeah!"
	end
	print(tostring(test)) -- nil!
end

print(tostring(ifvalue) -- nil!

moo there is a global variable. Will be able to be used within other programs, but restarting the pc will reset it.