From Stealth Client

Jump to: navigation, search

Gump

AddGumpIgnoreByID

procedure AddGumpIgnoreByID(ID : Cardinal);

AddGumpIgnoreBySerial

procedure AddGumpIgnoreBySerial(Serial : Cardinal);

ClearGumpsIgnore

procedure ClearGumpsIgnore;

CastToObj

def CloseClientGump( ID : Integer) -> None

CloseSimpleGump

procedure CloseSimpleGump(GumpIndex:Word)

Closes the "easy" to index Gump GumpIndex

Closes specials. way, without pressing any buttons on them - as it happens in the client when you press the right mouse button.

Example:

If IsGump then
  if IsGumpCanBeClosed(GetGumpsCount-1) then
    CloseSimpleGump(GetGumpsCount-1);

GetGumpButtonsDescription

procedure GetGumpButtonsDescription(GumpIndex:Integer; var TL:TStringList)

Writes to a text list of TL short contents of Gump who are listed as number of stealth GumpIndex

In contrast to the Doc:Api/GetGumpShortLines, as a result of this function to the list, in addition to general parameters Gump, get only the buttons(Buttons)

ATTENTION! UserList must be created through the var_list_name:= TStringList.Create and necessarily removed after use by var_list_name.Free;

If an invalid index Gump(or Gampo not), then the TL will be empty.

Example:

Program takegump; 
 
var 
b:TStringList; 
i:Integer; 
 
Begin 
b := TStringList.Create; 
SetSilentMode(False); 
for i:= 0 to GetGumpsCount - 1 do 
  GetGumpButtonsDescription(i, b); 
b.free; 
End.

GetGumpFullLines

procedure GetGumpFullLines(GumpIndex:Integer; var TL:TStringList)

Writes to a text list of TL the entire contents of Gump who are listed as number of stealth GumpIndex

ATTENTION! UserList must be created through the var_list_name:= TStringList.Create and necessarily removed after use by var_list_name.Free;

If an invalid index Gump(or Gampo not), then the TL will be empty.

Example:

Program takegump; 
 
var 
b:TStringList; 
i:Integer; 
 
Begin
 
b := TStringList.Create; 
SetSilentMode(False); 
for i:= 0 to GetGumpsCount - 1 do 
  GetGumpFullLines(i, b); 
b.free; 
End.

As a result of an example in a string list will be something like:

Serial: 1A1B9F 
GumpID: 11CC34F 
X: 0000 
Y: 0000 
Pages: 13 
Gump Options: NoDispose NoClose 
 
GumpPics: X Y ID  Page 
GumpPic: 480  367  2443  0 
 
TilePics: X   Y   ID   Page 
0   TilePic: 80  94  5099  2 
1   TilePic: 230  94  5103  2 
... 
47   TilePic: 230  184  5176  12 
48   TilePic: 80  274  5181  12 
 
ResizePics: X   Y   ID   Width   Height   Page 
0   ResizePic: 20  20  5054  540  40  0 
1   ResizePic: 20  60  5054  360  300  0 
2   ResizePic: 380  60  5054  180  300  0 
3   ResizePic: 20  360  5054  540  70  0 
 
 
CheckBoxes: X   Y   Released_ID  Pressed_ID   Status   Return_value   Page 
0   CheckBox: 140  395  210  211  0  1537  0 
 
 
GumpTexts: X   Y   Color   Text_ID   Page 
0   GumpText: 159  30  51  0  0 
1   GumpText: 60  371  900  1  0 
... 
61   GumpText: 223  229  900  62  12 
62   GumpText: 73  319  900  63  12 
 
TextEntries: X   Y   Width   Height   Status   Color   Return_value   Default_text_id   Page 
0   TextEntry: 487  370  100  30  0  513  5  0 
 
Text Lines: 
BLACKSMITH SELECTION MENU 
Make last (ringmail gloves) 
Repair Item 
Hardening 
How Many? 
1 
 
 
... 
 
War Hammer 
Hammer Pick 
 
GumpButtons: X   Y   Released_ID  Pressed_ID   Quit   Page_ID   Return_value   Page 
0   GumpButton: 40  372  208  209  1  0  1025  0 
1   GumpButton: 40  395  208  209  1  0  1026  0 
 
 
... 
50   GumpButton: 200  164  1209  1210  1  0  5176  12 
51   GumpButton: 50  254  1209  1210  1  0  5180  12

