Gumps

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
xir
Has thanked: 0
Been thanked: 0

Gumps

Post by xir »

These are some of the updates to the gumps I found out if you want to change the documentation. I'm nearly sure all the information is correct. I was messing with it before the site went down and sort of forgot what I did.
:roll:
void AddRadio( topHeight, topLeft, radioImage, unk1, unk2 );

void AddRadio( topHeight, topLeft, radioImage, pressed, id);
"pressed" is whether the item is pressed (as in true) or not when its initialised. "id" is just the callback id of the item
void AddCheckbox( topHeight, topLeft, checkImage, unk1, unk2 );

void AddCheckbox( topHeight, tolLeft, checkImage, checked, id);
same sort of thing, checked is just if the box is ticked
void AddTextEntry( topHeight, topLeft, unk1, unk2, unk3, unk4, textID, defaultText );

void AddTextEntry( topHeight, topLeft, width, height, hue, id, text)
hue = colour, id is callback relay, text is the initialisation text.
void AddButton( topHeight, topLeft, buttonImage, unk1, unk2, unk3 );
The buttons were fun to figure out.

There are two types of buttons, normal relay buttons (which are used in callbacks) and page buttons - which move between pages.

A relay button has the form

void AddButton( topHeight, topLeft, buttonImage, 1, 0, id );
"id" is just the callback id. Fourth parameter is the "behaviour" -> 1 indicates this behaviour is a relay button. Fifth parameter is to do only with page buttons. It shouldn't matter what it is, but just set it to 0 anyway.

A page button

void AddButton( topHeight, topLeft, buttonImage, 0, pageToGo, 0 );
"pageToGo" indicates what page to turn when the button is pressed. Fourth parameter indicates the behaviour - "a page button". The item id shouldn't matter I think because it doesn't need to get a callback.

Ergo

void AddButton( topHeigh, topLeft, buttonImage, behaviour, pageToGo, itemid);
void AddXMFHTMLGump( left, top, width, height, number, hasBorder, hasScrollbar );
The purpose of this is to load a HTML like gump using the cliloc "number". Its to do with Localisation settings etc. Not sure if theres any real use for it in player run shards, unless you can some how edit the cliloc files in the UO directory.
:?:

Also an undocumented gump, which I found in the source.

void AddHTMLGump( topHeight, topLeft, width, height, background, scrollbar, HTMLText);
background and scrollbar are either 0 or 1 depending if you want it turned on or off

HTMLText is just the text in the gump. Not sure if this can actually support HTML, because I haven't tried it. I think it supports http links as I've seen them in game.

There also seems to be a onGumpInput event with one parameter in the source. I think its for TextEntries but I'm not 100% sure.


I made a plugin for GumpStudio (on orbsydia) for UOX3. Just dump the dll (link on bottom of page) in the Plugin folder. I think I got most of the features to work (except maybe the Radio box "grouping" which I have to look into). If you see any errors/additions you want let me know. Its a debug DLL so it should throw exceptions and stuff I hope! :) It works nicely for me, I've tried gumps with a few pages and it seems to work - I just haven't tested the callback functions.

Just make sure if you are adding pages to keep page 0 blank because everything on page 0 gets viewed on all the other pages. And also remember to set your relays/ids for the callbacks and buttons must be specified as either a relay or a page button :) It outputs the ids at the end of the file anyway. If they turn out to be all 0 you know whats wrong :?

Download UOX3 Plugin
Galbuu
UOX3 Neophyte
Posts: 45
Joined: Mon Jul 05, 2004 9:20 am
Location: Orlando, FL
Has thanked: 0
Been thanked: 0
Contact:

Post by Galbuu »

How do I set a button to execute a script and close the gump?
Galbuu
UOX3 Neophyte
Posts: 45
Joined: Mon Jul 05, 2004 9:20 am
Location: Orlando, FL
Has thanked: 0
Been thanked: 0
Contact:

Post by Galbuu »

Also, do I use callback or

function onGumpPress(mySock, myButton)

?

And can I simply write the code in GumpStudio where it says "Code"?
Guest
Has thanked: 0
Been thanked: 0

Post by Guest »

I didn't see the "Code" bit, so I'll add that in when I get time. You can insert the code in manually just use the OnGumpPress() callback and use the button id thats printed out at the bottom of the script.
xir
Has thanked: 0
Been thanked: 0

Post by xir »

Anonymous wrote:I didn't see the "Code" bit, so I'll add that in when I get time. You can insert the code in manually just use the OnGumpPress() callback and use the button id thats printed out at the bottom of the script.
oops forgot to post a name ^^ was me
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

An examplescript:

Code: Select all

// scriptid = 0
// On Login/Creation brings you race menu
// Freezing characters doesn't work currently!
// Race Selection Gump
// Written by Lord Dreoth.
//----------------------------------------------------------------
//----------------------------------------------------------------

