Forums » Community Projects
DevKit plugin
The goal of this plugin is to serve as a multipurpose development kit for plugin developers.
Features:
- An enhanced version of slime's TableViewer plugin. I have extended it to allow viewing of IUP structures. It cannot tell you which IUP functions were used to create each element, but it can give you an idea of what's there. Additionally, if a list whose contents consist of multiple controls is currently visible, the viewer will be able to show you what controls are found within it. Also, you can use slime's TableViewer in conjunction with this new version, as they use different namespaces.
WARNING: Some tables have a large number of IUP elements or other data structures which could potentially cause the game to time out and crash to login or freeze. The only way to find out which these are will require experimentation. If you find a table that can be viewed with "Read IUP" off, you can add it to the table test.disable_read_iup within events.lua.
- An Event Management interface. This can be used to toggle the printing of various event messages to the console. Events can have functions specified to interpret returned data.
- Function Interceptor. This tool can be used to hook various functions and print their received input values, return values, and runtime to the console. Not all API functions can be intercepted.
- New functions:
* test.print(). Can be used to include debugging message printed to the console within a project that plans to make use of the console_print() function. Use "/test debug print" to toggle the display of these messages on or off. (Remember to remove them before you distribute your plugin)
* test.stringify(var, nobinary, tab_dump). This is a replacement for tostring(). It returns a string version of the supplied variable, similar to tostring(), but it will also call a local function nspickle() on any table values it receives. nspickle() can spickle a table containing functions or userdata by calling stringify() on those values. Alternately, if you supply a value for nobinary, it will ignore any binary-type elements within the table. tab_dump will return the table in a tabbed layout with one key/value per line.
* test.varprint(separator[, label1, value1[, label2, value2[, ...]]])
Example:
test.varprint(' / ', 'label1', 'value1', 'label2', 'value2') -> label1="value1" / label2="value2"
* test.strsplit(pattern, text[, num]) -> table
Commands:
/test - displays the command list
/reload - Execute /lua ReloadInterface() from the chat bar.*
*There are occasions when you may still need to open the console and execute ReloadInterface manually due to parts of the plugin not being loaded properly, or other changes in the environment.
NOTE: If you had already installed 0.2.6-em1.zip and have defined some custom functions, be sure to backup your events.lua before installing 0.2.7+.
Download link: devkit v0.2.7
Git Repository: https://bitbucket.org/draugath/devkit
Changelog
v0.2.7
+ fixed funcint, should no longer cause stack overflows
+ funcint now supports specifying when a function is hooked
+ Event Manager now supports specifying functions for interpreting returned data
+ functions updated: test.stringify(), test.strsplit()
+ new function: test.varprint()
v0.2.6
+ never really materialized, lots of work towards implementing coroutines in table viewer though. the results of which may yet come about
v0.2.5-2
+ Fixed a bug in Function Interceptor
v0.2.5-1
+ Fixed a bug in Function Interceptor
v0.2.5
+ Added new tool: Function Interceptor
+ Added new functions: test.stringify() and test.nspickle()
+ Added additional controls to the Event Manager GUI
+ Added view history to Table Viewer
+ Tools now usable starting at the login screen.
v0.2.4-1
+ Fixed a problem with the Open button.
v0.2.4
+ Added/changed a few visual elements
v0.2.3
+ Fixed a small issue with a variable provided on the command-line not maintaining it's case.
+ Added support for delving list contents.
v0.2.2
+ Added two buttons to the Event Manager to select/clear all events
+ Added a few more commands for changing/viewing the state of events
+ Added the the ability to specify the initial table to view from the command line in Table Viewer
v0.2.1
+ Fixed read_event() - it now prints all of the data from the event
+ Changed the title of the Save button to Set Defaults, which more closely matches it's purpose
+ Added a new command for displaying which events are currently registered. (/test events status)
v0.2.0
+ Added support for auto disabling "Read IUP" when visiting specified variables. (eg HUD)
+ Added the ability to open directly to an item shown within a table
+ Added breadcrumbs for backtracking from a deep variable within a table
v0.1.1
+ This version marks a shift in naming which will require you to delete the old "plugintest" directory if you had installed an earlier version
+ Added the new test.print() function
+ Reorganized the commands a little (eg /test now displays help)
v0.1.01
+ Fixed a problem with the close button in the table viewer.
v0.1.0
+ Initial release.
Features:
- An enhanced version of slime's TableViewer plugin. I have extended it to allow viewing of IUP structures. It cannot tell you which IUP functions were used to create each element, but it can give you an idea of what's there. Additionally, if a list whose contents consist of multiple controls is currently visible, the viewer will be able to show you what controls are found within it. Also, you can use slime's TableViewer in conjunction with this new version, as they use different namespaces.
WARNING: Some tables have a large number of IUP elements or other data structures which could potentially cause the game to time out and crash to login or freeze. The only way to find out which these are will require experimentation. If you find a table that can be viewed with "Read IUP" off, you can add it to the table test.disable_read_iup within events.lua.
- An Event Management interface. This can be used to toggle the printing of various event messages to the console. Events can have functions specified to interpret returned data.
- Function Interceptor. This tool can be used to hook various functions and print their received input values, return values, and runtime to the console. Not all API functions can be intercepted.
- New functions:
* test.print(). Can be used to include debugging message printed to the console within a project that plans to make use of the console_print() function. Use "/test debug print" to toggle the display of these messages on or off. (Remember to remove them before you distribute your plugin)
* test.stringify(var, nobinary, tab_dump). This is a replacement for tostring(). It returns a string version of the supplied variable, similar to tostring(), but it will also call a local function nspickle() on any table values it receives. nspickle() can spickle a table containing functions or userdata by calling stringify() on those values. Alternately, if you supply a value for nobinary, it will ignore any binary-type elements within the table. tab_dump will return the table in a tabbed layout with one key/value per line.
* test.varprint(separator[, label1, value1[, label2, value2[, ...]]])
Example:
test.varprint(' / ', 'label1', 'value1', 'label2', 'value2') -> label1="value1" / label2="value2"
* test.strsplit(pattern, text[, num]) -> table
Commands:
/test - displays the command list
/reload - Execute /lua ReloadInterface() from the chat bar.*
*There are occasions when you may still need to open the console and execute ReloadInterface manually due to parts of the plugin not being loaded properly, or other changes in the environment.
NOTE: If you had already installed 0.2.6-em1.zip and have defined some custom functions, be sure to backup your events.lua before installing 0.2.7+.
Download link: devkit v0.2.7
Git Repository: https://bitbucket.org/draugath/devkit
Changelog
v0.2.7
+ fixed funcint, should no longer cause stack overflows
+ funcint now supports specifying when a function is hooked
+ Event Manager now supports specifying functions for interpreting returned data
+ functions updated: test.stringify(), test.strsplit()
+ new function: test.varprint()
v0.2.6
+ never really materialized, lots of work towards implementing coroutines in table viewer though. the results of which may yet come about
v0.2.5-2
+ Fixed a bug in Function Interceptor
v0.2.5-1
+ Fixed a bug in Function Interceptor
v0.2.5
+ Added new tool: Function Interceptor
+ Added new functions: test.stringify() and test.nspickle()
+ Added additional controls to the Event Manager GUI
+ Added view history to Table Viewer
+ Tools now usable starting at the login screen.
v0.2.4-1
+ Fixed a problem with the Open button.
v0.2.4
+ Added/changed a few visual elements
v0.2.3
+ Fixed a small issue with a variable provided on the command-line not maintaining it's case.
+ Added support for delving list contents.
v0.2.2
+ Added two buttons to the Event Manager to select/clear all events
+ Added a few more commands for changing/viewing the state of events
+ Added the the ability to specify the initial table to view from the command line in Table Viewer
v0.2.1
+ Fixed read_event() - it now prints all of the data from the event
+ Changed the title of the Save button to Set Defaults, which more closely matches it's purpose
+ Added a new command for displaying which events are currently registered. (/test events status)
v0.2.0
+ Added support for auto disabling "Read IUP" when visiting specified variables. (eg HUD)
+ Added the ability to open directly to an item shown within a table
+ Added breadcrumbs for backtracking from a deep variable within a table
v0.1.1
+ This version marks a shift in naming which will require you to delete the old "plugintest" directory if you had installed an earlier version
+ Added the new test.print() function
+ Reorganized the commands a little (eg /test now displays help)
v0.1.01
+ Fixed a problem with the close button in the table viewer.
v0.1.0
+ Initial release.
I only had a chance to look at this briefly but I did notice a few things:
1) Events can have multiple data items returned, and you are displaying info on the first item only. GROUP_MEMBER_DIED is an example of an event with multiple values returned.
You should do something more like:
function test.event_mgmt.readevent(event, ...)
local data = {...}
for k,v in ipairs(data) do
...etc
2) Having a save and close button on the event manager confused me at first and I had to dig through your code to see what you were really doing. Renaming the save button to something like 'set defaults' would make it more intuitive to me.
3) Adding a 'Clear All' button to the event manager would be handy
4) You may already be planning this, but I'd like to have more control from the console (especially in regard to the event manager). To me, typing the name of an event to toggle its state is easier than finding it in a long list. Also printing out a list of registered events could be handy too.
1) Events can have multiple data items returned, and you are displaying info on the first item only. GROUP_MEMBER_DIED is an example of an event with multiple values returned.
You should do something more like:
function test.event_mgmt.readevent(event, ...)
local data = {...}
for k,v in ipairs(data) do
...etc
2) Having a save and close button on the event manager confused me at first and I had to dig through your code to see what you were really doing. Renaming the save button to something like 'set defaults' would make it more intuitive to me.
3) Adding a 'Clear All' button to the event manager would be handy
4) You may already be planning this, but I'd like to have more control from the console (especially in regard to the event manager). To me, typing the name of an event to toggle its state is easier than finding it in a long list. Also printing out a list of registered events could be handy too.
Thank you for the feedback and suggestions. I am currently working on implementing them.
Items 3 and 4 are providing me with a little bit of an issue, as my preferred method of using IUP Names currently causes a segfault.
In the interim, I have put up version 0.2.1 which has items 1, 2 and printing a list of registered events implemented.
Items 3 and 4 are providing me with a little bit of an issue, as my preferred method of using IUP Names currently causes a segfault.
In the interim, I have put up version 0.2.1 which has items 1, 2 and printing a list of registered events implemented.
Version 0.2.2 is up now. It includes the rest of the suggestions from meridian that weren't covered in 0.2.1, along with a couple more.
Version 0.2.3 is now up.
I'm putting together the concept and feature set for the next tool in the kit, GUI Builder.
The original idea was going to call for the ability to dynamically place controls and then drag and drop them into position. I'm not sure yet about the drag and drop capabilities of VO IUP, but it became clear early on that drag-and-drop positioning of *boxes wasn't going to be feasible.
My current idea is to utilize an iup.tree to visualize the interface structure and utilizing buttons for "Insert Into", "Insert Below", "Append To", and movement, with possible drag-and-drop positioning if supported. Further, there will be some sort of interface for viewing/modifying control properties. Finally there will be some method of previewing the designed interface and outputting it in string format for inclusion in a plugin.
All of this will of course hinge upon necessary features being supported by the engine.
The original idea was going to call for the ability to dynamically place controls and then drag and drop them into position. I'm not sure yet about the drag and drop capabilities of VO IUP, but it became clear early on that drag-and-drop positioning of *boxes wasn't going to be feasible.
My current idea is to utilize an iup.tree to visualize the interface structure and utilizing buttons for "Insert Into", "Insert Below", "Append To", and movement, with possible drag-and-drop positioning if supported. Further, there will be some sort of interface for viewing/modifying control properties. Finally there will be some method of previewing the designed interface and outputting it in string format for inclusion in a plugin.
All of this will of course hinge upon necessary features being supported by the engine.
I just tried using the table viewer to view some IUP structures and it is pretty sweet (better than what I had written for my own use anyway: outputting a slew of data to the console, extracting from errors.log and reformatting).
Anyway a couple more suggestions:
5) On the table GUI disable fullscreen and enable the menubox options so that the dialog can be dragged around on the screen. It's nice to be able to see the IUP structure for comparison while having the table tree view open too. Note to center the dialog on the screen you'll want to open it with:
ShowDialog(test.table_viewer.ui.dialog, iup.CENTER, iup.CENTER)
6) It would be nice to have the numeric indicies for the table item selected in the tree shown in the dialog (e.g. [1][1][2][1][3]). I can count it out manually if I collapse the parts of the table I'm not interested in, but when I have everything expanded it can get to be tricky sometimes.
Anyway a couple more suggestions:
5) On the table GUI disable fullscreen and enable the menubox options so that the dialog can be dragged around on the screen. It's nice to be able to see the IUP structure for comparison while having the table tree view open too. Note to center the dialog on the screen you'll want to open it with:
ShowDialog(test.table_viewer.ui.dialog, iup.CENTER, iup.CENTER)
6) It would be nice to have the numeric indicies for the table item selected in the tree shown in the dialog (e.g. [1][1][2][1][3]). I can count it out manually if I collapse the parts of the table I'm not interested in, but when I have everything expanded it can get to be tricky sometimes.
Version 0.2.4 is now up.
Done and done. I'd actually been thinking about disabling fullscreen for a little while, but never got around to it. Since no one else had mentioned anything, I figured it works well enough for me this way. One caveat with the current display of the selected element in the tree, it will only something if it has an variable associated with it. By this I mean that clicking on an IUP control will currently display nothing.
Done and done. I'd actually been thinking about disabling fullscreen for a little while, but never got around to it. Since no one else had mentioned anything, I figured it works well enough for me this way. One caveat with the current display of the selected element in the tree, it will only something if it has an variable associated with it. By this I mean that clicking on an IUP control will currently display nothing.
Version 0.2.4-1 is now up.
This is a very minor bugfix. There was a problem with the Open button in Table Viewer not working. This is all I fixed. I noticed some other visual errors and enhancements that I will take care of eventually. At the moment I need to reorganize, and so won't be working towards any improvements at this time. If there are any bugs that make the interface unusable, let me know and I'll fix those.
This is a very minor bugfix. There was a problem with the Open button in Table Viewer not working. This is all I fixed. I noticed some other visual errors and enhancements that I will take care of eventually. At the moment I need to reorganize, and so won't be working towards any improvements at this time. If there are any bugs that make the interface unusable, let me know and I'll fix those.
Version 0.2.5 is now up.
This release includes a new tool, a couple new functions, and expanded range of functionality.
The new tool is the Function Interceptor. This tool will hook a function and print out it's received input values, it's return values, and it's runtime (in ms). Most API functions can't be hooked, but it can still be used to debug API functions that can or your own functions. Currently this tool is only accessible from the CLI.
I have written one new function, test.stringify().
stringify() is similar to tostring() in that it converts it's argument to a string form. Further, it automatically calls a local function nspickle() to expand tables.
nspickle() works like spickle() to create a string form of a table. Further, it can spickle a table containing functions and userdata by calling stringify() on these elements.
Event Manager has received a few more controls in the GUI, making it easier to use.
Table Viewer makes use of the new dropdown listbox I crafted in order provide a history of viewed variables. The default history size is 10, but this can be changed.
All tools should be accessible starting at the login screen now.
My process was rather erratic while putting this update together, so there is a chance that I forgot about something or something didn't get fully tested. Please inform me of any bugs you come across.
A big thanks to meridian for his help in testing this before release.
This release includes a new tool, a couple new functions, and expanded range of functionality.
The new tool is the Function Interceptor. This tool will hook a function and print out it's received input values, it's return values, and it's runtime (in ms). Most API functions can't be hooked, but it can still be used to debug API functions that can or your own functions. Currently this tool is only accessible from the CLI.
I have written one new function, test.stringify().
stringify() is similar to tostring() in that it converts it's argument to a string form. Further, it automatically calls a local function nspickle() to expand tables.
nspickle() works like spickle() to create a string form of a table. Further, it can spickle a table containing functions and userdata by calling stringify() on these elements.
Event Manager has received a few more controls in the GUI, making it easier to use.
Table Viewer makes use of the new dropdown listbox I crafted in order provide a history of viewed variables. The default history size is 10, but this can be changed.
All tools should be accessible starting at the login screen now.
My process was rather erratic while putting this update together, so there is a chance that I forgot about something or something didn't get fully tested. Please inform me of any bugs you come across.
A big thanks to meridian for his help in testing this before release.
Version 0.2.5-1 is up.
This was a bugfix to the Function Interceptor
EDIT:
Version 0.2.5-2 is up.
See above for reason.
This was a bugfix to the Function Interceptor
EDIT:
Version 0.2.5-2 is up.
See above for reason.
It would be nice to have a checkbox in the table viewer to enable using colored strings to display color values. Otherwise I end up doing a bunch of shuffling between dialogs boxes to figure out what color a given value represents.
It seems that there are at least 4 ways to represent a color:
1) string format codes: /127ffffff
2) IUP RGB string: "255 255 255" (see ShipPalette_string)
3) gvector (see ShipPalette)
4) number value 1-256 (see FactionColor)
For the last one, it seems the devs aren't consistent and sometimes use values 0-255, as in the case for ShipPresets.shipcolor.
While you're at it, displaying more information for gvectors would be good too (in the right-side multiline for the selected gvector perhaps?). I'd say x, y and z values at a minimum.
It seems that there are at least 4 ways to represent a color:
1) string format codes: /127ffffff
2) IUP RGB string: "255 255 255" (see ShipPalette_string)
3) gvector (see ShipPalette)
4) number value 1-256 (see FactionColor)
For the last one, it seems the devs aren't consistent and sometimes use values 0-255, as in the case for ShipPresets.shipcolor.
While you're at it, displaying more information for gvectors would be good too (in the right-side multiline for the selected gvector perhaps?). I'd say x, y and z values at a minimum.
Since development has stalled while I am distracted by other things, I figured I'd post the latest development version. devkit v0.2.6-a2
It has an almost completely rewritten TableViewer, which so far seems to be faster, and is capable of reading some table structures with ReadIUP on that the previous TableViewer would stall on. It also includes some basic capability to edit variables from the viewer.
More events have been added to the Event Manager.
Function Interceptor has been tweaked a little, but I recently ran into a case that can cause a stack-overflow. This is related to targetless forcing a ReloadInterface() on logoff. Basically, I'm not currently checking if a function is hooked before hooking it again. So if you logoff and logon again from an install w/o targetless, it will re-hook anything you have set to be intercepted.
I've also changed the directory that the plugin is stored in, since plugins are loaded in ASCIIbetical order and it's important for devkit to be loaded first.
Those of you who downloaded this file in the past may want to download it again. The only change is the inclusion of a few more events I'd been made aware of since then.
It has an almost completely rewritten TableViewer, which so far seems to be faster, and is capable of reading some table structures with ReadIUP on that the previous TableViewer would stall on. It also includes some basic capability to edit variables from the viewer.
More events have been added to the Event Manager.
Function Interceptor has been tweaked a little, but I recently ran into a case that can cause a stack-overflow. This is related to targetless forcing a ReloadInterface() on logoff. Basically, I'm not currently checking if a function is hooked before hooking it again. So if you logoff and logon again from an install w/o targetless, it will re-hook anything you have set to be intercepted.
I've also changed the directory that the plugin is stored in, since plugins are loaded in ASCIIbetical order and it's important for devkit to be loaded first.
Those of you who downloaded this file in the past may want to download it again. The only change is the inclusion of a few more events I'd been made aware of since then.
Here's a minor update for Event Manager. It allows you to specify a function for each return value from an event that can process the data for increased detail in your debug data. The functions are specified in the events.lua file.
This upgrade requires 0.2.6-a2
devkit_0.2.6-a2_em1.zip
This upgrade requires 0.2.6-a2
devkit_0.2.6-a2_em1.zip
DevKit 0.2.7 uploaded. i never really got the BIG changes to table viewer finished, but I think i fixed a few other things and made some other changes I felt like getting out there for you guys.
EDIT: Forgot to update the version number. I so updated the file. No other change was made. -- 2012-04-05
EDIT: Forgot to update the version number. I so updated the file. No other change was made. -- 2012-04-05
I created a git repository on bitbucket for this project. It has been initialized at the 0.2.7 version. No changes have been made as of yet.
https://bitbucket.org/draugath/devkit
https://bitbucket.org/draugath/devkit