ANNOYED_GRUNT'S PROFILE

Search

[RM2K3] [DynRPG] Simulate Keypress

Hello!
I'm trying to make something akin to a point-and-click in 2003. I'm using Cherry's keyboard and mouse plugin, but I'd want to let my mouse be able to skip dialog when needed (so that the game is 100% mouse operated). In order to do this, I started using the SDK myself (I have absolutely zero knowledge of C++ in particular but oh well).

After a couple hours I came up with this:

#define AUTO_DLLMAIN
#include <DynRPG/DynRPG.h>

bool onComment(const char *text, const RPG::ParsedCommentData *parsedData,
RPG::EventScriptLine *nextScriptLine, RPG::EventScriptData *scriptData,
int eventId, int pageId, int lineId, int *nextLineId)
{
if(strcmp(parsedData->command, "simulatez") == 0)
{
keybd_event(VK_ESCAPE,0,0,0);
keybd_event(VK_ESCAPE,0,KEYEVENTF_KEYUP,0);
return false;
}
return true;
}


In this case I'm simulating vk_escape since it gives me a direct feedback of what I'm doing is working or not (menu opens if I'm doing it right, theoretically).

My problem: if I remove the second keybd_event the menu opens, but x\escape remain "stuck" until I press escape.
If I keep the second keybd (thus simulating a key tap) the menu doesn't open at all.

As for the game, it's just a test map with an event with a single comment @SimulateZ.
Pages: 1