Download
(239 Kb)
Download
Updated: 08-28-12 09:45 AM
Pictures
File Info
Compatibility:
Mists of Pandaria (5.0.4)
Updated:08-28-12 09:45 AM
Created:02-07-11 06:32 PM
Downloads:2,310
Favorites:52
MD5:
DevPad
Version: 5.0.0.1
by: Saiket [More]
_DevPad is an in-game text editor and addon authoring tool, inspired by Mud's Hack.

Keep notes with it, write Lua scripts, or prototype addon concepts in its trimmed down development environment. Organize your scripts into folders and share them with other _DevPad users. Scripts can run automatically on login like mini addons, and can call each other like libraries or dependencies.

Details

When you first install _DevPad, it includes an “Instruction Manual” script with a quick reference to using the mod. Here's an even quicker reference to the simple UI:

List Window
  • Reorganize scripts and folders by dragging and dropping. Rename any folder or script by double clicking.
  • Set scripts to auto-run by clicking the arrow buttons next to their names in the list. They will then run right after _DevPad's ADDON_LOADED event in the listed order.
  • Search script contents using Lua patterns in the search bar below the list.

Editor Window
  • Adjust font and font size, toggle Lua mode per-script, and access other editing tools with buttons at the editor's top-right.
  • Scripts in Lua mode appear syntax-highlighted (courtesy of krka's ForAllIndentsAndPurposes) and reveal UI Escape Sequences for editing directly.
  • Without Lua mode, chat links in scripts become clickable, and text coloring tools appear at the editor's top-right.
  • Use line numbers to navigate code. Click a line number to select that line.
  • There is no save button; Script text is saved as you type.
  • Undo and redo changes with standard keyboard shortcuts, or with the left and right arrow buttons at the top-right of the editor.
  • Use familiar keyboard shortcuts to manipulate text:
    • <Ctrl+Z>/<Ctrl+Shift+Z>: Undo and redo.
    • <Ctrl+G>: Go to line number dialog.
    • <Ctrl+F>: Focus the list's search edit box.
    • <F3>/<Shift+F3>: Jump to next/previous search result.


Usage

There are two ways to open the list window: by keybind, or with the “/devpad” or “/pad” slash commands.

There are also two ways to run scripts as Lua code. With a script open, click the play button at the top-left of the editor window. Alternatively, you can run them by name if you include a Lua pattern with the slash command, like so: “/devpad Example Script”. You can use the slash command in a macro to bind keys to _DevPad scripts.

Sending and Receiving

You can send scripts, even entire folders, to others with the trumpet icon at the top of the list window. When you receive something, you'll hear a sound and see a chat message prompting you to open your _DevPad. Once opened, you can choose to keep or discard the new item. Remember to always inspect what you receive from others before you run it though!


Notes
  • For help writing scripts, see the default “Instruction Manual” and “Example Script” pages.
  • Some components of _DevPad can safely be deleted to trim the editor even further:
    • <_DevPad/_DevPad.DefaultScripts.lua>: Default scripts and folders.
    • <_DevPad.GUI/_DevPad.GUI.Editor.Color.lua>: Color editing tools for non-Lua scripts.
    • <_DevPad.GUI/_DevPad.GUI.Editor.History.lua>: Undo and redo history.
    • <_DevPad.GUI/_DevPad.GUI.Editor.LineNumbers.lua>: Line numbering.
    • <_DevPad.GUI/_DevPad.GUI.List.Search.lua>: Script text searching tools.
    • <_DevPad.GUI/Libs/ForAllIndentsAndPurposes>: Syntax highlighting.
  • By default, _DevPad comes with an “Importers” folder containing scripts to import pages from other notepad mods. WowLua, Hack, and TinyPad are currently supported. See the comments at the tops of these scripts for specific usage instructions.
  • 5.0.0.1 / GUI: Moved editor line numbering into an optional module.
  • 4.3.0.1 / GUI:
    • Added text coloring controls to the editor while not in Lua mode.
    • Added an IterateChildren method to folder objects, usable as `for Child in Folder:IterateChildren() do ... end`.
    • Folders that temporarily open while dragging a list entry now close afterwards if nothing was dropped into them.
    • Separated list's search functionality into its own optional module.
  • 4.2.0.3 / GUI:
    • Added multiple undo and redo to the editor, controllable with <Ctrl+Z> and <Ctrl+Shift+Z> or left and right arrow buttons at the top-right of the window.
    • The editor now remembers cursor positions, so you can close or swap scripts without losing your place.
  • 4.2.0.2 / GUI:
    • Added a new default library script named “Libs/RegisterForSave” to allow other scripts to save variables between sessions. See <_DevPad/_DevPad.DefaultScripts.lua> if you want to copy it into your existing pad.
    • While dragging an object in the list window, folders will only expand if you hold your mouse over them briefly.
    • Folders can now be opened and closed by simply clicking their names. Also, they now temporarily close while being dragged.
  • 4.2.0.1 / GUI:
    • Slash command now only prints the run script's name if more than one match was found.
    • Added a faint line highlight to the editor.
    • Scripts and folders can now be broadcast over the guild officer channel.
  • 4.1.0.1 / GUI: Fixed buggy scrollbar behavior in 4.1.
  • 4.0.6.1 / GUI: The Lua syntax highlighting option now also controls “raw text” mode, allowing you to see and edit UI Escape Sequences. When disabled, chat links become clickable inside the editor.
  • 4.0.3.1 / GUI: Initial release.
Optional Files (0)


Archived Files (7)
File Name
Version
Size
Author
Date
4.3.0.1
238kB
Saiket
11-29-11 06:01 PM
4.2.0.3
232kB
Saiket
08-07-11 05:53 PM
4.2.0.2
229kB
Saiket
07-21-11 11:00 PM
4.2.0.1
228kB
Saiket
06-28-11 02:27 PM
4.1.0.1
228kB
Saiket
04-26-11 10:47 AM
4.0.6.1
227kB
Saiket
02-12-11 04:50 PM
4.0.3.1
227kB
Saiket
02-07-11 06:32 PM


Post A Reply Comment Options
Unread 06-09-12, 01:16 AM  
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view AddOns

Forum posts: 152
File comments: 329
Uploads: 21
Re: questions

Originally Posted by spiralofhope
Can a script learn its own name?
lua Code:
  1. local NS = ...; -- Reference to the script's object
  2. print( "Name:", NS._Name );

Originally Posted by spiralofhope
Is there functionality for a script to read/write DevPad textfiles/notes?
lua Code:
  1. local Script = _DevPad:GetClass( "Script" ):New(); -- Creates an unused/unlisted script table
  2. Script:SetName( "Note" );
  3. Script:SetLua( false ); -- Disable syntax highlighting
  4. Script:SetText( "..." );
  5. _DevPad.FolderRoot:Insert( Script ); -- Add the script to _DevPad's list

Originally Posted by spiralofhope
Is there simple functionality to let me access savevariable-type stuff? (not for other addons - I know that's not possible) For example, if devpad maintained a save variable table for itself, then I could read/write arbitrary data which could survive a reload ui / restart.
I added a library called "RegisterForSave" to one of the more recent releases, but if you used _DevPad before then, you have to copy it in manually. Search <_DevPad/_DevPad.DefaultScripts.lua> for "RegisterForSave" and copy that script's contents into a new page in your list somewhere (it doesn't need to be under "Libs"). The library stores saved variables in a folder of script pages, to avoid tampering with _DevPad's raw saved variables. It behaves similarly to the old RegisterForSave API, with additional support for default values.
Saiket is offline Report comment to moderator  
Reply With Quote
Unread 06-08-12, 05:46 PM  
spiralofhope
A Deviate Faerie Dragon
 
spiralofhope's Avatar

Forum posts: 11
File comments: 207
Uploads: 0
questions

Can a script learn its own name?

Is there functionality for a script to read/write DevPad textfiles/notes?

Is there simple functionality to let me access savevariable-type stuff? (not for other addons - I know that's not possible) For example, if devpad maintained a save variable table for itself, then I could read/write arbitrary data which could survive a reload ui / restart.

Right now I'm thinking of just using a macro as a scratch pad, but that's a bit limited. =)

.
__________________
spiralofhope.com
Last edited by spiralofhope : 06-08-12 at 05:52 PM.
spiralofhope is offline Report comment to moderator  
Reply With Quote
Unread 04-30-12, 03:11 PM  
spiralofhope
A Deviate Faerie Dragon
 
spiralofhope's Avatar

Forum posts: 11
File comments: 207
Uploads: 0
Oh sweet! Thanks.

I'm working on an explanation helper for heroics/raids in MoP. I figure I can shove the data into scripts nested into folders, to make everything really tidy. This stuff's the key.
__________________
spiralofhope.com
spiralofhope is offline Report comment to moderator  
Reply With Quote
Unread 04-30-12, 01:18 PM  
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view AddOns

Forum posts: 152
File comments: 329
Uploads: 21
Re: Getting folder names

Originally Posted by spiralofhope
I'm revisiting my scripts. I'm fairly lost, but hopefully the skillset will return.

I'm struggling with some script ideas. I don't know if it's my rustyness or if the functionality just doesn't exist.

I'm looking for a directory finding function.

Also, something like _DevPad:IterateScripts but which iterates through folders (preferably with a variable so I can limit how deep it iterates).
_DevPad doesn't have either by default, but they're not too complex to implement. Here's a directory finding function:
lua Code:
  1. --- @return Child folder matching `Name` within `Parent`, or nil if none is found.
  2. local function FindFolder ( Parent, Name )
  3.   for Child in Parent:IterateChildren() do
  4.     if ( Child._Class == "Folder" and Child._Name == Name ) then
  5.       return Child;
  6.     end
  7.   end
  8. end
  9. FindFolder( _DevPad.FolderRoot, "Needle" ); -- Returns folder named "Needle"

A directory iterator like IterateScripts with a max depth parameter is a little more involved, but still doable:
lua Code:
  1. --- Fires `Callback` for each child folder in `Parent`.
  2. -- @param Depth  Folder depth to limit iteration to.
  3. -- @param Callback  Function or method name.
  4. -- @param ...  Extra args passed after folder to Callback.
  5. local function IterateFolders ( Parent, Depth, Callback, ... )
  6.   if ( Depth < 1 ) then
  7.     return; -- Too deep
  8.   end
  9.   for _, Child in ipairs( Parent ) do
  10.     if ( Child._Class == "Folder" ) then
  11.       ( Child[ Callback ] or Callback )( Child, ... );
  12.       IterateFolders( Child, Depth - 1, Callback, ... );
  13.     end
  14.   end
  15. end
Saiket is offline Report comment to moderator  
Reply With Quote
Unread 04-30-12, 12:20 PM  
spiralofhope
A Deviate Faerie Dragon
 
spiralofhope's Avatar

Forum posts: 11
File comments: 207
Uploads: 0
Getting folder names

I'm revisiting my scripts. I'm fairly lost, but hopefully the skillset will return.

I'm struggling with some script ideas. I don't know if it's my rustyness or if the functionality just doesn't exist.

I'm looking for a directory finding function.

Also, something like _DevPad:IterateScripts but which iterates through folders (preferably with a variable so I can limit how deep it iterates).
__________________
spiralofhope.com
spiralofhope is offline Report comment to moderator  
Reply With Quote
Unread 10-28-11, 04:13 PM  
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view AddOns

Forum posts: 152
File comments: 329
Uploads: 21
Originally posted by spiralofhope
I want to have my DevPad scripts accessible as individual .lua files, stored separately. This is so I can edit them with an external editor and check them into a revision control system.

Right now there's no real easy way to share or collaborate on devpad scripts.


The game doesn't allow an addon to create arbitrary text files, correct?
That's right, the only file _DevPad can write to is its saved variables file.
Originally posted by spiralofhope
Would the best way to do something like this be to create a script which can pull apart the existing large devpad lua script, get all the scripts out and create those text files for me? (and also do the reverse)
That seems like the best way to go about it. The only issues I can think of are how you might store file/folder order on disk, and escaping file/folder names since _DevPad allows any string data.
Saiket is offline Report comment to moderator  
Reply With Quote
Unread 10-27-11, 10:54 PM  
spiralofhope
A Deviate Faerie Dragon
 
spiralofhope's Avatar

Forum posts: 11
File comments: 207
Uploads: 0
I want to have my DevPad scripts accessible as individual .lua files, stored separately. This is so I can edit them with an external editor and check them into a revision control system.

Right now there's no real easy way to share or collaborate on devpad scripts.


The game doesn't allow an addon to create arbitrary text files, correct?

Would the best way to do something like this be to create a script which can pull apart the existing large devpad lua script, get all the scripts out and create those text files for me? (and also do the reverse)
__________________
spiralofhope.com
spiralofhope is offline Report comment to moderator  
Reply With Quote
Unread 08-08-11, 03:05 PM  
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view AddOns

Forum posts: 200
File comments: 87
Uploads: 21
This addon continues to improve with every update, honestly, I've never found anything to compare. When this first came out it was in par with WoWLua, but it has no surpassed it and I feel it will continue to improve. I love the addons you make Saiket, and hope you continue to make them.

If I could "double favorite" this addon, I would.


<3
Waky is offline Report comment to moderator  
Reply With Quote
Unread 07-30-11, 05:18 PM  
spiralofhope
A Deviate Faerie Dragon
 
spiralofhope's Avatar

Forum posts: 11
File comments: 207
Uploads: 0
I've made the update to use VARIABLES_LOADED and that works just fine too.

Thanks for the explanation about the loading. I had read a little bit about that and it's nice you've thought about having that flexibility cooked in.

So far I haven't had to change any other scripting to work with this in mind, but if I do I think I'll just cook up one script and have it intelligently run any other CVar-modifying snippets.

Now it's back to the profile stuff..
__________________
spiralofhope.com
spiralofhope is offline Report comment to moderator  
Reply With Quote
Unread 07-29-11, 10:40 PM  
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view AddOns

Forum posts: 152
File comments: 329
Uploads: 21
Originally posted by spiralofhope
I'm not keen on having a unique frame created just for this that lingers around during gameplay, and waiting for that event, but it shouldn't be a problem.
The VARIABLES_LOADED event only fires once, so it might be preferable to PLAYER_ENTERING_WORLD.
Originally posted by spiralofhope
Was it a conscious decision to fire off devpad scripts immediately on addon load? Is there an advantage or flexibility in doing that rather than waiting for a more complete WoW startup/login?
Yes, I did it that way so scripts have the flexibility to initialize themselves as soon as normal addons would. Also, VARIABLES_LOADED fires at somewhat unpredictable places in the loading sequence, depending on whether settings have been downloaded from the server yet (i.e. login behaves differently from reloading the UI). That could make handling the other login events tricky, and scripts might miss them entirely.
Saiket is offline Report comment to moderator  
Reply With Quote
Unread 07-29-11, 10:23 PM  
spiralofhope
A Deviate Faerie Dragon
 
spiralofhope's Avatar

Forum posts: 11
File comments: 207
Uploads: 0
Originally posted by Saiket
_DevPad executes auto-run scripts as soon as it loads, but Hack waits until VARIABLES_LOADED before running its pages. I think the minimap zoom is saved in a CVar, so it makes sense that any changes before VARIABLES_LOADED would get overridden. Try waiting until that event before zooming out.
Thanks for the pointer. What I ended up creating was this:

Code:
-- To handle startup properly.
local frame = CreateFrame("FRAME", "SprialofhopeZoomFrame")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
local function eventHandler(self, event, ...)
  Minimap:SetZoom(0)
end
frame:SetScript("OnEvent", eventHandler)

-- In case this script is run directly, while playing.
Minimap:SetZoom(0)
I'm not keen on having a unique frame created just for this that lingers around during gameplay, and waiting for that event, but it shouldn't be a problem.

Was it a conscious decision to fire off devpad scripts immediately on addon load? Is there an advantage or flexibility in doing that rather than waiting for a more complete WoW startup/login?
__________________
spiralofhope.com
spiralofhope is offline Report comment to moderator  
Reply With Quote
Unread 07-28-11, 07:36 PM  
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view AddOns

Forum posts: 152
File comments: 329
Uploads: 21
Originally posted by spiralofhope
I have a simple script that's set to run on startup:

Code:
Minimap:SetZoom(0)
It used to work under Hack, but it's not working under DevPad. What's going on?
_DevPad executes auto-run scripts as soon as it loads, but Hack waits until VARIABLES_LOADED before running its pages. I think the minimap zoom is saved in a CVar, so it makes sense that any changes before VARIABLES_LOADED would get overridden. Try waiting until that event before zooming out.
Saiket is offline Report comment to moderator  
Reply With Quote
Unread 07-28-11, 12:35 PM  
spiralofhope
A Deviate Faerie Dragon
 
spiralofhope's Avatar

Forum posts: 11
File comments: 207
Uploads: 0
I have a simple script that's set to run on startup:

Code:
Minimap:SetZoom(0)
It used to work under Hack, but it's not working under DevPad. What's going on?
__________________
spiralofhope.com
spiralofhope is offline Report comment to moderator  
Reply With Quote
Unread 07-26-11, 06:55 PM  
spiralofhope
A Deviate Faerie Dragon
 
spiralofhope's Avatar

Forum posts: 11
File comments: 207
Uploads: 0
Profile Manager

Well I have a basic profile manager sketched out.

My coding style sucks, and I'm pretty limited in my knowledge.

http://pastebin.com/2hk6bUAu

- label scripts like (spaces are handled properly)
1,2,3 this runs in profiles one, two and three
- use sub-folders if you wish, there's a toggle to use them or not.
- blacklist to not run certain scripts
- customizable delimiter in case you prefer "1/2/3 script name" etc.

To do:

It needs to be linked to a slash command or the like. I've done those in the past and I think I can get that done for this on my next pass.

Maybe a folder blacklist?
__________________
spiralofhope.com
Last edited by spiralofhope : 07-26-11 at 07:36 PM.
spiralofhope is offline Report comment to moderator  
Reply With Quote
Unread 07-26-11, 04:35 PM  
spiralofhope
A Deviate Faerie Dragon
 
spiralofhope's Avatar

Forum posts: 11
File comments: 207
Uploads: 0
Re: Re: Pack not working as expected

Originally posted by Saiket
<snip>but if you just need to look at a few fields in a script, you can read them like this instead:
Code:
print( o._Class,o._Name,o._Text,o._AutoRun,o._Lua )
Oh right, Lua is using objects. Now it makes sense..

Thanks!
__________________
spiralofhope.com
spiralofhope is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.