GetGumpID

function GetGumpID(GumpIndex:Integer):Cardinal

Returns the Gump - Id. Number(Gump ID).

If there is no connection to the server or UO given the wrong number Gump - returns 0.

Example:

If GetGumpsCount > 0 then
  if GetGumpID(GetGumpsCount-1) = $ 15A7DDF then
    CloseSimpleGump(GetGumpsCount-1);


GetGumpInfo

Fill gumpInfo by gump elements who are listed as number of stealth GumpIndex.

//Pascal Sample
procedure GetGumpInfo(GumpIndex : Word; var gumpInfo : TGumpInfo);


Example PS:

GetGumpInfo(0, gi);
AddToSystemJournal('Gump has ' + IntToStr(Length(gi.GumpButtons)) + ' buttons');

In Python a dictionary will be returned with a nested structure containing all the info according to the Pascal records

Example Python:

import pprint
 
gumpdictDebug = open (r'' + StealthPath() +'gumpDict.log', 'w')
pp = pprint.PrettyPrinter(width=150, indent=1, stream=gumpdictDebug)
pp.pprint(GetGumpInfo(0))
 
# Output dictionary
{'GumpButtons': [{'ElemNum': 3, 'Page': 0, 'page_id': 0, 'pressed_id': 4007, 'quit': 1, 'released_id': 4005, 'return_value': 1, 'x': 60, 'y': 95},
                 {'ElemNum': 5, 'Page': 0, 'page_id': 0, 'pressed_id': 4019, 'quit': 1, 'released_id': 4017, 'return_value': 0, 'x': 285, 'y': 95}],
 'GumpID': -1817877309,
 'NoClose': False,
 'NoDispose': False,
 'NoMove': False,
 'NoResize': False,
 'Pages': 1,
 'ResizePics': [{'ElemNum': 1, 'Page': 0, 'gump_id': 2600, 'height': 135, 'width': 500, 'x': 10, 'y': 10}],
 'Serial': 346764,
 'X': 0,
 'XmfHtmlGump': [{'Cliloc_id': 1006046, 'ElemNum': 2, 'Page': 0, 'background': 1, 'height': 55, 'scrollbar': 1, 'width': 420, 'x': 52, 'y': 35},
                 {'Cliloc_id': 1006044, 'ElemNum': 4, 'Page': 0, 'background': 0, 'height': 35, 'scrollbar': 0, 'width': 150, 'x': 95, 'y': 96},
                 {'Cliloc_id': 1006045, 'ElemNum': 6, 'Page': 0, 'background': 0, 'height': 35, 'scrollbar': 0, 'width': 150, 'x': 320, 'y': 96}],
 'Y': 0}

Records Details:

TGumpInfo = record
    Serial : Cardinal;
    GumpID : Cardinal;
    X : Word;
    Y : Word;
    Pages : Integer;
    NoMove : Boolean;
    NoResize : Boolean;
    NoDispose : Boolean;
    NoClose : Boolean;
 
 
    Groups : array of TGroup;
    EndGroups : array of TEndGroup;
    GumpButtons : array of TGumpButton;
    ButtonTileArts : array of TButtonTileArt;
    CheckBoxes : array of TCheckBox;
    CheckerTrans : array of TCheckerTrans;
    CroppedText : array of TCroppedText;
    GumpPics : array of TGumpPic;
    GumpPicTiled : array of TGumpPicTiled;
    RadioButtons : array of TRadio;
    ResizePics : array of TResizePic;
    GumpText : array of TGumpText;
    TextEntries : array of TTextEntry;
    Text : array of string;
    TextEntriesLimited : array of TTextEntryLimited;
    TilePics : array of TTilePic;
    TilePicHue : array of TTilePicHue;
    Tooltips : array of TTooltip;
    HtmlGump : array of THtmlGump;
    XmfHtmlGump : array of TXmfHtmlGump;
    XmfHTMLGumpColor : array of TXmfHTMLGumpColor;
    XmfHTMLTok : array of TXmfHTMLTok;
    ItemProperties : array of TItemProperty;
