Jump to content


gknova61's Content

There have been 15 items by gknova61 (Search limited from 10-February 22)


By content type

See this member's

Sort by                Order  

#186210 GUI.API | Simple & Powerful Buttons,Dialogue Boxes, Text-boxes, and More!

Posted by gknova61 on 30 June 2014 - 09:17 AM in APIs and Utilities

I just tried buttons (first & last thing I tried), and I got this error:
Just downloaded the API so latest version.
[string "gui"]:70: attempt to index a nil value after running the following code
os.loadAPI("gui")
button = gui.createButton(  "button", function() print("Hello World!") end ) --#This creates a new button with a function that when triggered will print "Hello World!"

button:draw( 1,1, 5, colors.green, colors.white ) -- #This draws the button at (1,1) with a width of 5. The first color is what the buttons color will be and the second color is the text color

button:toggle( colors.red,4) --#This toggles the buttons color to red for 4 seconds (If you leave the second argument as nil it will just toggle the button)

button:trigger() --#This triggers the buttons function

gui.detect( 1,3,true ) --#this checks an array of all the buttons you've defined and returns the name of the button. If you also set the third argument to true it will trigger that buttons action
It errors on button:trigger()



#172651 Unlimited Range Message System - Video

Posted by gknova61 on 10 April 2014 - 07:02 AM in Media

Really cool, but a word on security. It'll send every single message it gets through those floppies in the clear over rednet for anyone to intercept and read. Why isn't the computer reading the floppy?



#171372 CcSQL (API for MySQL)

Posted by gknova61 on 02 April 2014 - 11:34 PM in APIs and Utilities

Can you release PHP source?



#164691 2 parallel functions running, only one of them recieving events

Posted by gknova61 on 12 February 2014 - 08:08 PM in Ask a Pro

Thank you so much! Resolved!



#164572 2 parallel functions running, only one of them recieving events

Posted by gknova61 on 12 February 2014 - 05:46 AM in Ask a Pro

Basically I've got this code:
function thread1()
while true do
local ev = {os.pullEvent()}
print("THREAD 1: "..ev[1])
end
end

function thread2()
while true do
local ev = {os.pullEvent()}
print("THREAD 2: "..ev[1])
end
end

parallel.waitForAll(thread1(),thread2(),thread3())

Only the first function called (thread1) gets a pull event whenever I press a key like this:
Posted Image

What I want to be able to do is make it so both functions recieve the pull event so they can process it their own separate ways instead of just 1 function getting the pull events.



#162451 Regarding Crypto Key Exchange

Posted by gknova61 on 29 January 2014 - 12:21 AM in Ask a Pro

Hey guys, I just got a question on how 2 computers can securely exchange or agree on a symmetric key. Now, what I've got now is an RSA Public PreSharedKey for each of the 2 respective computers so they can communicate encrypted using RSA but given the performance and other issues of RSA, I'd rather just use RSA so the clients can communicate as little as possible to agree on an AES-256 Symmetric key to use. I've looked at the Diffie-Hellman key exchange but I've never really grasped it fully. If someone can help me implement that version of a key exchange in lua or explain how I can? Even explaining a different or better way to get 2 clients to agree on a symmetric key would be great :)



#156676 Merry Christmas Presents!

Posted by gknova61 on 15 December 2013 - 03:31 PM in Programs

View Postwillwac (NewCoolPC), on 15 December 2013 - 12:41 PM, said:

I get a startup error!
Mind providing the error mate? Works fine here.



#156544 Zombienet - Http, Cross Server Communication!

Posted by gknova61 on 14 December 2013 - 07:30 PM in APIs and Utilities

Could we get a tutorial and/or the scripts you're using server-side? The website directory? I just want to see how the current code works messy or not and host it on my server so it's more reliable for me.

Edit: When I try to use the API to just get a key, it errors with cannot connect to the server, too.



#156506 [mc 1.6.x] Openperipheral

Posted by gknova61 on 14 December 2013 - 05:04 PM in Peripherals and Turtle Upgrades

Does OpenPeripheral 1.6.2 still support Ironchests? It's not in the docs.



#156471 FileServ - File Storage Client-Server

Posted by gknova61 on 14 December 2013 - 02:59 PM in Programs

View Postoeed, on 13 December 2013 - 04:07 AM, said:


Looks good!

Now, this may be rather hard, but what about being able to 'mount' your folder. Similar to how Dropbox makes a folder it syncs.
You would need something running in the background on startup checking that folder every x time. The hard part is that it can override rednet message recieving for another program you have running or vice versa since only 1 function (thread) at a time can be checking for rednet messages. If more than 1 function is checking (like running on parallel), only 1 function is going to get that message.

