Difference between revisions of "Battle Reports"

From BattleMaster Wiki
Jump to navigation Jump to search
Line 50: Line 50:
 
s = ActiveDocument.Content                  ' Resets s to include only the content that remained
 
s = ActiveDocument.Content                  ' Resets s to include only the content that remained
  
Dim SearchWord2
+
Dim SearchWord2 As String
 
SearchWord2 = "<script"
 
SearchWord2 = "<script"
 
                
 
                
Line 60: Line 60:
 
' Create a 2 dimensional Array which holds all values which needs_
 
' Create a 2 dimensional Array which holds all values which needs_
 
' _ to be replaced + their replacement values
 
' _ to be replaced + their replacement values
Dim ReplaceArray(0 To 11, 0 To 1)
+
Dim ReplaceArray(0 To 13, 0 To 1)
 
ReplaceArray(0, 0) = "<Char"
 
ReplaceArray(0, 0) = "<Char"
 
ReplaceArray(0, 1) = "<"
 
ReplaceArray(0, 1) = "<"
Line 96: Line 96:
 
ReplaceArray(11, 0) = "#004000"    ' Background color of the combat tables (the green, making it lighter)
 
ReplaceArray(11, 0) = "#004000"    ' Background color of the combat tables (the green, making it lighter)
 
ReplaceArray(11, 1) = "#116811"
 
ReplaceArray(11, 1) = "#116811"
 +
 +
ReplaceArray(12, 0) = "#DDDDDD"      ' Change the light color for woundings/captures to bright red
 +
ReplaceArray(12, 1) = "#FF0000"
 +
 +
ReplaceArray(13, 0) = "#E0E0FF"      ' Change the light color for 'banners visible' to black
 +
ReplaceArray(13, 1) = "#000000"
 +
 +
ReplaceArray(13, 0) = "#C0FFC0"      ' Change the light green for defenders victory to bright green
 +
ReplaceArray(13, 1) = "#00FF00"
 +
  
 
' For each Value loop through it and replace it with it's replacement text
 
' For each Value loop through it and replace it with it's replacement text
Line 123: Line 133:
 
     Next i
 
     Next i
  
End Sub</pre>
+
End Sub�</pre>
  
 
==By:  [[Peter Kolak]]==
 
==By:  [[Peter Kolak]]==

Revision as of 22:39, 7 March 2018

Addendum by Gabanus

The below pieces have formed the inspiration of what I will share here, but were already outdated again. Nonetheless respect and thanks to Peter Kolak in particular for posting the original piece.

If you want to take a battle report and post it on a website (or the wiki), here's what you have to do:

A. Open a new Microsoft Word File

B. Make sure you have developer mode enabled and preferably added to your ribbon site on how to do this

  1. Click on the developer tab
  2. Click on Visual Basics
  3. Click on insert - Module
  4. Copy following code inside the module
  5. File - Save document -> As File type below the name, pick 'Word Macro - Enabled Content' (both file and the Macro code will be saved together)

C. To make the battle report

  1. you must view a battle report via your scribe report
  2. Click on "View Source" (Paginabron for you Dutchies)
  3. Select the entire source by mouse or use "Ctrl A"
  4. Copy the source by either right clicking and pressing "Copy" or using "Ctrl C"
  5. Open the word document you created earlier
  6. Right click and select "Paste text only" --DON'T JUST NORMALLY PASTE IT, HAVEN'T FIXED THAT PART YET--

  7. Click on the 'Developer tab' in the word document
  8. Click on Macros (next to Visual Basics)
  9. Select the 'BattleConverter' Macro (should be your only one anyway) and click on run

  10. Select all text in the document by mouse or use "Ctrl A"
  11. Open the Wiki page where you want to show the battle report
  12. Copy the text by either right clicking and pressing "Copy" or using "Ctrl C"

Code to paste in module:

Sub BattleConverter()

