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!

[RunUO 2.0] Online Book Code Generator

try deleting the last page from the script and retry opening it ingame.

It could be 511 is the limit, since the gump technically shows 2 pages at once, its really 255 (counting title page as page 0)
 

TheNorthStar

Sorceror
Still the same problem, disconnects me, gives the same warning.

EDIT: here's the full error, I just saw it was in it's own log file.
Code:
Compression buffer overflowed on packet 0x66 ('BookPageDetails') (length=0)
   at Server.Network.Packet.InternalCompile(Boolean compress)
   at Server.Network.Packet.Compile(Boolean compress, Int32& length)
   at Server.Network.NetState.Send(Packet p)
   at Server.Mobile.Send(Packet p, Boolean throwOnOffline)
   at Server.Mobile.Send(Packet p)
   at Server.Items.BaseBook.OnDoubleClick(Mobile from)
   at Server.Mobile.Use(Item item)
   at Server.Engines.XmlSpawner2.XmlAttach.UseReq(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)
 
EDIT: ignore everything else I've said, there is no page limit, there is a CHARACTER limit of 65,535


I made a book with more pages than yours and it worked successfully, however, the majority of the pages were just line breaks.

which leads me to conclude...

its not a page limit, its a character limit.


OK this is in Basebook.cs

Rich (BB code):
public sealed class BookPageDetails : Packet
    {
        public BookPageDetails( BaseBook book ) : base( 0x66 )
        {
            EnsureCapacity( 256 );

            m_Stream.Write( (int)    book.Serial );
            m_Stream.Write( (ushort) book.PagesCount );

            for ( int i = 0; i < book.PagesCount; ++i )
            {
                BookPageInfo page = book.Pages[ i ];

                m_Stream.Write( (ushort) (i + 1) );
                m_Stream.Write( (ushort) page.Lines.Length );

                for ( int j = 0; j < page.Lines.Length; ++j )
                {
                    byte[] buffer = Utility.UTF8.GetBytes( page.Lines[j] );

                    m_Stream.Write( buffer, 0, buffer.Length );
                    m_Stream.Write( (byte) 0 );
                }
            }
        }
    }


http://msdn.microsoft.com/en-us/library/exx3b86w(v=vs.80).aspx

So there is a limit for both pages and characters to 65,535.

Finally, mystery solved.

Now, you can get to the detecting line breaks part :p
 

Felladrin

Sorceror
Thank you, Anti-Basic! That helps a lot!
New update coming soon! :D

Ah, how about the linebreaks? Is that the same problem David noticed? I didn't try to make a book with so many characters yet. It happens even if there's less than 65,535 characters?

Also you think it have to count all the characters after the code is generated, or just characters from the book content? It's not clear for me.
 
the 65,535 is character sin the source text that is being converted. I'm almost positive.

As for line breaks, I don't know what David is talking about, but What I want is a way for the converter to detect linebreaks or indentations, or even blank lines in the source text, and keep them as is in the script. (ie what goes in, comes out) As it stands now, everything is bunched up, and theres no line breaks even where intended.

If its not possible to "Detect" line breaks in the source text you could have the user manually place them where need be with a code of some sort. Like they could add <br> in the source text and the script would know to insert a blank line there.
 

TheNorthStar

Sorceror
Thanks for figuring that out Anti-Basic, I was completely at a loss on that one.
I was also thinking line break detection would be very useful. Then again, my book would have been about twice as long if it had included all of the blank lines I used... hmm.
 

Felladrin

Sorceror
(Update) Version 1.1.0
  • Now there's a limit of 60,000 characters for the book content. (I've tested a book with the 60K characters, and it's working fine, here's a screenshot). This should fix the bug posted by TheNorthStar.
  • Users can now choose (with pictures!) the book cover (itemID), as suggested by Anti-Basic.
  • Users can choose to autoformat the book content or leave it intact (with breaklines, blank spaces and identation), also suggested by Anti-Basic.
  • Autoformat was improved, working fine with tiny and large texts.

Notes:

I didn't use the limit of 65,535 because this is the limit for the complete .cs file, and the book would appear with ~400 blank pages. (Tested)

Unfortunately, I found no way to change the gump of the book.

The 'test drive' version and the bookcodegen with download option are already updated.

I had to add a folder with the images of itemids, so the package is now the html plus this folder. They need to book on the same directory.

You can download the new package on the first post.
 

Attachments

  • fullbook.jpg
    fullbook.jpg
    37.9 KB · Views: 32
  • OBCG1.1.JPG
    OBCG1.1.JPG
    38.1 KB · Views: 25

Irian

Page
Oh, btw: I wrote a book generator for sphere a while ago and afaik, the characters have different widhts, some of them are even bigger than 1/24 line. I simply counted all characters to see, how many of them fit into a line, which allows formatting more precisely and even such nice features as justify texts by inserting spaces automatically.

Perhaps I should write an exporter for RunUO, too... Hm.
 

otimpyre

Sorceror
I ashamed to admit I overlooked this script several times. This is impressive and very useful. Thank you.
 

john burns

Sorceror
I am just wondering, and its probably a simple one, can I run this offline? And what is the password to extract the files?
 
Top