Worst-case scenario: the UEd Goblin wipes the map and burns down your house.
The Class Wikifier takes an UnrealScript class script and produces the bare bones of a wiki page.
To use it:
- The top box contains an example class: highlight it all replace with the script you want to process
- hit the button
- select all the text in the bottom box, copy & paste to a Wiki page
It currently produces:
- the header block (but you'll need to fill in the hierarchy, as the wikifier can only determine the parent)
- 2 lists: public & private variables. UnrealScript comments are kept as descriptions.
- it handles array declarations (eg float) but could the output be made neater?
- group the variables, ie given var(foo), group by foo
- create a list of functions with name, return type, and parameters.
The Class Wikifier is by tarquin, built on Mychaeel's Wookee Playground perl script. Any mistakes are tarquin's fault :D.
Split line var declaration
// Type A var() bool one, // the first one two; // the seocnd one
Is the following also possible?
// Type B var() bool one // the first one, but no comma .... yet , two; // the seocnd one
Mychaeel: Absolutely. Line breaks are just another form of whitespace, and the parser doesn't care about whitespace between tokens. (Maybe that'd be the best approach for the Wikifier too.)
Tarquin: My problem is how to decide which variable name the comment belongs to.
Fixed, I think:
#exec Texture Import File=Textures\S_FluidSurf.pcx Name=S_FluidSurf Mips=Off MASKED=1 class FluidSurfaceInfo extends Info showcategories(Movement,Collision,Lighting,LightColor,Karma,Force) native noexport placeable;
- expands / extends
- multi-line class and var declaration
Obviously, my split on /\n/ was too simple. Here's work in progress on an atomiser:
# split to atoms # remove comments $textProcessed =~ s[/\*.*?\*\/]gs; # blocks $textProcessed =~ s[^//.*\n]gm; # solo lines # exec lines $textProcessed =~ s[^\s*\#exec.*\n]gm; # mark end of comments $textProcessed =~ s[(//.*)$][$1\*/]mg; # find & mark the end of atoms $endTag = '/*END*/'; # safe, since /**/ pairs already gone $textProcessed =~ s[;\s*$][;$endTag]gm; # a ; ending $textProcessed =~ s[;.*//(.*)$][; //$1 $endTag]gm; # a ; // comment ending # remove mid-atom newlines $textProcessed =~ s[\n]g; $textProcessed =~ s[\Q$endTag\E][\n]g; #wahey! I've learned how to use \Q\E! # now each code atom is a single line @classLines = split( /\n/, $textProcessed );
Wormbo: Mistakes such as the naming conventions... :rolleyes: the Hidden variable is not "private" (as in "accessible from this class only"), it's just not visible in UnrealEd. Also the class line is not parsed into the wiki class definition if it contains class modifiers on the same line. Other than that it's really helpful. :)
Tarquin: Oops. Yeah, I knew about "private" being wrong, but by the time I notices I was all perled out. Should it be "Non-editable" instead of private? And drat, I forgot class modifiers. :( Expect version 2 soon ...
Tarquin: Fixed "hidden", class declaration bugs (single-line and modifiers)
Wormbo: Looks like the EnhancedItems.PickupPlus class is a really heavy task for your script. It seems that your for the script lines end after a newline in a comment, but in UnrealScript a newline only ends the comment, not the line of code. Notice how e.g. bRenderOverlays or bIsJumpBoots don't appear in the wikified output. Also, how about displaying the variable type
Tarquin: I didn't know that was possible!
class<ClassName> is a neat idea. I'll get onto both. The parent didn't appear for your class because I can never remember which of extends / expands is used now.
var() bool one, // the first one two; // the seocnd one
Tarquin: Yeah, fish. It's hard work making up variable names.
ZxAnPhOrIaN: Its reallllly easy... *two hours pass* how 'bout Zxan!
DJPaul: Extends is now used in UT2003 (i.e. warfare) builds of the engine.. older versions use either.
Also, after this works like a charm, you should make a script that you can feed a list of ALL the UT2003 .uc's in at once, and make it batch you a lot of pages - save a lot of people doing each individuall =)
Tarquin: A sort of Wiki-UnDox you mean? "Extends" is fixed in my current version. I just always forget which one is deprecated.
DJPaul: Yes -basically you make another script that feeds in text from all UT2003 classes, then this script creates many pages for us. Result - instant, total, complete class listing, reading for comments! (you could include those sections too)
Tarquin: The file-reading & page-writing is beyond my abilities. I'm not sure that creating hundreds of pages is a good idea. I'd rather we only create class pages when there's new information to be added to them.
Aphelion: I don't know if you built the wikifier to cope with enumerators, but it certainly doesn't cope with them when they have comments inside the decleration.
Wormbo: Please don't use the wikifier yet, at least not without checking the results first. I've seen several UT2003 GameInfo (sub)class pages which don't look very complete to me.
BTW: I prefer the float PropertyName format (which is already used throughout the Wiki) instead of PropertyName (float) which is too function-like for my taste.
Tarquin: Nope, it doesn't do enums. (arg! comments in declarations everywhere!). The problem with putting the type first is that the list can't be alphabetized.
Aphelion: Wormbo, I only picked up this error on the last class I did which was WeaponFire. I'll go back through the stuff I did and check and pretty it up and correct it all. As for it not being too complete, well you're damn right. However, I don't see anyone else rushing to fill out those classes, and I have little time to devote to coding as it is...
Wormbo: Tarquin, you could try sorting it first and then add the types. (or move them to the front)
Tarquin: Now handles var groups. :D As for how to display the type of vars in property lists, that's on Guidelines On General Style
Tarquin: It now handles wormbo-style comments & var-defined enums. This, however, has broken the alphabetical sorting. Will fix later.
Wormbo: Partly. After such a "wormbo-style" variable declaration I have this:
// message displayed when killing with a head shot // The message should respond to the Switch parameter in the following way: // 1 = Player is killer // 2 = Player is victim // 3 = Player killed self // (Botpack.DecapitationMessage will always be displayed for killer and victim.) var() class<LocalMessage> HeadShotMessage; var() bool bCanHeadShoot, // has special head shooting abilities (more damage, different death message) bConstantSplashDamage; // causes the damage in the outer splash area
- bool different death message)*/
- bool bConstantSplashDamage
- causes the damage in the outer splash area
It seems like it doesn't handle
class<foo> and has problems with "," in comments?
Tarquin: Problem with class<foo> is that it's looking for word characters: I'll fix that. Commas in comments? Arg! But I'm splitting the string on ","! (I think I've thought of a way to fix it though)
Wormbo: Some properties are missing when I use EnhancedItems.EnhancedWeapon as input.
Tarquin: Got it :)
Wormbo: Hmm, UT2003's Mover class breaks the enum parser. Also you shouldn't mess with the group names' capitalization. (i.e. keep "MoverSounds" instead of changing it to "Moversounds")
Mysterial: It seems to be losing the data type for array declarations, e.g.
var name CrouchAnims;
Which for larger classes (like Pawn) can be a pain to go through and fix.
Tarquin: yeah... I've not dealt with this in ages & it's buggy. If anyone wants to take over the maintenance from me.... :)
Pingz: Is it a perl cgi script? I haven't done any perl stuff in a while, but i would kill for the ability for function processing in the wikifier. I guess i'll give it a try.
Tarquin: yes, it's perl. I'll email you the script. :) be warned, it's not very elegant. and as pointed out above, it has problems dealing with certain cases. UnrealScript Grammar might help.
Pingz: I've made a few simple improvements today. Should i add a link to the in development version for some testing ( more than what i already did ) or should we just update the existing one when there are a few improvements? How can i update it or should i just send it to you Tarquin?
Tarquin: Just mail me it and I'll replace the current version.
Pingz: What i'll do is get functions in there then i'll send it to you. It will probably be a couple of days before i get that in there anyway.