Difference between revisions of "Help:Editing"

From King Arthur's Gold Wiki
Jump to: navigation, search
m
 
(One intermediate revision by the same user not shown)
Line 19: Line 19:
 
If you understand logics, this should be a piece of cake for you.
 
If you understand logics, this should be a piece of cake for you.
 
We've got a Parser Functions plugin that helps with a lot of neat stuff. Read on about how it does magic in [http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions the official help page]. Some of the functions are used quite a bit all around the wiki, so it's at least good to know what they are.
 
We've got a Parser Functions plugin that helps with a lot of neat stuff. Read on about how it does magic in [http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions the official help page]. Some of the functions are used quite a bit all around the wiki, so it's at least good to know what they are.
 +
 +
=Using Syntax Highlighting for Code=
 +
 +
King Arthur's Gold uses a number of different file extensions and programming languages. Many of the configuration files have the .cfg file extension. In Classic KAG, the scripts files are written in [http://www.gmscript.com/ Game Monkey Script] and have .gm as a file extension. Premium / Scripting KAG uses [http://www.angelcode.com/angelscript/ Angelscript] with the .as file extension. When you paste code on the wiki, you want people to be able to easily read it and pick out the important bits. This can be accomplished by using <nowiki><syntaxhighlight></nowiki> tags. To use syntax highlighting, place <nowiki><syntaxhighlight lang="x" enclose="div"> before your code. Paste your code, then place </syntaxhighlight></nowiki> after your code. To choose how to highlight the code (which words are colored and/or bold) replace x with a code from [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages this list]. The enclose tag just makes sure that the text is help inside the div and doesn't overflow out and look all ugly. Uunless you can find more suitable languages (please update this if you do), the languages to use for syntax highlighting are C++ (lang="cpp") for .gm and .as files and INI (lang="ini") for .cfg files.
 +
 
   
 
   
 
   
 
   

Latest revision as of 07:18, 15 December 2012

So you want to contribute to the mighty source of knowledge about everything KAG, but don't know how to? Fasten your seatbelt and get a drink of patience. You're about to learn it all.

Before you read on, keep in mind we require adequate knowledge of English. Proper grammar, punctuation and common sense are a must to have if you want to produce quality content.

KAG wiki runs on the MediaWiki engine, which is also used by Wikipedia. If you already have experience editing Wikipedia (or anything else running MediaWiki), very nice, you can skip the next step. Read everything else though, as there is more to tell about kagwiki infrastructure.


Basics

First of all, you will need to get yourself familiar with the mediawiki syntax. Here is the official help page. Good, now you know about basic wiki markup and should not be confused by random symbols everywhere. When you are done with that, continue to the Advanced editing guide. You will probably not need everything listed on that page, but it's good to at least get yourself familiar with it. You should at least know what's possible and what's not, the page will always be there if you want to check the exact commands later on. You should at least acknowledge the existence of links, redirects and categories. Next, read how tables are marked up. You will also need to know HTML basics and how CSS styles work. This is common knowledge anyway, and you should feel good for learning it. Here's a tutorial Mr Google found for me on CSS. If you think this is too much to digest at a time, it's probably good to take a break. Don't get burnt out. Good. Now you should either be asleep or craving for more wiki stuff. Don't get too triggerhappy though, there's still a lot to learn before you get to the real stuff.


More advanced stuff

If you understand logics, this should be a piece of cake for you. We've got a Parser Functions plugin that helps with a lot of neat stuff. Read on about how it does magic in the official help page. Some of the functions are used quite a bit all around the wiki, so it's at least good to know what they are.

Using Syntax Highlighting for Code

King Arthur's Gold uses a number of different file extensions and programming languages. Many of the configuration files have the .cfg file extension. In Classic KAG, the scripts files are written in Game Monkey Script and have .gm as a file extension. Premium / Scripting KAG uses Angelscript with the .as file extension. When you paste code on the wiki, you want people to be able to easily read it and pick out the important bits. This can be accomplished by using <syntaxhighlight> tags. To use syntax highlighting, place <syntaxhighlight lang="x" enclose="div"> before your code. Paste your code, then place </syntaxhighlight> after your code. To choose how to highlight the code (which words are colored and/or bold) replace x with a code from this list. The enclose tag just makes sure that the text is help inside the div and doesn't overflow out and look all ugly. Uunless you can find more suitable languages (please update this if you do), the languages to use for syntax highlighting are C++ (lang="cpp") for .gm and .as files and INI (lang="ini") for .cfg files.


