DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ErrorProperties.c
Go to the documentation of this file.
1
3{
4 const string EP_HEADER_FORMAT_STRING = "%1 (%2)";
5 const string EP_MESSAGE_FORMAT_STRING = "%1\n(%2)";
6
7 protected string m_Message;
8 protected string m_ServerMessage;
9
10 void ErrorProperties(string message, string serverMessage)
11 {
12 m_Message = message;
13 m_ServerMessage = serverMessage;
14 }
15
16 void HandleError(int errorCode, string additionalInfo = "") {}
17
18 string GetClientMessage(string additionalInfo = "")
19 {
20 if ( additionalInfo != "" )
21 return string.Format(EP_MESSAGE_FORMAT_STRING, m_Message, additionalInfo);
22 else
23 return m_Message;
24 }
25
26 string GetServerMessage(string additionalInfo = "")
27 {
28 if ( additionalInfo != "" )
29 return string.Format(EP_MESSAGE_FORMAT_STRING, m_ServerMessage, additionalInfo);
30 else
31 return m_ServerMessage;
32 }
33}
34
37{
38 protected string m_Header;
39 protected int m_DialogButtonType;
40 protected int m_DefaultButton;
41 protected int m_DialogMeaningType;
44
45 void DialogueErrorProperties(string message, string serverMessage, string header, UIScriptedMenu handler = null, int dialogButtonType = DBT_OK, int defaultButton = DBB_OK, int dialogMeaningType = DMT_EXCLAMATION, bool displayAdditionalInfo = true)
46 {
47 m_Header = header;
48 m_DialogButtonType = dialogButtonType;
49 m_DefaultButton = defaultButton;
50 m_DialogMeaningType = dialogMeaningType;
51 m_Handler = handler;
52 m_DisplayAdditionalInfo = displayAdditionalInfo;
53 }
54
55 override void HandleError(int errorCode, string additionalInfo = "")
56 {
57#ifdef NO_GUI
58 return; //do not display error if GUI is disabled
59#endif
60
61#ifdef SERVER
62 return;
63#else
64 string message;
65 if (m_DisplayAdditionalInfo && additionalInfo != "")
66 message = string.Format(EP_MESSAGE_FORMAT_STRING, m_Message, additionalInfo);
67 else
68 message = m_Message;
69
71 string.Format(EP_HEADER_FORMAT_STRING, m_Header, ErrorModuleHandler.GetErrorHex(errorCode)),
73#endif
74 }
75
76 string GetHeader() { return m_Message; }
81}
class ErrorHandlerModule m_Header
This is where to input logic and extend functionality of ErrorHandlerModule.
int GetDialogButtonType()
protected int m_DialogButtonType
string GetHeader()
protected bool m_DisplayAdditionalInfo
int GetDialogMeaningType()
void DialogueErrorProperties(string message, string serverMessage, string header, UIScriptedMenu handler=null, int dialogButtonType=DBT_OK, int defaultButton=DBB_OK, int dialogMeaningType=DMT_EXCLAMATION, bool displayAdditionalInfo=true)
UIScriptedMenu GetHandler()
class ErrorProperties m_Header
Error which shows a generic Dialogue UI.
protected int m_DialogMeaningType
int GetDefaultButton()
protected int m_DefaultButton
protected UIScriptedMenu m_Handler
proto native UIManager GetUIManager()
The error handler itself, for managing and distributing errors to modules Manages the ErrorHandlerMod...
static proto owned string GetErrorHex(int errorCode)
Returns a formatted string of the error code.
Class which holds the properties and handling of an error.
void ErrorProperties(string message, string serverMessage)
protected string m_ServerMessage
Message which will appear on Server.
protected string m_Message
Message which will appear on Client.
const string EP_HEADER_FORMAT_STRING
Formating for header (%1 = Header; %2 = ErrorCode)
void HandleError(int errorCode, string additionalInfo="")
string GetClientMessage(string additionalInfo="")
string GetServerMessage(string additionalInfo="")
const string EP_MESSAGE_FORMAT_STRING
Formating for message (%1 = Message; %2 = AdditionalInfo)
proto native void ShowDialog(string caption, string text, int id, int butts, int def, int type, UIScriptedMenu handler)
Shows message dialog.
proto native CGame GetGame()
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.