Download
(62Kb)
Download
Updated: 05-02-09 04:29 AM
Pictures
File Info
Updated:05-02-09 04:29 AM
Created:unknown
Downloads:15,242
Favorites:68
MD5:

Hack  Popular! (More than 5000 hits)

Version: 1.2.2
by: Mud [More]

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
<[email protected]>

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 (0)


Post A Reply Comment Options
Unread 10-16-08, 10:07 PM  
thegabbert
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 93
Uploads: 2
I have either a bug report or a gripe, depending on whether or not the following behavior was intentional.

I have set up three books, one for notes, one for scripts I write, and one the example book that comes with the mod. The example book is unmodified.

The behavior I take issue with is that only the "current" book is checked for autorun scripts on startup. So if I am looking at the examples book and I reload ui, autorun scripts in my scripts book do not fire. If I switch to my scripts book and try to execute one of them, it works fine. But if I reload ui at that point, my scripts do fire but they complain about functions defined in the examples book, which never fired. Worse still, if I happen to be looking at my notes book when I reload, nothing fires!

For the short term, I have moved all my notes and scripts into one book, and everything seems to be working fine. But it would help me out immensely if all books would autorun scripts on startup.
Report comment to moderator  
Reply With Quote
Unread 10-16-08, 11:21 PM  
Mud
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 8
File comments: 23
Uploads: 4
Originally posted by thegabbert

The behavior I take issue with is that only the "current" book is checked for autorun scripts on startup.
Alas, this is true. A related problem is that there is no (easy) way to run pages from books other than the currently selected one. This is mostly because I hadn't quite settled on what those secondary books were really for. I've been letting it percolate in my brain for a bit.

I'll think out loud for a second here, so I can get some feedback before making any changes.

