Skip to content

Commit

Permalink
Console command 'as': print messages _after_ code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ohlidalp committed Dec 4, 2021
1 parent 8e637f7 commit 7d19521
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions source/main/system/ConsoleCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,19 +320,25 @@ class AsCmd: public ConsoleCmd
// we want to notify any running scripts that we might change something (prevent cheating)
App::GetScriptEngine()->triggerEvent(SE_ANGELSCRIPT_MANIPULATIONS);

Str<1000> code; // Re-compose the code snippet
// Re-compose the code snippet
Str<1000> code;
for (int i = 1; i < args.size(); ++i)
{
code << " " << args[i];
}
App::GetScriptEngine()->executeString(code.ToCStr());

// Echo the code back to console user.
reply_type = Console::CONSOLE_SYSTEM_REPLY;
reply << " >>> " << code.ToCStr();
App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, reply_type, reply.ToCStr());

// Run the code - will output script messages/AngelScript errors.
App::GetScriptEngine()->executeString(code.ToCStr());
#else
reply_type = Console::CONSOLE_SYSTEM_ERROR;
reply << _L("Scripting disabled in this build");
#endif
App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, reply_type, reply.ToCStr());
#endif
}
};

Expand Down

0 comments on commit 7d19521

Please # to comment.