Hey! That is pretty damn slick. Thanks Uncle Bob!(nt):

[ Follow Ups ] [ Post Followup ] [ Dioxide's CForum ]

Posted by Anti-Pumpkin Boy on October 25, 2000 at 09:05:58:

In Reply to: Merry Halloween! Here's my present: The Role Creator posted by Uncle Bob on October 25, 2000 at 08:44:24:

> Here's a little something I wrote for my peeps. It will convert any amount of normal text, and convert it to a 'Role +' format suitable for the mud.

> 1. Copy the code below BETWEEN the asterisks.
> 2. In Word, create and edit a new macro…paste the code in. (Number of ways to do this, try Tools>Macros>Visual basic editor. Then paste.)
> 3. Write the role.
> 4. Run the macro (Tools>Macro>Macros>RoleCreator)
> 5. Copy and paste the resulting text (the macro puts the text in a new window, so you won't lose your original text) into the mud directly, or try exporting to a text file, and importing that into your favorite client.

> Notes:
> * Don't use carriage returns except where you want blank lines between paragraphs. This macro splits every line with a carriage return, so those of you who love the returns are going to have some big ass roles.
> * The default character count is 60, that is, 60 characters per line. Keep in mind that I check for words and go to the next space, so if you use a lot of flowery words, it may wind up being 65 or so in some cases.
> * The resulting text, after running the macro, is completely editable…I've tried to trim extra spaces and what not, but you'll certainly want to verify.

> If Snarf or someone wants to throw this into a word template, and make it available on their site, feel free.

> And anyone that has comments to the structure of the code can suck my hairy yellow ass, this was a lunch time activity, and I didn't spend time making it efficient or purty. But I could. If someone has the ching to send my way.

> There you have it. I guarantee nothing, I promise everything, I deliver only candy wishes and tangerine dreams. Or something. Good luck.

>
> '*****
> Sub RoleCreator()
> '
> ' Macro recorded 10/24/00 by Uncle Bob
> '

> Dim whole As String, temp As String, nextline As String
> Dim templength As Integer, wholelength As Integer, cutamount As Integer, checkend As Integer, checkreturn As Integer
>
> Windows(1).Activate
> Selection.WholeStory
> Selection.Copy
> whole = Selection
>
> Documents.Add
> cutamount = 60
> temp = Left(whole, cutamount)
> While Not temp = ""
> wholelength = Len(whole)

> ' Check if line ends in the middle of a word
> If wholelength > cutamount Then
> While Not Right(temp, 1) = " "
> cutamount = cutamount + 1
> temp = Left(whole, cutamount)
> Wend
> End If

> ' check if line holds a carriage return, if so, split the line.
> checkreturn = InStr(temp, Chr(13))
> If checkreturn <> 0 Then
> Selection.TypeText Text:="Role + " + Trim(Left(temp, checkreturn - 1))
> Selection.TypeParagraph
> Selection.TypeText Text:="Role +"
> whole = Trim(Right(temp, Len(temp) - checkreturn)) + " " + Trim(Right(whole, wholelength - cutamount))
> Else
> nextline = "Role + " + temp
> Selection.TypeText Text:=Trim(nextline)
> End If

> Selection.TypeParagraph
> templength = Len(temp)
>
> If Not checkreturn <> 0 Then
> whole = Right(whole, wholelength - cutamount)
> End If
>
> temp = Left(whole, cutamount)
> wholelength = Len(whole)
>
> If wholelength < cutamount Then
> cutamount = wholelength
> nextline = "Role + " + temp
> Selection.TypeText Text:=Trim(nextline)
> Exit Sub
> End If
> cutamount = 60
>
> Wend
> End Sub
> '*****

>
> EXAMPLE:
> Rangerboy's role, in a word document, would originally look like this:

> BEFORE:
> Ranger never really knew the city, it was just there, and in the way. It never seemed natural to him, is false sanctity obvious in his mind. All he ever knew was the forest, his home. His life was one of harmony and peace, but it was short lived. The folks of the cities began to intrude into his home, at first not seeking to harm it though. They carelessly walked through, trampling the fox's dens and knocking the bird's nests from the trees. For a while it was hardly any trouble to repair what damage the folks had done, but it was not long before the outsiders began truly to harm the wood.
> Masses of them poured into the wood toting bows and shields, and implements of war, as if to fight some great battle. But all they sought was more for themselves. They needlessly killed the creatures of the wood, often taking only their hides, and leaving their bodies to rot. They chopped down nearly all the trees, not to keep themselves warm for the night, but to burn in massive bonfires, wasting nature's bounty. While hunting to live was the natural way, things had gone too far, and that which he loves was being ravaged all around him. He could only repair their damage so fast, and creating new life was far beyond any power he had.

> And will result in this, after running the macro:

> AFTER:
> Role + Ranger never really knew the city, it was just there, and in
> Role + the way. It never seemed natural to him, is false sanctity obvious
> Role + in his mind. All he ever knew was the forest, his home. His life
> Role + was one of harmony and peace, but it was short lived. The folks
> Role + of the cities began to intrude into his home, at first not seeking
> Role + to harm it though. They carelessly walked through, trampling
> Role + the fox's dens and knocking the bird's nests from the trees.
> Role + For a while it was hardly any trouble to repair what damage
> Role + the folks had done, but it was not long before the outsiders
> Role + began truly to harm the wood.
> Role +
> Role + Masses of them poured into the wood toting bows and shields,
> Role + and implements of war, as if to fight some great battle. But
> Role + all they sought was more for themselves. They needlessly killed
> Role + the creatures of the wood, often taking only their hides, and
> Role + leaving their bodies to rot. They chopped down nearly all the
> Role + e trees, not to keep themselves warm for the night, but to burn
> Role + in massive bonfires, wasting nature's bounty. While hunting to
> Role + live was the natural way, things had gone too far, and that which
> Role + he loves was being ravaged all around him. He could only repair
> Role + their damage so fast, and creating new life was far beyond any
> Role + power he had.


Follow Ups:

Post a Followup

Name:
E-mail:
Subject:
Comments:


[ Follow Ups ] [ Post Followup ] [ Dioxide's CForum ]