I wanted to see if I could format the main.agc.tags file to get a 3 column file using AppGameKit, and here's the code to do it:
tagsPath$ = "raw:C:\Program Files\The Game Creators\AGK2\Tier 1\Editor\data\tags\"
tagsFile$ = tagsPath$ + "main.agc.tags"
formattedTagsFile$ = tagsPath$ + "formattedKeywords.htm"
// OPEN THE TAGS FILE AND STORE EACH LINE TO AN ARRAY WHICH IS SORTED ALPHABETICALLY
lines as string[]
file = OpenToRead(tagsFile$)
while (FileEOF(file) = 0)
lines.insert(ReadLine(file))
endwhile
CloseFile(file)
lines.sort()
// OPEN A BLANK HTML FILE AND START WRITING THE LINES STORED IN THE ARRAY TO THE HTML FILE
file = OpenToWrite(formattedTagsFile$)
// ADD CSS CODE AT THE TOP OF THE PAGE TO FORMAT THE PAGE FOR PRINTING
WriteLine(file, "<style>")
WriteLine(file, "@page { size: A4 landscape; }")
WriteLine(file, "dl { margin: 5px; }")
WriteLine(file, "section { width: 90%; margin: auto; column-count: 3; column-rule-style: solid; column-rule-width: 1px; column-rule-color: #cccccc; }")
WriteLine(file, "</style>")
// START BUILDING THE PAGE
WriteLine(file, "<h1>AGK2 Commands</h1>")
WriteLine(file, "<section>")
lastLetter$ = ""
for i = 1 to lines.length
if (left(lines[i], 1) <> lastLetter$)
lastLetter$ = left(lines[i], 1)
WriteLine(file, "<h2>" + left(lines[i], 1) + "</h2>")
endif
WriteLine(file, "<dl>")
functionName$ = GetStringToken2(lines[i], "|", 1)
returnType$ = GetStringToken2(lines[i], "|", 2)
parameters$ = GetStringToken2(lines[i], "|", 3)
parameters$ = ReplaceString(parameters$, "Float", "float", -1)
parameters$ = ReplaceString(parameters$, "Integer", "integer", -1)
parameters$ = ReplaceString(parameters$, "String", "string", -1)
WriteLine(file, "<dt>" + lower(returnType$) + " <span style='color:blue'>" + functionName$ + "</span>" + parameters$ + "</dt>")
WriteLine(file, "</dl>")
next
WriteLine(file, "</section>")
CloseFile(file)
do
if (GetFileExists(formattedTagsFile$))
print("Formatted file created")
else
print("Formatted file not created")
endif
Sync()
loop
I love AppGameKit!
This reads the main.agc.tags file and creates an HTML file with 3 columns, it shows the type the function returns, the function name and the parameters it accepts. When you look at the web page you will see all of the A's in the first column when you scroll down but when you print preview it (landscape) you will see that the A's are on the first page in all 3 columns like a book index page.
You could adapt it even more with CSS styles but the version above creates a basic version. You may want to change the save path to somewhere outside of the AppGameKit install folder.
I noticed that some of the lines are quite long when they have a dozen parameters. You could tidy it up a bit by removing the types against each parameter i.e. changing this:
CreatePulleyJoint(integer iJointIndex, integer iSpriteIndex1, integer, iSpriteIndex2, float gnd1x, float gnd1y, float gnd2x, float gnd2y, float a1x, float a1y, float a2x, float a2y, float ratio, integer colConnected)
to this:
CreatePulleyJoint(iJointIndex, iSpriteIndex1, iSpriteIndex2, gnd1x, gnd1y, gnd2x, gnd2y, a1x, a1y, a2x, a2y, ratio, colConnected)
If so just change these 3 lines to replace the strings with nothing instead of the lower case versions:
parameters$ = ReplaceString(parameters$, "Float", "", -1)
parameters$ = ReplaceString(parameters$, "Integer", "", -1)
parameters$ = ReplaceString(parameters$, "String", "", -1)