' Remove first section of the text
Dim s
s = ActiveDocument.Content              ' Selects everything (ctrl 'a' basically)

Dim SearchWord1 As String               ' Sets/Defines variables needed for the indexOfThey formula. Easier to change when needed
SearchWord1 = "</center>"

Dim IndexOfSW As Long                ' Returns the location (as number) where the SearchWord1 is first seen
IndexOfSW = InStr(1, s, SearchWord1)

' Deletes everything from start untill first letter of search word + length of word (which includes a potential space after the word)_
' _ + 3 because the 4 characters after the words must be removed as well
ActiveDocument.Range(Start:=0, End:=IndexOfSW + Len(SearchWord1) + 3).Delete

' Remove the last section of text that's not needed
s = ActiveDocument.Content                  ' Resets s to include only the content that remained

Dim SearchWord2 As String
SearchWord2 = "<script"
               
IndexOfSW = InStr(1, s, SearchWord2)        ' Returns the location (as number) where the SearchWord2 is first seen

' Deletes everything from first letter of search word (- the first letter and <br/> before it) untill the end of the document
ActiveDocument.Range(Start:=IndexOfSW - 6, End:=Len(ActiveDocument.Content)).Delete

' Create a 2 dimensional Array which holds all values which needs_
' _ to be replaced + their replacement values
Dim ReplaceArray(0 To 13, 0 To 1)
ReplaceArray(0, 0) = "<Char"
ReplaceArray(0, 1) = "<"

ReplaceArray(1, 0) = "</Char"
ReplaceArray(1, 1) = "<"

ReplaceArray(2, 0) = "< "
ReplaceArray(2, 1) = "<"

ReplaceArray(3, 0) = "<p>"
ReplaceArray(3, 1) = "<br>"

ReplaceArray(4, 0) = "#000032"  ' Background First table with general overview from dark blue to light gray
ReplaceArray(4, 1) = "#DEDEEA"

ReplaceArray(5, 0) = "#FFFFFF"  ' White text to black (note to self: If you highlight own char as white, it's also changed making it harder to read)
ReplaceArray(5, 1) = "#000000"             '#9696FF blue

ReplaceArray(6, 0) = "color: white" ' Some text color wasn't assigned by Hex colors, but through this code (mixed within the code)
ReplaceArray(6, 1) = "color: black"

ReplaceArray(7, 0) = "<P>"
ReplaceArray(7, 1) = "<br>"

ReplaceArray(8, 0) = "<>"
ReplaceArray(8, 1) = ""

ReplaceArray(9, 0) = "</FONT<"
ReplaceArray(9, 1) = "</FONT><"

ReplaceArray(10, 0) = "> "          ' Some sentences started with a space because there was a space after certain parts of the code. Looked weird
ReplaceArray(10, 1) = ">"

ReplaceArray(11, 0) = "#004000"     ' Background color of the combat tables (the green, making it lighter)
ReplaceArray(11, 1) = "#116811"

ReplaceArray(12, 0) = "#DDDDDD"      ' Change the light color for woundings/captures to bright red
ReplaceArray(12, 1) = "#FF0000"

ReplaceArray(13, 0) = "#E0E0FF"      ' Change the light color for 'banners visible' to black
ReplaceArray(13, 1) = "#000000"

ReplaceArray(13, 0) = "#C0FFC0"      ' Change the light green for defenders victory to bright green
ReplaceArray(13, 1) = "#00FF00"


' For each Value loop through it and replace it with it's replacement text
Dim i As Long, j As Long

    For i = LBound(ReplaceArray) To UBound(ReplaceArray)
    
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting

    With Selection.Find
        .Text = ReplaceArray(i, 0)
        .Replacement.Text = ReplaceArray(i, 1)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        
    End With
    Selection.Find.Execute Replace:=wdReplaceAll


    Next i

End Sub�

By: Peter Kolak


If you want to take a battle report and post it on a website, here's what you have to do:

