UOX3 Script Engine

Functions, Methods, Properties and Event handling

Initial A Gump

new Gump
Prototype
-
PurposeCreates a blank gump with no information, allocating memory
Example of Usage
var myGump = new Gump;


Gump Related Methods

AddButton
Prototype
void AddButton( topHeight, topLeft, buttonImage, unk1, unk2, unk3 );
PurposeAdds a button to the gump
Other info I believe that having an unk1 of 1 indicates the gump will close. unk2 should be the button's unique ID, and I *think* that unk3 is the page it is on.

When the button is pressed, onGumpPress event is called, iButton is 0 if the gump has been closed without pressing a button.

function onGumpPress( Sock, iButton ) { }
Example of Usage
myGump.AddButton( 13, 290, 5050, 1, 1, 1 );

 

AddText
Prototype
void AddText( topHeight, topLeft, textColour, text );
Purpose Adds the text text to the gump represented by gumpHandle at topHeight/topLeft in textColour.
Example of Usage
myGump.AddText( 30, 30, 0, "Test text" );

 

AddRadio
Prototype
void AddRadio( topHeight, topLeft, radioImage, unk1, unk2 );
PurposeAdds a radio button to the gump.
Other infoI believe that unk2 is the radio's ID (does not have to be unique). unk1 is unknown, but I would guess that if it was non 0, it would exit.
Example of Usage
myGump.AddRadio( 13, 40, 2151, 0, 2966 );

 

AddPage
Prototype
void AddPage( pageNum );
PurposeAdds a new page
Other infoAnything on page 0 is shown on ALL pages
Example of Usage
myGump.AddPage( 1 );

 

AddPicture
Prototype
void AddPicture( topHeight, topLeft, tilePic );
PurposeAdds the image tilePic to the gump at topHeight/topLeft. tilePic is an ITEM ID.
Example of Usage
myGump.AddPicture( 5, 111, 0x0EED );

 

AddGump
Prototype
void AddGump( topHeight, topLeft, gumpImage );
PurposeAdds a gump on the current gump (ie any image in the gumps part of InsideUO).
Example of Usage
myGump.AddGump( 5, 260, 1141 );

 

AddBackground
Prototype
void AddBackground( topHeight, topLeft, bottomHeight, bottomLeft, backImage );
PurposeAdds a background (should come REALLY early in gump) of height (bottomHeight - topHeight) and width (bottomLeft - topLeft) as image backImage (gump image like via AddGump).
Example of Usage
myGump.AddBackground( 0, 0, 320, 340, 2600 );

 

Send
Prototype
void Send( targSocket );
PurposeSends the gump to targSocket
Example of Usage
myGump.send( mySock );

 

AddTextEntry
Prototype
void AddTextEntry( topHeight, topLeft, unk1, unk2, unk3, unk4, textID, defaultText );
PurposeIt adds a text entry with default text to the gump
Other infoI believe that unk1 is the text colour, unk2 is the maximum length of the field. unk3 seems to be 1, unk4 seems to be a counter from 1000 onwards. textID is much like adding text, and it must be consecutive (same as text, in fact they're together, so adding 2 text and a textentry would mean the 2 text are 0 and 1, while the text entry is 2).
Example of Usage
myGump.AddTextEntry( 20, 62, 200, 30, 1, 1000, 1, "Default text" );

 

AddCheckbox
Prototype
void AddCheckbox( topHeight, topLeft, checkImage, unk1, unk2 );
PurposeAdds a checkbox to the gump
Other infoI believe that unk2 is the checkbox's ID
Example of Usage
myGump.AddCheckbox( 10, 10, 2706, 0, 1 );

 

NoClose
Prototype
void NoClose();
PurposeThis gump can't be closed
Other info-
Example of Usage
myGump.NoClose();

 

NoMove
Prototype
void NoMove();
PurposeThis gump can't be moved
Other info-
Example of Usage
myGump.NoMove();

 

Free
Prototype
void Free();
PurposeDeletes all the memory allocated to the gump
Example of Usage
myGump.Free();

 

GumpExample
function onUse( pUser, iUsed )
{
    var myGump = new Gump; // create a new gump
    myGump.AddBackground( 0, 0, 300, 300, 2600 ); // add an automic scaled background
    myGump.AddGump( 100, 130, 0x589 ); // add some gump art
    myGump.AddGump( 120, 40, 0x157E ); // add some gump art
    myGump.AddPicture( 20, 40, 0x12D8 ); // add tile art
    myGump.AddText( 100, 20, 5, "My first gump!" ); // add text
    myGump.AddButton( 160, 265, 0xF7, 1, 1, 1 ); // add a button
    myGump.Send( pUser.socket ); // send this gump to client now
    myGump.Free(); // clear this gump from uox-memory
}

// this is the event for the button
function onGumpPress( pSock, pButton, gumpData )
{
    if( pButton == 1)  // if button whith id 1 is pressed, do:
    {
        pUser.SysMessage("Button 1 pressed!");
    }
}
Original: ©Copyright 2000-2001 WWW.UOX3.NET (Daniel Stratton/Matthew Randall)||| Rewrite: ©Copyright 2002 WWW.UOXDEV.DE (Florian "Rukus" Frick)