Here is some example code:
function fileServThread()
while true do
os.pullEvent("rednet_message")
end
end

function mainProgramThread()
while true do
os.pullEvent("rednet_message")
end
end

parallel.waitForAny(fileServThread,mainProgramThread()

In the above code only 1 function is going to get that rednet message (usually the one called first, I think). The crazy workaround is writing another function for recieving all rednet messages then when it does, queue an event (like rnet_message1 or rnet_message2 to designate threads) to the other threads waiting for a 'sub' rednet message event like so:

function listenForRednet()
while true do
ev,id,msg = os.pullEvent("rednet_message") --Can also be rednet.recieve
if msg == "for file serv" then
os.queueEvent("rnet_message1",id,msg) --send this event to fileServThread
elseif msg == "for main prog" then
os.queueEvent("rnet_message2",id,msg) --send this event to mainProgramThread
end
end

function fileServThread()
while true do
os.pullEvent("rnet_message1") --recieving one type of event
end
end

function mainProgramThread()
while true do
os.pullEvent("rnet_message2") --recieving the other type of event
end
end

parallel.waitForAny(fileServThread,mainProgramThread,listenForRednet)



#156470 Merry Christmas Presents!

Posted by gknova61 on 14 December 2013 - 02:52 PM in Programs

Haha, here in Hawaii it's a 80F sunny day. We're not affected by seasons nor do we get snow :D



#156388 Merry Christmas Presents!

Posted by gknova61 on 14 December 2013 - 04:01 AM in Programs

View PostCastform, on 13 December 2013 - 10:36 PM, said:

Merry Christmas! And coal for you all!
Looks cool, may try it out!
Thanks! Let me know how you like it and what I can change! Remember that this works best on a server :D

View Postoeed, on 13 December 2013 - 11:52 PM, said:

Nice idea, it is possible to put leaves on those trees right?

I suppose, for most people it's winter at christmas and many trees loose their leaves. In Australia, however, sometimes we get 40˚C christmases... hot hot hot.
Yes, sir it is possible.



#156331 Merry Christmas Presents!

Posted by gknova61 on 13 December 2013 - 10:21 PM in Programs

Originally released on the SKCraft server by sk89q (best to use on a server with players or you'd just gift yourself once :P) but decided to release this to the public!

Who needs a ChristmasCraft tree when we have ComputerCraft! This program is made for those out there feeling a little generous this holiday Posted Image.

Using a computer, a player detector, some redwire, and a dispenser, you can easily setup your own Christmas gift-giving stand where players just need to right click
on a player detector to get their present! Once they interact with the detector, their name is logged into a database (including a human-readable 'Christmas List' file) so
they cannot get multiple gifts.

Tutorial:
Step 1 - Setup your computer (usually want this hidden), player detector, and your dispenser. You can do this anyway you want as long as the player detector is touching
the computer, and the redwire is like so:
Posted Image
Posted Image
Note: You can setup the redwire, and player detector on any side of the computer as shown here:
Posted Image

Step 2 - Load the program onto the computer and name it 'startup' then restart. Enter the side that your redwire is on:
Posted Image
Step 3 - Have your people interact with the player detector to get their presents! I would suggest a bag of holding or similar.
Posted Image
Posted Image

Question: Would there be any interest for a naughty/nice list where you can specify who doesn't get a present or where you specify
the only people who can?

Download: pastebin get 2W9BXSKb startup
gist get 7955418
http://hastebin.com/beyigagiwe.js


Credits: Config API by ben657

Happy Holidays, everyone!



#156263 Dark programs: Base security / Remote login / Keycards / Server & multipl...

Posted by gknova61 on 13 December 2013 - 12:54 PM in Programs

Potential security hole in your client. They don't check the ID of the computer sending the '#granted' message so you can just make a program sending that encrypted over and over until the redstone signal happens.



#146845 Passing Parameters Between Programs

Posted by gknova61 on 27 September 2013 - 02:04 AM in Ask a Pro

You could also incorporate arguments into the program you wana pass your parameters to like so:
local tArgs = {...}
if #tArgs < 3 then
   error("Needs moar parameters!")
end
local x,y,z = tArgs[1],tArgs[2],tArgs[3]
You'd put this at the top of your program to recieve the parameters.

For the program sending the parameters, you can do a shell.run passing the parameters like so:
shell.run("programname "..x.." "..y.." "..z)