TOG Latest

Planetside 2 Release 20-Nov-2012 PST

The long awaited and critically acclaimed PlanetSi...

Guild Wars 2 Launch Date: 28th August

Guild Wars 2 will officially launch on Tuesday, Au...

Source Wars End in an Epic Battle!

Ever watch the movie Rocky? Who hasn’t, right? W...

Review: Ducky DK 9008 Mechanical Keyb...

Division Latest

TOG MindCrack - Mining, Machines, Mag...

TOG's MindCrack Minecraft server offers all that's...

Get to know your guildmate interview ...

Ral Partha interviews TOG member and Guild Wars 2 ...

Machines and magic in Minecraft - 'Fe...

Over the vacation period, a "Feed The Beast" Mod p...

Get to know your guildmate interview ...

Ral Partha interviews TOG member and Guild Wars 2 ...

Old 4th March 2013, 09:27 AM   #1 (permalink)
Ace - Post: 7744
 DaedalusAlpha's Avatar

Default Mindcrack: ComputerCraft pasting program

I've written a pasting program for ComputerCraft (so you don't have to fight the CC editor). There are others on the net, but I think this is faster compared to them. On the other hand it will jumble the code, so it's very hard to read once it's pasted (but this is of minor consequence as you typically want to read your original files instead).

It takes maybe 30 seconds to paste a 200 line program and I use it for all my programs now.

The program is written in c# .net and will only work on Windows.

I'm sure there are bugs

Basic usage is easy;
1) You start the program
2) open the file you want to transfer
3) go to minecraft and the CC computer and edit the program you want to write so it's open in the editor (it must be empty when you start)
4) press RCtrl (not the normal left Ctrl) ONCE to start the pasting process (it can take a second or two to start). Do not switch focus after this!
5) when the pasting process is done the program will be saved and the editor closed.
6) when you're back at the normal prompt it's done.

The program will hook onto global keys (to be able to listen for RCtrl) so if your virus guard isn't completely useless it should not be happy with this program
But I promise it ONLY listens for RCtrl, no recording of keypresses. If in doubt, make sure the program is blocked in the firewall and that it's not running when you input any important codes. If really important I can supply the source code as well, although it's pretty fast and sloppy.

If anyone still is interested in the program after these disclaimers contact me
__________________
EVE Online characters:
Daedalus II
ex-CEO TOGOA, Daedalus III slave of Daedalus II
GW2 characters:
Little Molok Asura Engineer


"Each day I don't get an attempt on my life by a robot from the future I see as a personal failure"
DaedalusAlpha is offline   Reply With Quote

Old 4th March 2013, 10:11 AM   #2 (permalink)
Vice Division Captain
Minecraft
Lethal - Post: 5128 TOG Platinum Level Supporter
 DarkDuck's Avatar

Mellow
Default

Nice work Daed, once I get into computer craft I may bug you
__________________
http://i642.photobucket.com/albums/uu141/Darkduck/GW2Sig4CharacterSeriesDarkDuck.png
DarkDuck is offline   Reply With Quote
Old 4th March 2013, 11:19 AM   #3 (permalink)
Division Vice Captain
War Thunder
Dangerous - Post: 646
 D3lthar's Avatar

Devilish
Default

Nicely done and well needed.
__________________
http://www.theoldergamers.com/forum/image.php?type=sigpic&userid=46507&dateline=134061  2347
D3lthar is offline   Reply With Quote
Old 4th March 2013, 12:24 PM   #4 (permalink)
Retired Captain
Retired Captain
Ace - Post: 8164
 Sorontar's Avatar

Default

