Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions nvse/nvse/CommandTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2267,6 +2267,10 @@ void CommandTable::AddCommandsV6()
ADD_CMD_RET(GetDisabledKeys, kRetnType_Array);

ADD_CMD(ReloadPluginConfig);

// 6.4 beta 06
ADD_CMD_RET(GetPressedKeys, kRetnType_Array);

}

namespace PluginAPI
Expand Down
26 changes: 25 additions & 1 deletion nvse/nvse/Commands_Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ bool Cmd_GetDisabledKeys_Execute(COMMAND_ARGS)
*result = arr->ID();
double arrIndex = 0;

for(UInt32 d = 0; d < 256; d++)
for(UInt32 d = 0; d < kMaxMacros - 2; d++)
{
if(IsKeycodeValid(d) && DIHookControl::GetSingleton().IsKeyDisabled(d))
{
Expand All @@ -519,6 +519,30 @@ bool Cmd_GetDisabledKeys_Execute(COMMAND_ARGS)
}


bool Cmd_GetPressedKeys_Execute(COMMAND_ARGS)
{

UInt32 flags=0;

if(!ExtractArgs(EXTRACT_ARGS, &flags))
return true;

ArrayVar *arr = g_ArrayMap.Create(kDataType_Numeric, true, scriptObj->GetModIndex());
*result = arr->ID();
double arrIndex = 0;

for(UInt32 d = 0; d < kMaxMacros - 2; d++)
{
if(IsKeycodeValid(d) && DIHookControl::GetSingleton().IsKeyPressed(d, flags))
{
arr->SetElementNumber(arrIndex, d);
arrIndex += 1;
}
}

return true;
}

#if RUNTIME

void Commands_Input_Init(void)
Expand Down
2 changes: 2 additions & 0 deletions nvse/nvse/Commands_Input.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ DEFINE_COMMAND(IsControl, returns 1 if key is a game control or 2 if a custom co
DEFINE_COMMAND(IsKeyDisabled, returns 1 if the key has been disabled by a script, 0, 1, kParams_OneInt);
DEFINE_COMMAND(IsControlDisabled, returns 1 if the control has been disabled by a script, 0, 1, kParams_OneInt);
DEFINE_CMD_COND(IsControlPressed, returns 1 if the control is pressed, 0, kParams_OneInt_OneOptionalInt);
DEFINE_CMD(GetDisabledKeys, returns an array of all disabled key scancodes, 0, NULL);
DEFINE_COMMAND(GetPressedKeys, returns an array of all pressed key scancodes, 0, 1, kParams_OneOptionalInt);

#undef DEFINE_INPUT

Expand Down
4 changes: 1 addition & 3 deletions nvse/nvse/Commands_Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,4 @@ static ParamInfo kNVSEParams_FireChallenge[] = {
{ "Value 3", kNVSEParamType_Number, 0 }
};

DEFINE_COMMAND_EXP(FireChallenge, Increment a challenge using specified params, 0, kNVSEParams_FireChallenge)

DEFINE_CMD(GetDisabledKeys, returns an array of all disabled key scancodes, 0, NULL);
DEFINE_COMMAND_EXP(FireChallenge, Increment a challenge using specified params, 0, kNVSEParams_FireChallenge)