source: OniTrainer/current/Unit12.pas@ 1014

Last change on this file since 1014 was 251, checked in by alloc, 17 years ago
File size: 2.6 KB
Line 
1UNIT Unit12;
2
3INTERFACE
4
5USES
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, ExtCtrls, StrUtils;
8
9TYPE
10 TForm12 = Class(TForm)
11 label_colors: TLabel;
12 Message_Edit: TEdit;
13 send_message: TButton;
14 timer_check: TTimer;
15 Label1: TLabel;
16 Label2: TLabel;
17 PROCEDURE FormShow(Sender: TObject);
18 PROCEDURE timer_checkTimer(Sender: TObject);
19 PROCEDURE send_messageClick(Sender: TObject);
20 PROCEDURE FormCloseQuery(Sender: TObject; var CanClose: Boolean);
21 PRIVATE
22 PUBLIC
23 END;
24
25VAR
26 Form12: TForm12;
27
28IMPLEMENTATION
29
30USES Unit1,Unit2,Unit3,Unit5,Unit6,Unit7,Unit8,Unit9,Unit10,Unit11;
31
32{$R *.dfm}
33
34PROCEDURE TForm12.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
35 BEGIN
36 Self.Visible:=False;
37 CanClose:=False;
38 Form1.Menu_Patch_Messages.Checked:=False;
39 END;
40
41PROCEDURE TForm12.send_messageClick(Sender: TObject);
42 VAR adr_message:LongWord;
43 BEGIN
44 IF _connected AND patch_messages_loaded THEN BEGIN
45 adr_message:=Decode_Int(ReadMem(address_message_pointer,4));
46
47 IF adr_message=0 THEN BEGIN
48 MessageBox(Form12.Handle,PChar('You have to load a level to which you added the script'+Chr(13)+Chr(10)+'before using this stuff.'),PChar('Error'),MB_OK);
49 END ELSE BEGIN
50 SendMessageToOni(Form12.Message_Edit.Text);
51 END;
52 END ELSE BEGIN
53 IF _connected THEN BEGIN
54 MessageBox(Form12.Handle,PChar('You have to apply the patch before using this stuff.'),PChar('Error'),MB_OK);
55 END;
56 END;
57 END;
58
59PROCEDURE TForm12.timer_checkTimer(Sender: TObject);
60 VAR buffer:byte_array;
61 adr_message:LongWord;
62 BEGIN
63 IF _connected AND patch_messages_loaded THEN BEGIN
64 adr_message:=Decode_Int(ReadMem(address_message_pointer,4));
65
66 buffer:=ReadMem(adr_message,200);
67 IF NOT Message_Edit.Focused THEN BEGIN
68 Message_Edit.Text:=Decode_Str(buffer);
69 END;
70 END;
71 END;
72
73PROCEDURE TForm12.FormShow(Sender: TObject);
74 BEGIN
75 Send_Message.SetFocus;
76 Form12.timer_checkTimer(Self);
77 label_colors.Caption:='Color-Codes:'+Chr(13)+Chr(10)+
78 'b. = blue'+Chr(13)+Chr(10)+
79 'c. = cyan (lighter blue)'+Chr(13)+Chr(10)+
80 'g. = green'+Chr(13)+Chr(10)+
81 'l. = purple'+Chr(13)+Chr(10)+
82 'o. = orange'+Chr(13)+Chr(10)+
83 'r. = red'+Chr(13)+Chr(10)+
84 'u. = umber (some brown :D )'+Chr(13)+Chr(10)+
85 'y. = yellow';
86 END;
87
88END.
Note: See TracBrowser for help on using the repository browser.