I recommend you make it so that the keyalert can be changed to another key by the player. R_CTRL may have functions for players due to its proximity to the arrow keys (e.g. it's my jump key).

Sorontar
__________________

Sorontar is offline   Reply With Quote
Old 4th March 2013, 01:40 PM   #5 (permalink)
Division Captain
Minecraft
Deadly - Post: 1875
 Irimar's Avatar

Grumpy
Default

I assume you've tested code pasted with this? Lua is whitespace sensative, it relies on indentation levels to group code blocks, so you could introduce problems if the code pastes in jumbled.
Irimar is online now   Reply With Quote
Old 4th March 2013, 09:40 PM   #6 (permalink)
Ace - Post: 7744
 DaedalusAlpha's Avatar

Default

@ Sor
I could make it interchangable, I just picked RCtrl as it was the only key I could think of that you were extremely unlikely to have mapped to anything else. I mean you don't want to map it to "." or something and have it start pasting as soon as you happen to end a sentence
If there is a demand for this I will fix that, but for now this is a utility program mostly written for my own needs which I decided to share with TOG.

@ Irmar
All my programs are pasted with this. As far as I know lua don't care about indentation or newlines (except for comments). My program removes any newlines and repeat spaces (unless inside a string) and cut each line at the space closest before character 50. Strings will always be kept on one row (but must be less than 126 characters long as more can't be pasted on a single line due to technical limitations).

I haven't tested the program using tabs instead of spaces. It will most likely still work, but more whitespace will be kept making the code take a bit more room (which is a very minor problem).

Also comments are a problem. If you want to make a comment in the code without messing it up it must be in the form:
--[[ Comment ]]
not
-- Comment

As I said, the program is very quick and dirty
Many special cases should be taken into more consideration, for example removing comments altogether would make pasting a bit quicker and less error prone.
__________________
EVE Online characters:
Daedalus II
ex-CEO TOGOA, Daedalus III slave of Daedalus II
GW2 characters:
Little Molok Asura Engineer


"Each day I don't get an attempt on my life by a robot from the future I see as a personal failure"
DaedalusAlpha is offline   Reply With Quote
Old 4th March 2013, 10:00 PM   #7 (permalink)
Retired Captain
Retired Captain
Ace - Post: 8164
 Sorontar's Avatar

Default

I must warn that other servers have banned players writing their own code due to the lack of control they have. We have given the division a lot of latitude on our MindCrack server, so I strongly recommend players test any code out on single player first, and keep things simple. If you want a turtle to guard, leave its programming to that. Don't try make it polish your boots as well.

And don't forget the quarry rules apply to mining turtles.

Sorontar
__________________

Sorontar is offline   Reply With Quote
Old 4th March 2013, 10:17 PM   #8 (permalink)
Ace - Post: 7744
 DaedalusAlpha's Avatar

Default

Yeah I would still not recommend anyone not experienced in programming to use ComputerCraft. It's ever so easy to produce programs that can be VERY damaging to the server.

ComputerCraft is a great way to learn programming due to the immediate response you can get via redstone and such, but I would leave the experimenting to singleplayer as Sor said.
__________________
EVE Online characters:
Daedalus II
ex-CEO TOGOA, Daedalus III slave of Daedalus II
GW2 characters:
Little Molok Asura Engineer


"Each day I don't get an attempt on my life by a robot from the future I see as a personal failure"
DaedalusAlpha is offline   Reply With Quote
Old 5th March 2013, 12:16 AM   #9 (permalink)
Division Captain
Minecraft
Deadly - Post: 1875
 Irimar's Avatar

Grumpy
Default

I've had more than one program throw errors that were only fixed by cleaning up the white space. Maybe stripping out the newlines makes it just read the block delimiters.

Either way, if it works, it works. It's a very useful thing to have available.
Irimar is online now   Reply With Quote
Old 5th March 2013, 12:32 AM   #10 (permalink)
Ace - Post: 7744
 DaedalusAlpha's Avatar

Default

Well I guess if you for example called a function like this:

Function ()

with a space between the function name and (), that could possibly be a problem if the program decided to put a line break there. But I'm not sure that is syntactically correct to begin with (I've never written it like that myself so I don't know).
__________________
EVE Online characters:
Daedalus II
ex-CEO TOGOA, Daedalus III slave of Daedalus II
GW2 characters:
Little Molok Asura Engineer


"Each day I don't get an attempt on my life by a robot from the future I see as a personal failure"
DaedalusAlpha is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +11. The time now is 02:03 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0