spawndef

Member
ok here my probleme,
i have made a gump with page.
using direct button is easy to do.
Code:
AddButton( 500, 06, 5601, 5605, 1, GumpButtonType.Page, pageNumber = 1 );
now im trying to open a gump from Send.Gump.
its is possible to open the gump at specific page #2 ?
Code:
player.SendGump(new HistoryGump());
and opening page #2
 
You can't skip to a page when using GumpButtonType.Page.

You need to write your own page navigation logic in order to jump to specific pages.

The reason for this is that clicking a button with GumpButtonType.Page does not send a response to the server and page navigation is handled by the client.

Take a look at how gumps like HouseGumpAos.cs do it, they use an enum to determine which page the gump should display.
 
Example:

Code:
public class MyGump : Gump
{
	public MyGump( int page )
		: base( 0, 0 )
	{
		AddPage( 0 );

		AddBackground( 0, 0, 100, 40, 9270 );

		switch( page )
		{
			case 1:
				AddHtml( 10, 10, 80, 20, "This is page 1", false, false );
  			break;

			case 2:
				AddHtml( 10, 10, 80, 20, "This is page 2", false, false );
  			break;
		}
	}
}
 
if i past from OnResponse its possible if i remember ?
[doublepost=1486955025][/doublepost]from gump button is easy
Code:
int pageNumber = 0;
AddButton( 500, 06, 5601, 5605, 1, GumpButtonType.Page, pageNumber = 1 );
AddPage( 1 );
{
}
 
You would use AddButton() with GumpButtonType.Reply.

In OnResponse, you use the ButtonID as the page index.

from.SendGump( new MyGump ( info.ButtonID ) );

It's the most simple way to do it.

ButtonID < 1 or > 2 then close the gump.
 
Could you show an example? for instance on custom spell books. How would I call out a page so it doesn't keep opening up gump back to page 1?
Code:
if (HasSpell( from, 510) )
                     {
                         AddLabel( 140, dby, gth, "Calm Animal" );
                            AddButton( 120, dby2, 2104, 2103, 1, GumpButtonType.Reply, 1 );
                            dby += 16;
                    dby2 += 16;
                }
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back