function onLogin(mySock, myChar) 
{
	myChar.SysMessage( "Welcome!" );
	myChar.SoundEffect( 0x01fb, true );
	var myRaceID = myChar.raceID;
	if (myRaceID == 0 ) 
	{
		myChar.socket.SysMessage("You have not chosen your race...");
		myChar.socket.SysMessage("You will remain frozen untill a race is chosen!");
		myChar.frozen = true;
		var ret = SelectRaceGump(myChar, mySock);
	}
}

//----------------------------------------------------------------
//----------------------------------------------------------------

function SelectRaceGump(myChar, mySock) 
{
	var myGump = new Gump;
	myGump.NoClose();
	myGump.AddBackground(0, 0, 240, 130, 0xa3c);
	myGump.AddText( 14, 9, 5, "What race shall you be born to?" );
	
	myGump.AddText( 30, 35, 5, "- Human"); // Race 1
	myGump.AddButton( 14, 40, 0x837, 1, 0, 1 );
	
	myGump.AddText ( 30, 55, 5, "- Half-Elf"); // Race 2
	myGump.AddButton ( 14, 60, 0x837, 1, 0, 2);
	
	myGump.AddText( 30, 75, 5, "- Elf"); // Race 3
	myGump.AddButton( 14, 80, 0x837, 1, 0, 3);
	
	myGump.AddText( 150, 35, 5, "- Drow"); // Race 4
	myGump.AddButton( 134, 40, 0x837, 1, 0, 4);
	
	myGump.AddText( 150, 55, 5, "- Undead"); // Race 5
	myGump.AddButton( 134, 60, 0x837, 1, 0, 5);
	
	myGump.AddText( 150, 75, 5, "- Shade"); // Race 6
	myGump.AddButton( 134, 80, 0x837, 1, 0, 6);

	myGump.Send( mySock );
}

function onGumpPress(mySock, myButton, gumpData)
{
	var myChar = mySock.currentChar;
	switch( myButton ) 
	{
		case 0: // Trying to excape the race selection?
			var ret = SelectRaceGump(myChar,mySock);
			myChar.SysMessage("Just pick a race...");
			break;
	
		case 1: // Human
			myChar.raceID = 1;
			myChar.SysMessage("You've become a Human");
			myChar.frozen = false;
			//myChar.SetLocation ( 4388, 2305, 0, 0 ); // Teleport to hometown.
			break;
	
		case 2: // Half-Elf
			myChar.raceID = 2;
			myChar.SysMessage("You've become a Half Elf.");
			myChar.frozen = false;
			//myChar.SetLocation ( 4388, 2305, 0, 0 ); // Teleport to hometown.
			break;
	
		case 2: // Elf
			myChar.raceID = 3;
			myChar.SysMessage("You've become an Elf.");
			myChar.frozen = false;
			//myChar.SetLocation ( 4388, 2305, 0, 0 ); // Teleport to hometown.
			break;
	
		case 4: // Drow
			myChar.raceID = 4;
			myChar.SysMessage("You've become a Drow.");
			myChar.frozen = false;
			//myChar.SetLocation ( 4388, 2305, 0, 0 ); // Teleport to hometown.
			break;
	
		case 5: // Undead
			myChar.raceID = 5;
			myChar.SysMessage("You've become an Undead.");
			myChar.frozen = false;
			//myChar.SetLocation ( 4388, 2305, 0, 0 ); // Teleport to hometown.
			break;
	
		case 6: // Shade
			myChar.raceID = 6;
			myChar.SysMessage("You've become a Shade.");
			myChar.frozen = false;
			//myChar.SetLocation ( 4388, 2305, 0, 0 ); // Teleport to hometown.
			break;
	}
}
-= Ho Eyo He Hum =-
Galbuu
UOX3 Neophyte
Posts: 45
Joined: Mon Jul 05, 2004 9:20 am
Location: Orlando, FL
Has thanked: 0
Been thanked: 0
Contact:

Post by Galbuu »

Is there a way to make a button do onGumpSelect and go to another page at the same time?
xir
Has thanked: 0
Been thanked: 0

Post by xir »

Transparent area is fixed (had width + height reversed)
IDs work properly on buttons now (was using Pressed ID for Normal ID)
Added to the code section so you can enter code in the buttons now.

If you find any more problems or anything I'll be on irc or post here.
The DLL is updated, same link.

xir
Galbuu
UOX3 Neophyte
Posts: 45
Joined: Mon Jul 05, 2004 9:20 am
Location: Orlando, FL
Has thanked: 0
Been thanked: 0
Contact:

Post by Galbuu »

xir wrote:Transparent area is fixed (had width + height reversed)
IDs work properly on buttons now (was using Pressed ID for Normal ID)
Added to the code section so you can enter code in the buttons now.

If you find any more problems or anything I'll be on irc or post here.
The DLL is updated, same link.

xir
Good job. I'm sure we all appreciate it.
Post Reply