end;
  TGroup = record
    groupnumber : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TEndGroup = record
    groupnumber : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TPage =  record
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TMasterGump =  record
    ID : Cardinal;
    ElemNum : Integer;
 end;
 
  TGumpButton =  record
    x, y : Integer;
    released_id : Integer;
    pressed_id : Integer;
    quit : Integer;
    page_id : Integer;
    return_value : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TButtonTileArt =  record
    x, y : Integer;
    released_id : Integer;
    pressed_id : Integer;
    quit : Integer;
    page_id : Integer;
    return_value : Integer;
    art_id : Integer;
    Hue :  Integer;
    art_x, art_y : Integer;
    ElemNum : Integer;
  end;
 
  TCheckBox =  record
    x, y : Integer;
    released_id : Integer;
    pressed_id : Integer;
    status : Integer;
    return_value : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TCheckerTrans =  record
    x, y : Integer;
    width, height : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TCroppedText =  record
    x, y,width, height,color,text_id : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TGumpPic =  record
    x, y : Integer;
    id : Integer;
    Hue : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TGumpPicTiled =  record
    x, y : Integer;
    width, height : Integer;
    gump_id : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TRadio =  record
    x, y : Integer;
    released_id : Integer;
    pressed_id : Integer;
    status : Integer;
    return_value : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TResizePic =  record
    x, y : Integer;
    gump_id : Integer;
    width, height : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TGumpText =  record
    x, y, color : Integer;
    text_id : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TTextEntry =  record
    x, y, width, height, color : Integer;
    return_value : Integer;
    default_text_id : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TTextEntryLimited =  record
    x, y, width, height, color : Integer;
    return_value : Integer;
    default_text_id : Integer;
    Limit : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TTilePic =  record
    x, y : Integer;
    id : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TTilePichue =  record
    x, y : Integer;
    id : Integer;
    color : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TTooltip =  record
    Cliloc_ID : Cardinal;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  THtmlGump =  record
    x, y : Integer;
    width, height : Integer;
    text_id : Integer;
    background : Integer;
    scrollbar : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TXmfHTMLGump =  record
    x, y : Integer;
    width, height : Integer;
    Cliloc_id : Cardinal;
    background : Integer;
    scrollbar : Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TXmfHTMLGumpColor =  record
    x, y : Integer;
    width, height : Integer;
    Cliloc_id : Cardinal;
    background : Integer;
    scrollbar : Integer;
    Hue :  Integer;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TXmfHTMLTok =  record
    x, y : Integer;
    width, height : Integer;
    background : Integer;
    scrollbar : Integer;
    Color : Integer;
    Cliloc_id : Cardinal;
    Arguments : String;
    Page : Integer;
    ElemNum : Integer;
  end;
 
  TItemProperty = packed record
    Prop : Cardinal;
    ElemNum : Integer;
  end;

GetGumpSerial

function GetGumpSerial(GumpIndex:Integer):Cardinal

Returns the Gump - serial number(Serial ID). If there is no connection to the server or UO given the wrong number Gump - returns 0.

Example:

If GetGumpsCount > 0 then
  if GetGumpSerial(GetGumpsCount-1) = $ 15A7DDF then
    CloseSimpleGump(GetGumpsCount-1);

GetGumpShortLines

procedure GetGumpShortLines(GumpIndex:Integer; var TL:TStringList)

Writes to a text list of abbreviated TL content Gump who are listed as number of stealth GumpIndex

In contrast to the Doc:Api/GetGumpFullLines, which is in the list of all content Gump, as a result of this function to the list, in addition to general parameters Gump, enter the following elements:

  • TextEntries
  • TextLines
  • Buttons

ATTENTION! UserList must be created through the var_list_name:= TStringList.Create and necessarily removed after use by var_list_name.Free;

If an invalid index Gump(or Gampo not), then the TL will be empty.

Example:

Program takegump; 
 
var 
b:TStringList; 
i:Integer; 
 
Begin 
b := TStringList.Create; 
SetSilentMode(False); 
for i:= 0 to GetGumpsCount - 1 do 
  GetGumpShortLines(i, b); 
b.free; 
End.

GetGumpTextLines

procedure GetGumpTextLines(GumpIndex:Integer; var TL:TStringList)