Initially 'books' were going to be 'profiles', in which case it makes sense for only the selected one to run (with the index of the selected book stored per-character; currently it's not). I can easily make autorun iterate through all books, but then they couldn't be used as profiles (as John Carmack said, "The cost of adding a feature isn't just the time it takes to code it. The cost also includes the addition of an obstacle to future expansion.")

I need to figure out some way of letting you enable some scripts only for certain toons. I don't think the traditional profile approach -- where each profile has a totally separate data -- suits Hack, because you really want to share pages (probably the majority) between profiles.

Ideally, you'd be able to toggle individual pages as "private" or "public" (or local/global, me/everyone, etc.) so that private pages are seen only by your character and public pages are shared between all characters. I put a lot of thought into that, but it's a nightmare to implement if you want to maintain the pages as an ordered list. Any clever ideas in that regard would be helpful.

I suppose I could just totally ditch the idea of supporting profiles directly, and you just maintain a Hack page which runs player-specific pages on startup. Something like:

Code:
   local profile = { 
      Mud = { 'sheep watching hack', },
      Rhodes = { 'shapeshifting hack', 'tanking hack', 'some other hack' },
   }
   for page in pairs(profile[UnitName'player'] or {}) do 
      Hack.Run(page)
   end
Another option might be to have one character-specific book (which cannot be deleted), with all other books global.

Thoughts?

Anyway, don't want to make any decisions right now (massive sleep deprivation). I'll take a fresh look in the morning.

Cheers,
Mud
Last edited by Mud : 10-17-08 at 09:25 AM.
Report comment to moderator  
Reply With Quote
Unread 10-17-08, 07:08 AM  
Nefarion
A Defias Bandit
 
Nefarion's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 57
Uploads: 14
Originally posted by Mud
Still, I'm already up to nearly 50K bare naked, whereas Nefpad is a mere 28K. I'm start to feel self-conscious about it... what are your thoughts on the matter?
My thoughts? I didn't even know Nefpad was 28k. It wouldn't have bothered me if it were 1000k. Static memory numbers don't affect anything, and the numbers you're dealing with aren't even nearly high enough to annoy the OCD bunch that need a uselessly light UI.

Go ahead and add code. Stop worrying about its size. Functionality, ease of coding, and true performance impact are what matter.

Edit: Hack broke. I un-stuck the edit frame, and when I reloaded, it refused to open up. I can't seem to find anything in the code to fix it.

Edit: Yeah, it appears the HackEditFrame is somehow going off-screen when I reload, if it isn't attached to the list frame. I had to manually reposition it with HackEditFrame:ClearAllPoints(), ... .

Originally posted by Mud
Thoughts?
I personally see 0 use for books other than as pseudo-profiles. The feature itself seems pointless, other than to manage local-only books. If I were coding it, I'd make a "global" tab, and a "local" tab in place of the tabs that are there now, each displaying its respective list.
Last edited by Nefarion : 10-17-08 at 07:37 AM.
Report comment to moderator  
Reply With Quote
Unread 10-17-08, 09:10 AM  
Mud
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 8
File comments: 23
Uploads: 4
Edit: Hack broke. I un-stuck the edit frame, and when I reloaded, it refused to open up. I can't seem to find anything in the code to fix it.
Doh. Stupid oversight in Hack.Snap() Will be fixed today. If it happens to anybody else, just do "/run HackDB.snap = true" and reload to get your edit window back.

I personally see 0 use for books other than as pseudo-profiles. The feature itself seems pointless
Yeah, it was one of those things that fell out of the existing implementation with so little effort,that I just went ahead and added it. Of course, it required me to use Blizzard's TAB library, which has prebuilt graphics that didn't match my border, so I had to thicken the bottom border of my windows, etc. every choice has ramifications.

What if you the 'autorun' button was available in the book window, such that you could enable/disable entire books. Would that make it a useful as an organizational feature?

If I were coding it, I'd make a "global" tab, and a "local" tab in place of the tabs that are there now, each displaying its respective list.
That's a great idea. Would simplify the implementation, which always makes me happy.

Unfortunately, it's a breaking change for people who already have multiple books. I can just merge them when loading the new version, but I wonder how many people that would piss off?
Last edited by Mud : 10-17-08 at 09:27 AM.
Report comment to moderator  
Reply With Quote
Unread 10-17-08, 11:18 AM  
Nefarion
A Defias Bandit
 
Nefarion's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 57
Uploads: 14
Originally posted by Mud
I think the best compromise is to lose the auto-focus (which I'm happy to do, since it involves removing code ^_^), but keep the ESC behavior. Your thoughts?
But then once the frame gets manual focus, the problem is back, where clearing focus is a total pain. Personally, I'm in favor of double-escape: first one clears focus, second closes the window. (The how all the other frames in the default UI are anyway.)

And regarding the book think, it would be annoying for people that already have books. But it sure would make things a lot cleaner.
Report comment to moderator  
Reply With Quote
Unread 10-17-08, 01:16 PM  
Mud
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 8
File comments: 23
Uploads: 4
Originally posted by Nefarion
[b]But then once the frame gets manual focus, the problem is back, where clearing focus is a total pain.
*lol* It's not a pain to clear focus -- you just hit ESC. This just also happens to close the edit window, too. I can buy the argument that ESC should only clear focus (the first time) because that's established convention, but I can't buy the inconvenience argument.
Report comment to moderator  
Reply With Quote
Unread 10-17-08, 02:34 PM  
thegabbert
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 93
Uploads: 2
Originally posted by Mud
*lol* It's not a pain to clear focus -- you just hit ESC. This just also happens to close the edit window, too. I can buy the argument that ESC should only clear focus (the first time) because that's established convention, but I can't buy the inconvenience argument.
I think what was probably meant there was that having ESC clear focus and close the window is inconvenient because it requires you to reopen the window if clearing focus was all you were looking to do and you wanted the window to stay open. I know I've had that frustration. Convention being what it is, I'm in the habit of hitting escape to clear focus when I'm done typing, in case I happen to want to do something else (like chat with guildies or w/e) while I look over what I've got so far.

Originally posted by Mud
Originally posted by Nefarion
If I were coding it, I'd make a "global" tab, and a "local" tab in place of the tabs that are there now, each displaying its respective list.
That's a great idea. Would simplify the implementation, which always makes me happy.
I'm all for this idea, as long as "respective list" refers to a list of pages. If there are going to be "global books" and "local books", the interface would get messy. But if there are now going to be, in essence, a single "global book" and a single "local book" and a tab for each, that works for me.
Report comment to moderator  
Reply With Quote
Unread 10-20-08, 05:27 PM  
seebs
Premium Member
Premium Member
AddOn Author - Click to view AddOns

Forum posts: 155
File comments: 157
Uploads: 5
Originally posted by Mud
*lol* It's not a pain to clear focus -- you just hit ESC. This just also happens to close the edit window, too. I can buy the argument that ESC should only clear focus (the first time) because that's established convention, but I can't buy the inconvenience argument.
I very often want to clear focus but not close the window. So not having an easy way to do this is arguably inconvenient.

Mostly, though, I think it's just consistency with everything else.
Report comment to moderator  
Reply With Quote
Unread 10-20-08, 05:56 PM  
seebs
Premium Member
Premium Member
AddOn Author - Click to view AddOns

Forum posts: 155
File comments: 157
Uploads: 5
The /qq page seems to have a bug; if it is set to run when loaded, right-clicking names in chat starts a tell to them instead of popping up the usual menu.

Specifically, it looks like the problem is SetItemRef() -- it is defined as taking an argument called mousebutton, but then calls the original function with the argument button. Since that's a nil, no mouse button is defined, so the original thinks it's a left click, not a right click.
Report comment to moderator  
Reply With Quote
Unread 10-21-08, 11:52 PM  
Mud
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 8
File comments: 23
Uploads: 4
seebs wrote: Mostly, though, I think it's just consistency with everything else.
Yeah, I finally capitulated. Current version has ESC to escape focus.

seebs wrote: The /qq page seems to have a bug [...]
Thanks for the heads up. I'll take a look at the end of the week. My machine overhead and FRIED, so new stuff's on the way. Hopefully my old hard disk is OK....
Report comment to moderator  
Reply With Quote
Unread 10-30-08, 07:15 PM  
EVmaker
A Deviate Faerie Dragon
 
EVmaker's Avatar
AddOn Author - Click to view AddOns

Forum posts: 14
File comments: 126
Uploads: 9
Originally posted by Mud
Yeah, I finally capitulated. Current version has ESC to escape focus.

Thanks for the heads up. I'll take a look at the end of the week. My machine overhead and FRIED, so new stuff's on the way. Hopefully my old hard disk is OK....
The whole overheating thing sucks, I know, my computer has overheating problems, and I really need to get a fan or some such installed in there, thankfully it hasn't fried yet (though if it does, that'd give me an excuse to convince my fiance of the need to get a new one..)

I do think that the escape to clear focus will be useful, theres been a number of times while editing that I wished I could be editing, clear the focus and answer something someone asked on guild without having to close the hack window.

And for me personally, I like the books, like someone else posted, I can have a book for notes, one for code and so on, its just useful to me. I do think that having the book page have an autorun toggle would be a nice solution to the problem of being on one book but having the other books not load their autoruns. Came here looking to see if there was a new version for that exact reason, because I have was testing timers in my book, would reload for my mod, but then my books code would error because timer (which is on autorun on mine) wasn't loaded. Would be nice to be able to set individual books (if you are staying with books) to run their autoruns.
Report comment to moderator  
Reply With Quote
Unread 11-02-08, 05:54 PM  
doomveteran
A Defias Bandit

Forum posts: 3
File comments: 8
Uploads: 0
Originally posted by seebs
The /qq page seems to have a bug; if it is set to run when loaded, right-clicking names in chat starts a tell to them instead of popping up the usual menu.

Specifically, it looks like the problem is SetItemRef() -- it is defined as taking an argument called mousebutton, but then calls the original function with the argument button. Since that's a nil, no mouse button is defined, so the original thinks it's a left click, not a right click.
Confirming behavior. This was a royal PITA to find when i suddently noticed it.
Report comment to moderator  
Reply With Quote
Unread 03-28-09, 07:26 PM  
kellewic
Premium Member
 
kellewic's Avatar
Premium Member
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 131
Uploads: 4
Great addon

Just have to say I love the addon. I took all my one off "addons" and macros and consolidated them all to Hack.

I did have some problems with the timer and event libs that came with it, but I just threw in the following for a quick fix:
  • LibStub
  • CallbackHandler-1.0
  • AceEvent-3.0
  • AceTimer-3.0
  • LibDataBroker-1.1

With a few scripts running on load, I now have embedded AceTimer and AceEvent into Hack (I didn't modify the Hack code directly); example:

Code:
if not Hack.RegisterEvent then
    LibStub("AceEvent-3.0"):Embed(Hack)
end
Then instead of AddEventListener, I do:

Code:
Hack:RegisterEvent("PLAYER_LOGIN", function() ... end)
Of course, this does mean I can't unregister events without doing so for all scripts since the Ace3 stuff is embedded in Hack and not my own objects; not a big deal to me right now

With the LibDataBroker library, I can create data brokers on the fly, which is nice rather than have to package 10 lines of code up as an "addon".

I think the problem I had with the timer code that came with it is I was trying to remove a timer when it was trying to run it. I kept getting a nil index error, which is why I simply added AceTimer-3.0 inside a 'lib' directory in Hack and just embedded it in a new 'lib: timer' script rather than modify Hack directly.

That's one reason I like Hack... quite flexible. Thanks!
Report comment to moderator  
Reply With Quote
Unread 04-04-09, 07:10 PM  
Zanyth0x42
A Kobold Labourer

Forum posts: 0
File comments: 5
Uploads: 0
Just ran into this mod now looking for a new notebook addons and have to say AWESOME job on it, many thanks!!
Report comment to moderator  
Reply With Quote
Unread 04-08-09, 04:20 PM  
Mud
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 8
File comments: 23
Uploads: 4
Re: Great addon

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.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: