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!

Make c# out of uo books in a second (or less)

daat99

Moderator
Staff member
Make c# out of uo books in a second (or less)

30/01/2005 updated acording to post #25

After a lot of problems I started to write a tool that can export a book from uo to a script.
This will make all the rp players out there write their stories and all you admins will be able to make a script out of it in a second or less

You can use it with: [csbook and clicking the book you want to turn into a script.
It'll make a file called Book#.cs in your runuo root folder (where you have your crash reports). The # will increase with each book you export.

Please don't remove the credits from the code, however feel free to add your name if you enhance it.

I'm soooooo happy to be the first script poster for runuo 1.0.0
 

Attachments

  • CSBook.cs
    6.6 KB · Views: 278

daat99

Moderator
Staff member
A_Li_N said:
Quote:
Originally Posted by daat99
I'm soooooo happy to be the first script poster for runuo 1.0.0


*Smacks daat99 across the head*
Damn attachments! I was SOOOO gona be the first!
ROFL :) don't worry you'll be the second :)
 

jjarmis

Wanderer
Hey, daat. Dont u think this would be better if it took the title of the book for the class/constructable instead of book#? I think that with a lot of rp shards they will have so many books that it will be very hard to keep track of them by number. or maybe just have it do by book# if the title is null or is 'title'... Also, you would need to have a feature that would check to see if that book already exists and ask them if they want to write over it. :)

Just a thought
 

daat99

Moderator
Staff member
Well I tried to make it take the title, but since the title had spaces in it it made the script uncompileable :(
 

jjarmis

Wanderer
well, you can just take out the spaces and other punctuation for that matter......

Just loop through all the chars in the string and if they aren't a letter dont add them to your name string.
 

jjarmis

Wanderer
heh I got plans today, but if you are around this evening (US-PST) I'll be more than happy to help u with it.
 

daat99

Moderator
Staff member
I'll take you up on that offer HeHe :)
Also I need your help with some other stuff I have but doesn't realy fit to post in the forums since it don't have errors and it works like it was suppose to (not sure if to be :) or :( about this part)
 

Waverian

Wanderer
First time I've been able to say this in a while, but this is just a great idea... One of those "How didn't I think of it..." things. Haha.

It'd be superb if a player could invoke the command and have it export a file to the user's computer, but to be honest I'm not sure how to go about writing a file to a non-local computer via the server.
 

jjarmis

Wanderer
That would be much harder to do if it is even possible, because the server would have to send info to the client telling it to write the file.
 

jjarmis

Wanderer
daat99 said:
I'll take you up on that offer HeHe :)


Ok so what you want to do is something like this:

Code:
string writetitle = "";

foreach ( char p in ((BaseBook)targ).Title ) //  a string is just an array of chars.
{
  if ( Char.IsDigit(p) )  // Will accept numbers in the class name.
  {
    if ( writetitle != "" )  // As long as the first char in the class is not a number.
    {
      writetitle += p;  // Add this char to the title.
    }
  }
  if ( Char.IsLetter(p) )  // Will accept letters in the class name.
  {
    writetitle += p; // Add this char to the title.
  }
}

if ( writetitle == "" )
{
  writetitle = String.Format( "Book{0}", bookamount );
}
 

daat99

Moderator
Staff member
I'm way too tired to understand it atm :(
I'll hit that when I get back from studies tonight (about 13-14 hours from now).
ThanX tho :)
 

daat99

Moderator
Staff member
ThanX a lot for your help jjarmis :)
Once I get the shard I'm working on ready to go public I'll work on the scripts a bit more :)
 

frozencorpse

Wanderer
I supose just by looking at it, that this script will make what you are trying to Daat, see, its nothing but an engine that put everything together. I was thinking that was not so bad instead of removing the spaces, but make then into "_" underline, got it? that way the tittle istills understandable, if you remove the spaces, it will become like german hehehehehe.
Or, make the first Char of a word Big, like "TestBookForTheCode" got it? I think it will be better. And What you guys will do when the title is read up again to the "book" item? It will come up with that title mix up? Sorry to ask, I haven't download the code yet. :)
 
Top