A. Taking the scribe report and putting it in Word.

  1. First, you must view a battle report via your scribe report.
  2. Click on "View Source".
  3. Copy the source by either right clicking and pressing "Copy" or using "Ctrl P".
  4. Open up a Word Document.
  5. Right click and select "Paste" or simply type "Ctrl V".


B. Editing the text for the web page. Use "Find and Replace" and follow the next 13 steps.

  1. Replace "<Char" with "<".
  2. Replace "</Char" with "<".
  3. Replace "<_" with "<". (Where as "_" is equal to ONE blank space.)
  4. Replace "<^#^#^#^#^#>" with "". (Meaning, don't replace it with anything, just leave the replace section blank.
  5. Replace "<^#^#^#^#>" with "".
  6. Replace "<^#^#^#>" with "".
  7. Replace "<^#^#>" with "".
  8. Replace "< p >" with "< br >" (There are no spaces between the "<" and the "p".
  9. Replace "#DDDDDD" with "#00FFFF".
  10. Replace "#FFFFFF" with "#FFDD11".
  11. Replace "#E0E0FF" with "#FF00DD".
  12. Delete top several rows that contains header information.
  13. Delete very last info: "</Body></HTML>".

C. Preview and make sure it looks good.

Peter Kolak

Addendum by RubyDragon

Having used these steps quite often in the Falasan Inquirer, I found them to be incredibly useful, but here are some modifications which will help fix some of the bugs I found.

A. -no change

B. Editing the text for the web page. Use "Find and Replace" and follow the next 13 steps.

  1. Replace "<Char" with "<".
  2. Replace "</Char" with "<".
  3. Replace "<_" with "<". (Where as "_" is equal to ONE blank space.)
  4. Replace "<^#^#^#^#^#>" with "". (Meaning, don't replace it with anything, just leave the replace section blank.
  5. Replace "<^#^#^#^#>" with "".
  6. Replace "<^#^#^#>" with "".
  7. Replace "<^#^#>" with "". (never found any of these myself)
  8. Replace "< p >" with "< br >" (There are no spaces between the "<" and the "p".
  9. Replace "#DDDDDD" with "#00FFFF".
  10. Replace "#FFFFFF" with "#FFDD11".
  11. Replace "#E0E0FF" with "#FF00DD".
  12. Delete top several rows that contains header information. Delete everything above and including the following phrase found near the beginning "Scribe Note, X turns old:"
  13. Delete very last info: "</Body></HTML>".
"
</BODY>
</HTML><script language='javascript'>postamble();</script>"

RubyDragon's Additions
After doing B (with modifications, carry out the following:

  1. Replace "<>" with "".This removes all those odd "<>" speckling the report
  2. Replace "</FONT<" with "<" I noticed that if this weren't done, after a certain point all writing became yellow)
  3. Preview the battle report. You should notice a near the top. It is located after the "Scribe Note: Battle in XXXYYY", immediately behind "FormationCS"

C. Preview, make sure it looks good, and edit out anything that looks weird.

Addendum by Ceorl

  1. Replace "</FONT<" with "<".
  2. Replace "< p >" with "< br >". (There are no spaces between the "<" and the "p".
  3. Replace "< /p >" with "". (There are no spaces between the "<" and the "/p".
  4. Replace "<Char" with "<".
  5. Replace "</Char" with "<".
  6. Replace "<_" with "<". (Where as "_" is equal to ONE blank space.)
  7. Replace "<>" with "".
  8. Replace "white" with "black".
  9. Replace "#DDDDDD" with "#DC143C"
  10. Replace "#FFFFFF" with "#00008B"
  11. Replace "#E0E0FF" with "#A52A2A"
  12. Replace "#C0FFC0" with "#00008B" (This is for Defender Victory)
  13. Replace "#FFC0C0" with "#DC143C" (This is for Attacker Victory)
  14. Replace "#E0FFFF" with "#00008B"