Hack is a lightweight notebook and/or code development addon.
Hack makes it easy to manage a large collection of notes/scripts and share them with other Hack users. Pages containing Lua code can be run and/or flagged to auto-run on startup; they can call other pages, passing arguments and receiving return values. This lets Hack serve as an in-game file system for Lua scripts.
OPTIONAL:
Hack includes several example pages. They are easily deleted from within Hack, or you can prevent them from ever being loaded by deleting HackExamples.lua from the Hack folder.
Hack itself is lightweight (<60KB), but it includes a library for highlighting/indenting Lua code (FAIAP) which will add some additional memory usage and garbage generation. It's not a big deal, but if you just use Hack as a notebook and never edit Lua code, feel free to delete Indent.lua from the Hack directory.
IMPORT:
Hack's example pages include scripts to import pages from Tinypad, Nefpad, WowLua, and LuaSlinger. LuaSlinger supports triggering pages by events, and the importer shows how easily you can wire up the same functionality in Hack.
If you have another notepad addon you want to pull pages from, lemme know.
USAGE:
/hack -- toggle Hack UI /hack <hack name> -- run a Hack page by name
The UI is mostly self-explanatory (mouse over buttons to see what they do), but a few things deserve special mention:
1. To run the current page as Lua code, click the 'play' button at the top of edit window (this one) or hit SHIFT+TAB from the editor.
2. To make a page run automatically when Hack loads, click the 'play' button next to it's name in the list window. This makes Hack useful for little tweaks that don't warrant a full-blown addon. For instance, I hate the mail font. It's easy to fix, but I don't want to write a whole addon for two lines of code, so I type the lines into a Hack page and flag it to execute. Done.
NOTES:
* Pages are saved as you type and there is no undo, so be careful. If you really screw up a page, you can hit the Revert button, which will give you back the page as it was when you first opened it.
* The list frame and edit frame are resizable. Just grab the little handle in the bottom right corner.
* You can double-click a page name to rename it (in addition to using the rename button).
* Page search is case insensitive. You use a subset of regex search patterns (^$.*-+?).
* Autorun pages run in the order they appear, so you can control their execution order by moving them up and down the list.
EXAMPLES:
I included example pages to show how I use Hack. You can delete these quickly via the books tab. To speed Hack's loading, remove HackExamples.lua from the addon folder.
The "lib:" pages contain library code I find useful in many scripts. To facilitate the use of libraries, Hack contains one built-in function Hack.Require, which can be used to make sure a page you are dependent on is loaded, while preventing it from being loaded more than once.
The arg processing examples show how you can execute a page by name, optionally passing arguments and/or receiving return values.
The "timer lib" examples show how to use "lib: timer".
The "cmd:" examples add new slash commands to the game.
The "ui:" examples are various minor tweaks to the UI.
The "hack:" examples are bits of code I used to write Hack. Saves you a lot of reloading to develop with a tool like this.
FEEDBACK:
I'd love to get feedback about Hack. What you like, what you don't like, what you'd like to see in future versions (keeping in mind that my intention is to keep it as small as possible).
Cheers,
Eric Tetz
<erictetz@gmail.com>
Change Log - Hack
1.2.2 Cosmetic changes (removed background texture, added grips to window corners, etc.)
1.2.1 Fixed bug in indent library.
1.2 Syntax highlighting can now be toggled on/off on a per page basis, or can be permanently disabled by deleting Indent.lua from the Hack folder. This required some fixes to the library, so Hack is no longer compatible with vanilla FAIAP.
1.1.2 Syntax highlighting no longer optional (until I can work out some bugs in the library which prevent it from being enabled/disabled on the fly).
1.1 Added "Send" button, fixed bug in Quest Query example, add/removed/improved a few examples.
1.0.6 Fixed error in Snap which caused edit window to disappear; changed ESC behavior (now clears focus from edit box). Bigger changes coming... *dun dun dun*
1.0.5 Updated to WotLK compatible, including a few necessary changes to the example pages (Quest Query and 'lib: event' in particular)
1.0.4 Update event lib and LuaSlinger importer
1.0.3 Added importers for other notebook addons, made Hack.lua WotLK compatible (Hack.xml will have to wait for release), various minor polish tweaks.
1.0.2 Added support for All Indents and Purposes
1.0.1 Update SavedVariables in TOC
Optional Files - Hack
Sorry, there are currently no optional files available.
Originally posted by sconley Please post an update.
I like this addon and want to see the new additions.
I'll miss books but I'll get over it
I 2nd this, awesome addon, the removal of book organisation will be no terrible loss to me since - as stated - I like my pages to be there for every toon anyways.
Though perhaps flagging a page as archived or inactive to move it out to a 'storage' tab? This way the many (excellent) example pages wouldn't clutter up the main page? Just a thought.
Originally posted by Mud My private copy of Hack has evolved a bit -- more efficient highlighting code, line numbers, per-page keybinds -- but I'm reluctant to release it because I removed books and I know that's going to piss people off.
Mud, I would recommend that you go ahead and release your current copy, with the stipulation that it doesn't support books anymore, and let folks give it a try. Me personally, I don't use books and there are probably a lot of other players who don't either and would very much like to give your latest changes a try.
If you do decide to go this route (and I really hope you do), you might want to post how players who do use books can migrate to the latest version without losing their code.
Originally posted by Dulark I love Hack! I can't wait for the next update.
My private copy of Hack has evolved a bit -- more efficient highlighting code, line numbers, per-page keybinds -- but I'm reluctant to release it because I removed books and I know that's going to piss people off. The implementation was just so anemic (e.g. no way to transfer between books), I kept vacillating between (1) leaving it half-assed, (2) fleshing out the implementation, (3) or removing it to simplify the code. I never used books, so I chose #3. I want Hack to be minimal, so everything included should be virtually necessary, and pages just weren't; you can organize pages other ways.
I've been thinking about restoring those tabs for global and character specific pages, but I'm not sure that's ideal either. I mean, what if you want a page for toons A, B, and C, but not X, Y and Z? I was thinking of having all pages visible to all users, but the autorun enable/disable be character-specific.
As for a forum, I really want that. I'd like something like this site, where you could rank and search Hacks, but I guess just throwing up some open source forum software would be better than nothing...
I love Hack! I can't wait for the next update. I have some ideas that you might think about for your next release:
wiki like links: Create a link to another page
Profiles! I have druid code auto run on startup, and I can't tell you how many times I've forgotten to turn it off when I'm on my other toons. I think something like the macros screen, were there are global pages, and the current profile pages would be nice.
A hack forum! A forum or something else where we can go and get more hacks to put in our books. I love the idea of the scaling, and never thought of how to do that.
Thanks again for this great addon! If you need help, let me know and I can do what I can.
Originally posted by Mud
[b]Well, first let me say that -- at the moment, anyway -- books are removed. Of course I did that before reading your post -- you're the first person I've heard say they use them.
Well just to add another voice, I've posted down below as well that I find them quite useful.
And another question comes to mind, if you do decide to drop books for good, what is your policy on 'addons' to the mod? For example, would it be alright with you if I released a books addon to Hack to add them back or would that just not be alright?
Well, first let me say that -- at the moment, anyway -- books are removed. Of course I did that before reading your post -- you're the first person I've heard say they use them.
My reasoning:
Nobody I've asked says they use them (you're the first), I never use them, so I figured it was a superfluous feature. I want to keep Hack as simple and lightweight as possible, so as I added new stuff I wanted to prune anything which has proven unnecessary.
It complicates adding new features. For instance, I added line numbers, and I want to make it so that errors would popup the appropriate Hack page, but that requires more code to deal with the possibility that the page is not in the current book. It's not a lot of code, but adds up when multiple parts of the code must deal with book handling.
I originally added books because I was able to do it with very little code, in part because the implementation is half-assed. You should be able to turn autorun on/off for entire books, you should be able to easily move pages in between books, etc. In other words, if I'm going to do the feature right, I would need to add more code, and if few people use the feature, that's even more wasted space. I'd rather just not have the feature than have a half-assed implementation which complicates the rest of what I want to do.
I never used books, and as it seems that Hack's audience is very small, I figured I might as well please myself. ^_^
But reading your post makes me feel guilty.
Quote:
Different Characters, different hack book.
Does that even work? I mean, Hack autoruns all autoexec pages in all books when it starts up, so they may as well all be in the same book. The way I currently do character specific stuff is to have a page called 'character setup' where I have logic like:
Code:
local name = UnitName('player')
if name == 'Roguetacular' then
HackRun 'custom combo points'
elseif name == 'Hunterorific' then
HackRun 'auto tracking'
end
Not very sexy, I guess.
Quote:
This is a great way to put in the variables for my addon that I would like to allow others to be able to modify, so I have a UI Settings Book, a Class Specific set of books, Pally Book, Hunter Book, I don't wanna see all the Hunter codes I use on hack while I'm logged in as my priest.
Hmmm.. I'm not sure what you mean here, are you using Hack as the configuration panel for your addon? In that case, I guess books would be nice.
Now I'm conflicted again. *sigh*
Just gotta remind myself that simpler = better, and despite your heroic example, very few people actually use the books.
Could you add a "run page" button on the main list. I keep one bit of code ready and need to run it often, yet opening the page everytime just to run the code is getting tiring. If I have it highlighted on the list, I'd like to just click a button on that page and have it run without needing to open the other window
Love this addon, I've added just about everything I can find in the loot filter and I never have to open my bags to trash or open anything . . . thanks
I actually have discovered a couple reasons to leave books in . . .
1.) My entire interface is scaled at .65 exept every addon that doesn't have scalability in the code and also Blizz's default frames (bank, Guildbank, character, etc) So I took a list of viewable frames I had that were too big and in hack put:
FrameName:SetScale(.65);
for each frame, set it to run on load and now my interface is 100% scaled . . . now the need for books in this situation . . . Different Characters, different hack book. My other character I may have other addons and can put there frames in to do the same thing, Cause if I do it on one character and the frame hasn't been shown or the addon isn't loaded, it breaks the whole page after the error.
2.) I'm developing an addon and it is my first, I don't know lua or xml . . . just basics. Using Hack I have been able to do so much that my lists on the left are getting long for each character. This is a great way to put in the variables for my addon that I would like to allow others to be able to modify, so I have a UI Settings Book, a Class Specific set of books, Pally Book, Hunter Book, I don't wanna see all the Hunter codes I use on hack while I'm logged in as my priest.
3.) I can make books like, "UI Tips & Tricks", "FAQs", "Settings" some text, some code, would be cool if you could set a book to run when you open the tab.
4.) I have managed to find alot of uses for books, although pages have the same effect, I simply like having the tabs down there for easy orginization . . . and I was one person who at first said we didn't need books.
hope you keep em, if you don't need em, don't use em, but would be nice if they stayed for those of use who do use em.
Originally posted by Zanyth0x42 Any chance we could get a 'lock' button for the pages? There are many times when highlighting text to copy and paste, I accidentally hit a key and then lose it all with the overwritten one >.>
I have some higher priority stuff at the moment, but I'll consider that for future revs.
In the meantime, if you accidentally screw up a page, you can hit the Revert button to get the page's original text back.
Any chance we could get a 'lock' button for the pages? There are many times when highlighting text to copy and paste, I accidentally hit a key and then lose it all with the overwritten one >.>
Originally posted by Mud Glad you like it, man. You're using it exactly the way I am. I keep meaning to update it (line numbers would be nice), but it does what I need as-is so I've been lazy.
If I got rid of the Books tab (which I never use), would that affect you? Just curious.
Originally posted by kellewic
[b]Just have to say I love the addon. I took all my one off "addons" and macros and consolidated them all to Hack.
Glad you like it, man. You're using it exactly the way I am. I keep meaning to update it (line numbers would be nice), but it does what I need as-is so I've been lazy.
If I got rid of the Books tab (which I never use), would that affect you? Just curious.