Writes to a text list of TL all text strings from Gump who are listed as number of stealth GumpIndex

ATTENTION! UserList must be created through the var_list_name:= TStringList.Create and necessarily removed after use by var_list_name.Free;

If an invalid index Gump(or Gampo not), then the TL will be empty.

Example:

TempSL := TStringList.Create;
WaitTargetGround($ 1BDD);
UseObject(FindType($ 1EB9, ground));
GetGumpTextLines(GetGumpsCount-1, TempSL);
{Then handle the resulting list}
TempSL.Free;

GetGumpsCount

function GetGumpsCount():Word

Returns the number of hanging on Char gump

If there is no connection to the server or UO Gampo not - returns 0, otherwise returns the number.

In the script is very often used the expression GetGumpsCount-1, which is the parameter GumpIndex to the functions, which means the last Gump in the list.

Example:

If IsGump then
  if IsGumpCanBeClosed(GetGumpsCount-1) then
    CloseSimpleGump(GetGumpsCount-1);

GumpAutoCheckBox

procedure GumpAutoCheckBox(CheckBoxID, Value:Integer)

The principle of operation is similar to Doc:Api/WaitGump, with the only difference being that sought not return_value button, return_value "ticks"(CheckBox). If found - the old value of the status of the CheckBox is replaced by the Value.

In response to this server Gump 'NOT' off! This must be done through the Doc:Api/WaitGump or Doc:Api/NumGumpButton

Works as a trap, and how to handle already come Gump.

Example:

  WaitTargetGround($ 1BF5);  
  GumpAutoCheckBox(1537, 1);
  WaitGump('7956 ');
  UseObject(FindType($ 1EB9, backpack));

GumpAutoRadiobutton

procedure GumpAutoRadiobutton(RadiobuttonID , Value : Integer);

GumpAutoTextEntry

procedure GumpAutoTextEntry(TextEntryID:Integer; Value:String)

The principle of operation is similar to Doc:Api/WaitGump, with the only difference being that sought not return_value buttons and input fields return_value(textentry). If found - the old value is replaced by this textentry Value.

In response to this server Gump 'NOT' off! This must be done through the Doc:Api/WaitGump or Doc:Api/NumGumpButton

Works as a trap, and how to handle already come Gump.

Example:

{Krafters piece of script. 
First, put a trap on target for Ingots on the floor, 
then trap the incoming Gump, to replace the value TextEntry, 
Gump then trap on the button 
and then use to call tinker tools Gump.}
  WaitTargetGround($ 1BF5);  
  GumpAutoTextEntry(513, '30 ');
  WaitGump('7956 ');
  UseObject(FindType($ 1EB9, backpack));

The principle is similar to Doc:Api/NumGumpTextEntry.

IsGump

function IsGump():Boolean

Returns to the presence of Chara at least one hanging Gump

If there is no connection to the server or UO Gampo not - return False, if there is at least one - True.

Example:

If IsGump then
  if IsGumpCanBeClosed(GetGumpsCount-1) then
    CloseSimpleGump(GetGumpsCount-1);

IsGumpCanBeClosed

function IsGumpCanBeClosed(GumpIndex:Integer):Boolean

Returns the availability of properties Gump - NoClose

If there is no connection to the server or UO given the wrong number Gump - returns False.

If the property is present NoClose - that Gump can NOT be closed with Doc:Api/CloseSimpleGump

Example:

If GetGumpsCount > 0 then
  if GetGumpID(GetGumpsCount-1) = $ 15A7DDF then
    CloseSimpleGump(GetGumpsCount-1);

NumGumpButton

function NumGumpButton(GumpIndex, Value:Integer):Boolean

It does not work as a trap for Gump, but only for processing has come Gump.

The principle of operation is the same as that of the Doc:Api/WaitGump, with the only difference that there is no exhaustive search of all gumps in the list, and only the buttons are moving Gump, the index is specified in the GumpIndex

If this button is not found - the server did not sent, and the function returns False.

Button No (Value param) - it's value of "return_value" property of GumpButton. Can be easy obtained from any GetXXXGumpLines or GetGumpInfo methods.

Example:

