RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Spells!

wstsdwgr

Wanderer
Ok, I'm trying to get my summonbook to have multiple pages like a spellbook, but I can't get a working page flipper button going.

What I had was:
AddButton( 393, 14, 2206, 2206, 0, GumpButtonType.Page, 2 );

But I don't know how to tell it to only display the next page when the button is hit. Any help please?
 

wstsdwgr

Wanderer
Scratch that, got a page flipper going. Hopefully I will be done soon with this gump..ran into another error. Here's the part of code where it's messing up:
private void AddIndex()
{
AddButton( 393, 14, 2206, 2206, 0, GumpButtonType.Page, 2 );
}

public SummonBookGump( Mobile from, SummonBook book ) : base( 150, 200 )
{
m_Book = book;

AddIndex();
AddBackground();

for ( int page = 0; page < 4; ++page )
{
AddPage( 2 + page );

AddButton( 125, 14, 2205, 2205, 0, GumpButtonType.Page, 1 + page );

if ( page < 3 )
AddButton( 393, 14, 2206, 2206, 0, GumpButtonType.Page, 3 + page );

Not a compiler error..what it does in game is it has an index page that is blank, and I can't figure out how to get rid of it. I am not able to place any labels on this page either. Also the pages cycle through forever without having a last page, any way to fix either of these? Somebody has to know how, thanks.
 

Jalister

Sorceror
wstsdwgr said:
Scratch that, got a page flipper going.

Mind letting me know how you did that? I have not had alot of time to work on this, and I leave for work in an hour. I should be able to put alot of time into getting this working tonight.

Jalister
 

wstsdwgr

Wanderer
It's the same code as I have posted above. I just used if loops after that batch of code to say what to put on which page. Here:

using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Network;
using Server.Spells;
using Server.Spells.Undine;
using Server.Prompts;

namespace Server.Gumps
{
public class SummonBookGump : Gump
{
private SummonBook m_Book;

public SummonBook Book{ get{ return m_Book; } }

private void AddBackground()
{


// Background image
AddImage( 100, 10, 2200, 0x89B );

// Two seperators
for ( int i = 0; i < 2; ++i )
{
int xOffset = 125 + (i * 165);

AddImage( xOffset, 50, 57, 0x168 );
xOffset += 20;

for ( int j = 0; j < 6; ++j, xOffset += 15 )
AddImage( xOffset, 50, 58 );

AddImage( xOffset - 5, 50, 59, 0x168 );
}
}

private void AddIndex()
{
AddButton( 393, 14, 2206, 2206, 0, GumpButtonType.Page, 2 );
}

public SummonBookGump( Mobile from, SummonBook book ) : base( 150, 200 )
{
m_Book = book;

AddIndex();
AddBackground();

for ( int page = 0; page < 4; ++page )
{
AddPage( 2 + page );

AddButton( 125, 14, 2205, 2205, 0, GumpButtonType.Page, 1 + page );

if ( page < 3 )
AddButton( 393, 14, 2206, 2206, 0, GumpButtonType.Page, 3 + page );

if ( page == 0 )
{
**your info for page 1**
}
if ( page == 1 )
{
**your info for page 2**
}
if ( page == 2 )
{
**your info for page 3**
}
if ( page == 3 )
{
**your info for page 4**
}
public static bool HasSpell( Mobile from, int spellID )
{
Spellbook book = Spellbook.Find( from, spellID );

return ( book != null && book.HasSpell( spellID ) );
}

public override void OnResponse( NetState state, RelayInfo info )
{

Mobile from = state.Mobile;
switch ( info.ButtonID )
{
case 0:
{
break;
}
case 1:
{
new FreezeSpell( from, null ).Cast();
break;
}
case 2:
{
new RestoreSpell( from, null ).Cast();
break;
}
case 3:
{
new IceswordSpell( from, null ).Cast();
break;
}
}

}
}
}

I'm kind of proud of myself for writing that because I don't know any c# :D . The flipper as of now will repeat its cycle until you take out the code under AddIndex. But I need to get that first page gone before I can do that..I don't know why it creates a first page that I cannot place text on, but whatever. Enjoy!
 

Jalister

Sorceror
I'm at work, so I can't try this yet. And I may be way off, since I have not worked on the book yet. Here is my theory about index. You mentioned that you can not add text to the index. Maybe the part where the scroll is added to the book is where you may need to have text go to the index. Again, I may be way off on it, it's just a theory.

Jalister
 

wstsdwgr

Wanderer
Well, unless someone knows how to figure this out, I'm going to put this aside and work on it another time in the future.
 

Jalister

Sorceror
wstsdwgr said:
Well, unless someone knows how to figure this out, I'm going to put this aside and work on it another time in the future.

I am almost where you are. I really want to get this working, but a few problems with the gump are holding me back also.

If anyone can help us get the index page sorted out, and the page turning problem resolved, the rest is already done.

Jalister
 
Top