Program New function ReadGump GumpType Cardinal var GumpIndex Word var

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Program New;
function ReadGump(GumpType:Cardinal;var GumpIndex:Word;var GumpSerial:Cardinal):Boolean;
var
fIndex : Word;
fCount : Word;
begin
fCount := GetGumpsCount();
if(fCount > 0)then
begin
for fIndex := 0 to fCount - 1 do
begin
if(GetGumpID(fIndex) = GumpType)then
begin
GumpIndex := FIndex;
GumpSerial := GetGumpSerial(FIndex);
Result := True;
exit;
end;
end;
end;
Result := False;
GumpIndex := $0;
GumpSerial := $0;
end;
Procedure HandleIncomingGump(Serial,GumpID,X,Y:Cardinal);
var
fSerial : Cardinal;
fIndex : Word;
fInfo : TGumpInfo;
Val : Cardinal;
begin
if(GumpID = $47D09E42)then
begin
if(ReadGump(GumpID,fIndex,fSerial))then
begin
GetGumpInfo(fIndex,fInfo);
Val := 0;
if(fInfo.TilePicHue[8].X = 139)and(fInfo.TilePicHue[8].Y = 131)then Val := 1;//Done
if(fInfo.TilePicHue[8].X = 251)and(fInfo.TilePicHue[8].Y = 139)then Val := 2;//Done
if(fInfo.TilePicHue[8].X = 365)and(fInfo.TilePicHue[8].Y = 127)then Val := 3;//Done
if(fInfo.TilePicHue[8].X = 135)and(fInfo.TilePicHue[8].Y = 196)then Val := 4;//Done
if(fInfo.TilePicHue[8].X = 257)and(fInfo.TilePicHue[8].Y = 209)then Val := 5;//Done
if(fInfo.TilePicHue[8].X = 365)and(fInfo.TilePicHue[8].Y = 202)then Val := 6;//Done
if(fInfo.TilePicHue[8].X = 128)and(fInfo.TilePicHue[8].Y = 274)then Val := 7;//Done
if(fInfo.TilePicHue[8].X = 253)and(fInfo.TilePicHue[8].Y = 280)then Val := 8;//Done
if(fInfo.TilePicHue[8].X = 361)and(fInfo.TilePicHue[8].Y = 265)then Val := 3;//Done
if(Val>0)then NumGumpButton(fIndex,Val);
end;
end;
end;
begin
SetEventProc(evIncomingGump,'HandleIncomingGump');
while(Connected())do
begin
Wait(100);
end;
end.