{Kraft piece of script. 
First, put a trap on target for Ingots on the floor, 
then use to call tinkerools Gump,
then the replacement value TextEntry Gump, 
then press the button Gump.}
  WaitTargetGround($ 1BF5); 
  a:= GetGumpsCount; 
  UseObject(FindType($ 1EB9, backpack));
  while a = GetGumpsCount do
    Wait(50);
  NumGumpTextEntry(GetGumpsCount-1, 513, '30 ');
  NumGumpButton(GetGumpsCount-1, 7956);

NumGumpCheckBox

function NumGumpCheckBox(GumpIndex, CBID, Value:Integer):Boolean

It does not work as a trap for Gump, but only for processing has come Gump.

The principle of operation is the same as that of the Doc:Api/GumpAutoCheckBox, with the only difference that there is no exhaustive search of all Gampo in the list, and get over only the CheckBox Gump, the index is specified in the GumpIndex

If a CheckBox is not found, then the function returns False.

In response to this server Gump 'NOT' sent! This must be done through the Doc:Api/WaitGump or Doc:Api/NumGumpButton

Example:

  WaitTargetGround($ 1BF5); 
  a:= GetGumpsCount; 
  UseObject(FindType($ 1EB9, backpack));
  while a = GetGumpsCount do
    Wait(50);
  NumGumpCheckBox(GetGumpsCount-1, 1537, 1);
  NumGumpButton(GetGumpsCount-1, '7956 ');

NumGumpRadiobutton

function NumGumpRadiobutton(GumpIndex : Word; RadiobuttonID,Value : Integer): Boolean;

NumGumpTextEntry

function NumGumpTextEntry(GumpIndex, TextEntryID:Integer; Value:String):Boolean

It does not work as a trap for Gump, but only for processing has come Gump.

The principle of operation is the same as that of the Doc:Api/GumpAutoTextEntry, with the only difference that there is no exhaustive search of all Gampo in the list, and get over TextEntry only the Gump, the index is specified in the GumpIndex

If such TextEntry not found, then the function returns False.

Example:

{Krafterskogo piece of script. 
First, put a trap on target for Ingots on the floor, 
then trap the incoming Gump, to replace the value TextEntry, 
Gump then trap on the button 
and then use to call tinkertulzov Gump.}
  WaitTargetGround($ 1BF5); 
  a:= GetGumpsCount; 
  UseObject(FindType($ 1EB9, backpack));
  while a = GetGumpsCount do
    Wait(50);
  NumGumpTextEntry(GetGumpsCount-1, 513, '30 ');
  NumGumpButton(GetGumpsCount-1, 7956);

WaitGump

procedure WaitGump(Value : String)

Ловушка на гамп. Впрочем, абсолютно так же может использоваться и для обработки уже пришедших гампов.

Работает так:

начинает перебирать гампы от первого пришедшего до последнего пришедшего. В каждом из перебираемых гампов идет просмотр всех имеющихся на нем кнопок на предмет совпадения параметра функции Value со значением return_value кнопки. Если есть совпадение - то перебор прекращается, и отсылается ответ на гамп серверу, а в стелсе гамп уничтожается.

Если такая кнопка не найдена - то ничего серверу не отсылается. При этом процедура не возвращает в скрипт ничего для определения успешности выполнения, и это есть одна из недоработок этой процедуры, исправленная в Doc:Api/NumGumpButton

Button No (Value param) - it's value of "return_value" property of GumpButton. Can be easy obtained from any GetXXXGumpLines or GetGumpInfo methods.

Пример 1:

WaitTargetGround($1BDD);
WaitGump('3636');
UseObject(FindType($1EB9,ground));

Пример 2:

if Dead then 
  WaitGump('1'); ''gump of ressurection

WaitTextEntry

procedure WaitTextEntry(Value : String)

Обработка слегка особенного гампа, состоящего ТОЛЬКО из поля ввода и 2 кнопок - ОК и Cancel.

Работает и как ловушка, и для обработки уже пришедших полей ввода.

Если поле ввода уже есть - пакет с ответом отсылается серверу, в стелсе уничтожается поле ввода. Если еще не пришло - ставится ловушка, которая срабатывает сразу по приходу.

Пример:

WaitTargetGround($XXXX);
WaitTextEntry('20');
UseObject(FindType(pestyle_type,backpack));