mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Add plugin API for showing an error message (#11706)
This commit is contained in:
7
distribution/openrct2.d.ts
vendored
7
distribution/openrct2.d.ts
vendored
@@ -945,6 +945,13 @@ declare global {
|
||||
closeWindows(classification: string, id?: number): void;
|
||||
closeAllWindows(): void;
|
||||
|
||||
/**
|
||||
* Show a red error box.
|
||||
* @param title The title / first line of the box.
|
||||
* @param message The message / second line of the box.
|
||||
*/
|
||||
showError(title: string, message: string): void;
|
||||
|
||||
/**
|
||||
* Shows a text input prompt and calls the given callback when entered.
|
||||
* @param desc The parameters for the text input window.
|
||||
|
||||
@@ -181,6 +181,11 @@ namespace OpenRCT2::Scripting
|
||||
return {};
|
||||
}
|
||||
|
||||
void showError(const std::string& title, const std::string& message)
|
||||
{
|
||||
window_error_open(title, message);
|
||||
}
|
||||
|
||||
void showTextInput(const DukValue& desc)
|
||||
{
|
||||
try
|
||||
@@ -230,6 +235,7 @@ namespace OpenRCT2::Scripting
|
||||
dukglue_register_method(ctx, &ScUi::closeWindows, "closeWindows");
|
||||
dukglue_register_method(ctx, &ScUi::closeAllWindows, "closeAllWindows");
|
||||
dukglue_register_method(ctx, &ScUi::getWindow, "getWindow");
|
||||
dukglue_register_method(ctx, &ScUi::showError, "showError");
|
||||
dukglue_register_method(ctx, &ScUi::showTextInput, "showTextInput");
|
||||
dukglue_register_method(ctx, &ScUi::activateTool, "activateTool");
|
||||
dukglue_register_method(ctx, &ScUi::registerMenuItem, "registerMenuItem");
|
||||
|
||||
Reference in New Issue
Block a user