Added menu ID watcher command and some info on bug reporting/error logs

develop
Petr Mrázek 2011-08-15 06:48:25 +02:00
parent 247592e30c
commit e14548ba4c
2 changed files with 39 additions and 2 deletions

@ -53,7 +53,7 @@ DFHack basically extends what DF can do with something similar to a quake consol
Basic interaction with dfhack involves entering commands into the console. For some basic instroduction, use the 'help' command. To list all possible commands, use the 'ls' command. Basic interaction with dfhack involves entering commands into the console. For some basic instroduction, use the 'help' command. To list all possible commands, use the 'ls' command.
Many commands have their own help or detailed description. You can use 'command help' or 'command ?' to show that. Many commands have their own help or detailed description. You can use 'command help' or 'command ?' to show that.
The command line has some nce line editing capabilities, including history that's preserved between different runs of DF (use up/down keys to go through the history). The command line has some nice line editing capabilities, including history that's preserved between different runs of DF (use up/down keys to go through the history).
The second way to interact with DFHack is to bind the available commands to in-game hotkeys. This is done in the hotkey/zoom menu (normally opened with the 'h' key). Binding the commands is done by assigning a command as a hotkey name (with 'n'). The second way to interact with DFHack is to bind the available commands to in-game hotkeys. This is done in the hotkey/zoom menu (normally opened with the 'h' key). Binding the commands is done by assigning a command as a hotkey name (with 'n').
Some commands can't be used from hotkeys - this includes interactive commands like 'liquids' and commands that have names longer than 9 characters. Some commands can't be used from hotkeys - this includes interactive commands like 'liquids' and commands that have names longer than 9 characters.

@ -15,11 +15,14 @@ using namespace DFHack;
bool shutdown_flag = false; bool shutdown_flag = false;
bool final_flag = true; bool final_flag = true;
bool timering = false; bool timering = false;
bool trackmenu_flg = false;
uint32_t last_menu = 0;
uint64_t timeLast = 0; uint64_t timeLast = 0;
DFhackCExport command_result kittens (Core * c, vector <string> & parameters); DFhackCExport command_result kittens (Core * c, vector <string> & parameters);
DFhackCExport command_result ktimer (Core * c, vector <string> & parameters); DFhackCExport command_result ktimer (Core * c, vector <string> & parameters);
DFhackCExport command_result bflags (Core * c, vector <string> & parameters); DFhackCExport command_result bflags (Core * c, vector <string> & parameters);
DFhackCExport command_result trackmenu (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void ) DFhackCExport const char * plugin_name ( void )
{ {
@ -30,8 +33,9 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand>
{ {
commands.clear(); commands.clear();
commands.push_back(PluginCommand("nyan","NYAN CAT INVASION!",kittens, true)); commands.push_back(PluginCommand("nyan","NYAN CAT INVASION!",kittens, true));
commands.push_back(PluginCommand("ktimer","Measure time between game updates and console lag.",ktimer)); commands.push_back(PluginCommand("ktimer","Measure time between game updates and console lag (toggle).",ktimer));
commands.push_back(PluginCommand("blockflags","Look up block flags",bflags)); commands.push_back(PluginCommand("blockflags","Look up block flags",bflags));
commands.push_back(PluginCommand("trackmenu","Track menu ID changes (toggle).",trackmenu));
return CR_OK; return CR_OK;
} }
@ -56,7 +60,40 @@ DFhackCExport command_result plugin_onupdate ( Core * c )
timeLast = time2; timeLast = time2;
c->con.print("Time delta = %d ms\n", delta); c->con.print("Time delta = %d ms\n", delta);
} }
if(trackmenu_flg)
{
DFHack::Gui * g =c->getGui();
if (last_menu != *g->df_menu_state)
{
last_menu = *g->df_menu_state;
c->con.print("Menu: %d\n",last_menu);
}
}
return CR_OK;
}
DFhackCExport command_result trackmenu (Core * c, vector <string> & parameters)
{
if(trackmenu_flg)
{
trackmenu_flg = false;
return CR_OK; return CR_OK;
}
else
{
DFHack::Gui * g =c->getGui();
if(g->df_menu_state)
{
trackmenu_flg = true;
last_menu = *g->df_menu_state;
c->con.print("Menu: %d\n",last_menu);
return CR_OK;
}
else
{
c->con.printerr("Can't read menu state\n");
return CR_FAILURE;
}
}
} }
DFhackCExport command_result bflags (Core * c, vector <string> & parameters) DFhackCExport command_result bflags (Core * c, vector <string> & parameters)