Level 18 - Templates

Most of the KAG wiki infrastructure is built around templates. You will have to comprehend how they roll in order to not break things. Here's the official mediawiki help page. Again, you will not need everything listed there, but read the whole page anyway. If you feel that you didn't learn anything, read it again and look at some examples (conveniently coming up right below). Most times templates are used to insert a block of information into several pages without writing it all again multiple times. You could think about it as a link of sorts. You insert a small line into a page and it automatically substitutes that with predefined data stored in a template. One of the most common templates on KAG wiki is the Stub template. You can see its code by pressing on the "Edit" tab.

<div class="infobox"> means that we're marking up a certain section of a page, a little box in our case.

class="infobox" means that this box uses the predefined "infobox" style that only admins can set in the global wiki CSS file.

Feel free to look up some styles in there, but don't get too carried away unless you know CSS. If you are confident we need a new CSS style, contact an active Wiki admin.

<includeonly> and <noinclude> are explained here.

[[Category:Needs_Content]] adds every page that includes this template.

{{#if: {{{Info|}}} | {{{Info}}} | Additional content needs to be added.}} is a switch that changes the box's content if it's called with a custom argument.

You can see that this mess of a code creates a neat looking box. Thanks to templates we don't have to input all of the code every time, we can just write {{Needs_Content}} in the beginning of a page and it will automatically be substituted with the box. The page will also be added to the "Needs Content" category.


KAG objects, blocks, etc

All the vital data in KAG wiki is stored in templates. This includes block, object and construction data. If you look at the Bedrock page, you will see a little table on the right. However, the page source only contains a single line where that table should be: {{Bedrock|Block_overview}}

This line takes the Bedrock data template and outputs it through the Block Overview template. The Bedrock template is just a simple data record:

{{{{{1}}}|{{{2}}}
|Name=Bedrock
|Full image=[[File:Bedrockblock1.png]] [[File:Bedrockblock2.png]] [[File:Bedrockblock3.png]] [[File:Bedrockblock4.png]] [[File:Bedrockblock5.png]] [[File:Bedrockblock6.png]] [[File:Bedrockblock7.png]]
|Part image=[[File:Bedrockblock7.png]]
|Hits=Can only be broken with [[Bomb|bombs]] or a [[keg]]
|Yields=[[Boulder (ammo)|Boulders]]
}}<noinclude>[[Category:Data]][[Category:Templates]]</noinclude>

Every line corresponds to a property, and all block data templates look like this. If you need to create a data record about a new block type, copy an existing one and replace the information (name, images, etc etc). Buildable blocks have construction costs and function associated with them, and objects are even more different, but it should all make sense after you think about it for a bit.

Now the Block Overview template is a bit more complex, as it is made to work with different data templates that might be missing some info. You could call it a functional template i guess, since it takes some data, formats it and outputs in a form of a table. If you don't know how exactly it works, don't touch it. You should acknowledge its existence and know that the little tables don't just appear out of nowhere. Object Overview is very similar in that it takes a data template and spits out an overview table. Blocks and objects are quite different from each other, so we have separate templates for them. There's also Workshop Overview, which obviously makes a similar table about a workshop. This should be a comprehensive list of all data templates: Category:Data

If you look at the Blocks page, you will see two tables. If you look at the page source however, you will see that each line of the table is generated with a template in a similar way to the overview boxes. {{Bedrock|Blocks}} feeds the Bedrock data through the Blocks template, generating a single line of the table. This lets us add new lines to the table fast, as we don't have to write up all the markup and data every time. Better yet, all the relevant info about each block is stored in one place so we only need to edit it once if it changes.


This should be most of the information you'll need to get started. If i missed something, or you just need a more detailed explanation, feel free to ask in this thread. I'll try to keep this post updated.


Shout outs go to citricsquid, Illu, Hapistorique, Wyeth, Labla, FliesLikeABrick and everyone else who worked on the backbone of the wiki, as well as to all the content creators, ParaLogia, Raron, trelawney/n2j3, Downburst/PQ to name a few (sorry if i missed anyone xoxo).