MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "Terrain",
        "continue": "gapcontinue||"
    },
    "warnings": {
        "main": {
            "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes."
        },
        "revisions": {
            "*": "Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
        }
    },
    "query": {
        "pages": {
            "8": {
                "pageid": 8,
                "ns": 0,
                "title": "Rendering and Shaders",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "== Converter Tool ==\n\nNOTE: The Converter replaces the MAX script plugin for exporting units.  The converter can accept FBX files from most 3D tools.\n\nValid map slots to be used are Diffuse, Specular Colour, Glossiness, and Bump (which is the normal map).  The exporter should correctly handle baked materials.  The maps are available in the game shaders in the following order in samplers [0-3].\n\n Diffuse\n Normal\n Specular\n Gloss\n\n=== Tool Controls ===\n\n Hold LMB - rotate camera\n Hold RMB - pan camera\n Mousewheel - zoom (+SHIFT for faster)\n RETURN - reset camera\n L - cycle through lights\n SPACE - toggle camera light\n F1 - reload shaders\n F2 - take screenshot\n A - toggle animations\n B - toggle animation blending with >1 anim selected\n I - toggle info display\n F8 - single step animation\n P - reseed shader random values (shield variation, etc)\n 0-9 - set the shader values from the config file (see below)\n UP/DOWN - walk through higher numbered shader values\n LEFT/RIGHT - change texture set\n\n SHIFT+Click on texture button to clear texture from it\n SHIFT+Click on animation list goes from one to the other\n\n=== Animations ===\nIf there is a suitably formatted animation file in the same folder as the mesh then the animations will be shown in a list.  The chosen animation will be looped.  If you hold SHIFT when clicking an animation it will then loop both that animation and the last animation chosen without SHIFT down, blending between them.  This is for blend testing mainly and should generally not be used - once turned on it cannot be turned off without restarting the tool.\n\n=== Batch Processing ===\nThe batching processing allows for multiple files to be loaded, optionally have the current textures applied, and then saved out.  Both FBX and S4F files can be processed.  Once processed the files are exported to an S4F with the same name (so if processing an S4F file, then original file will be over-written).  By default the currently applied textures in all 4 slots are applied to the model once loaded.  If you hold down SHIFT when clicking the Batch Processing button then this will not happen and the model will simply be imported and then exported as an S4F.  If you hold down CONTROL when clicking on the Batch Processing button the model will be imported, optimised (as per the Optimise button at the bottom of the panel, removing unused nodes) and re-exported as an S4F.\n\n=== CONFIG File ===\nIf a CONFIG.TXT file is found in the same folder as the EXE, it can contain the following:\n\n==== Shader Path ====\nMust be at the top of the file, optional.  Points to a folder where a CORE/SHADERS folder exists, allowing you to point the tool to the shaders being used by (e.g.) your game data.\n\n <code>COREPATH C:\\development\\mygame\\</code>\n\n==== Shader Values ====\nYou can set up values which will be passed to your shaders.  These are to allow mimicking of shader operations which game code may be pushing.  They are 4 values which are passed into the shader in register 30 of both the VS and PS.  These are integer values.\n SHADERVALUE<N> <X> <Y> <Z> <W>\ne.g.\n SHADERVALUE0 1 0 3 99\nThe N value can be 0 to 63.  Apply a given value with the 0-9 keys, or UP/DOWN.\n\n==== Info Display Size ====\n CUBESIZE <float size>\nThe size of the cube and axis indicators shown when you select an object in the frame list.  Default size is 1.\n\n==== Find Textures ====\nFor tools which do not have standard texture naming or placement you can set up automated searches for normal or specular textures.  Use the following format:\n\n <code>FINDNORMAL <postfix>\n FINDSPEC <postfix></code>\n\nWhere postfix would be something like _normal where textures are named (e.g.) main.dds, main_normal.dds, etc.\n\n==== Texture Paths ====\nMultiple texture paths which are searched in order for any textures\n\n <code>[TEXTURES]\n PATH <texturePath>\n PATH ...</code>\n\nNOTE: Texture sets are assumed to be in subfolders, with naming of TEXTURE1, TEXTURE2 etc.  Note that the tool will only look for subfolders numbered [1,30].\n\n==== Lights ====\nMultiple lights can be set up, each light must be a triplet of direction, colour, and ambient\n\n <code>[LIGHTS]\n DIRECTION <vector>\n COLOUR <hex>\n AMBIENT <hex>\n \n DIRECTION ...</code>\n\nAn example CONFIG file is\n\n <code>[TEXTURES]\n PATH C:\\DATA\\BATTLE\\UNITTEXTURES\n PATH C:\\DATA\\TEXTURES\n \n [LIGHTS]\n DIRECTION 0 -1 0\n COLOUR FFFF0000\n AMBIENT FF003300\n \n DIRECTION 1 0 0\n COLOUR FFFFFF00\n AMBIENT 0</code>\n\n== Default Shaders ==\nThe system loads and uses some specific default shaders for specific types of rendering from CORE/SHADERS.  These are:\n\n screenrgba.txt\n font.txt\n grey.txt\n screenrgba_solid.txt\n\nThe above shaders are used for standard UI object rendering and font drawing, and will generally not be changed by the user.\n\n lit.txt - draw standard lit objects (lit via normals)\n prelit.txt - draw prelit objects (vertex colour stored in vertex data)\n normal.txt - draw objects with normal mapping (vertex data includes tangent space info)\n lit_skin.txt - draw as per lit.txt but with hardware skinning\n normal_skin.txt - draw as per normal.txt but with hardware skinning\n\nThese shaders are generally the ones that you will customise to your specific workflow and texture setups.\n\n== Custom Shaders ==\nCustom shaders can be used in two ways.  Either include a new shader in the base SHADERS folder and use the tool to apply it to the applicable meshes.  This however can be fiddly if you have combined shader types (e.g. skinned/non-skinned) and requires you to create versions in the 1 folder for shadowing.\n\nA simpler approach is often to use the Style system.  To create a new style you add a numeric folder to the SHADERS folder (note that style 1 is always used for shadow generation).  So for example, if you wanted a specific type of normal-mapped skinned shader you would create a new folder, say 5, and copy in your default normal_skin.txt shader file.  You then alter the 5/ version as desired.  Then you can use the numeric buttons in the tool to apply a style to a given model and save it out.  Note that if a shader cannot be found in the style folder then the system will fall back to using the default version.\n\n== Shader input data ==\nWhen writing shaders, the following vertex shader registers can be assumed to be filled\n\n*world matrix c0\n*view matrix c4\n*projection matrix c8\n*WVP combo c12\n*light data (dir, colour, ambient, fill colour)  c16\n*world Normal matrix c20 [DEPRECATED: Use c0 and ignore/zero translation elements]\n*shadowmap lighting trx combo c24\n*camera position vector c28\n*camera look vector c29\n*C30 is sometimes used to store 4 pseudo random (integers as floats) numbers constant for a given instance of a mesh (e.g. per unit currently)\n*c31 fogging.  xyz are the RGB values, w is start + (65536*end).  Decoding example below.\n*c32 assume all past here are bones\n\nregisters 16,28,29,30,31 are duplicated into the pixel shader.  As well as some others.\n\n* text colour when rendering fonts c0\n* shadow projection matrix c4\n* shadow texture half pixel size c20\n* modal data for pixel shaders c32 (implementation specific)\n\n\n\n\n=== Fogging Decode Example ===\n\n <nowiki>\t\n\n\tfloat4 fog : register(c31) ;\n\n\t...\n\n\tfloat start, end ;\n\tfloat a, dist;\n\n\tend = round(fog.w/65536.0) ;\n\tstart = fmod(fog.w, 65536.0) ;\n\t\n\tdistV = In.drawPos - gEyePos.xyz ;\n\n\tdist = length(distV) ;\n\ta = dist ;\n\ta -= start ;\n\ta = a/(end-start) ;\n\ta = saturate(a) ;\n\t\n\toutputColour.xyz += a * fog.xyz ;</nowiki>\n\n\n== Post Processing ==\nTo apply post processing you need to create .txt files in DATA/GFX with the following format\nID <id>  // must be [1,255] zero is invalid\n\n <nowiki>// first pass\n[0]\nSHADER <shader file>\nTEX0 <texture file> // optional, allowed 4 textures\n\n// optional additional passes [1], etc up to 8 passes allowed\n</nowiki>\n\nThe ID is used to determine where the post processing happens.  It can be applied to a UI object on its root object using a POSTPROCESS <id> tag.\n<b>NOTE</b>Currently all post processing happens to the entire screen, so be aware when applying to UI objects.\n\nFor the Tile flavour, there are special ID values which cause their Post Process to be applied.  They are\n + 99 - applies the post process globally after all UI has been rendered (does not affect the mouse)\n + 100 - applies the post process to the battle view\n [Note: the lighting file can include a CLUT entry with a texture filename.  If this is included, then the named texture is pushed into the last texture on the last pass for the battle view post process shader, so available on sampler s4]\n CLUT <texture name> // no extension needed\n + 101 - applies to the battle view in the same way as above, BUT applies before the UI icons are rendered.\n\nGenerally flavours will keep values above 99 for system and automated use.\n\n=== Shader Details ===\nShaders must be in the DATA/GFX/SHADERS folder. Post Process shaders are applied across the entire screen, and so their shaders will look very similar to the screenrgba.txt shader vertex shader.  When the pixel shader is applied, you will find the previous screen render contents in the the first sampler, followed by the 4 custom textures for the post process pass, if applicable.\n\nc0 contains the following information\n x - screenWidth\n y - screenHeight\n z - the pass (from the post process file ordering)\n w - unused\n\n== Mesh Randomisation ==\nTo allow for the random display of sub-meshes, name the objects so they start with a ~ symbol, followed by an index [0,9] and then a hex character which is the mask (it allows a hex value, so it can be 0-9 or A-F, must be capital).  Each value can only be a single char.  So an example would be\n\n ~01somethingsomething\n\nThis would use the first random value, and show when it had value of 0.  The logic is actually\n\n // OK, now finally see if we are visible!\n if(((1<< (mRandom[index]&3))&mask)==0)\n       return false ;      // not visible\n\nSo you can set up masks so that one object gets shown more, or indeed so that sometimes no object is shown, as well as having objects which show together (if they have the same masks on the same index).  Currently only the first 4 indexes are set with random values for units.   \n\nAs an example, if you name objects ~01 ~02 ~04 ~08 then it will only ever show one of the four variations when rendering.\n\n= Transform Reset =\n\nThis is a script you can use to reset the transforms correctly in MAX.  The script was written by Dr. Charles B. Owen, but the host page is no longer up, so I duplicate it here for ease.\n\nXNA Utilities MAXScript for 3DS Max\n\nAn annoying problem when using 3D Studio Max models in XNA is that the pivot points you set in 3DS Max don't end up being the pivot points in the XNA model. Now, you can do Reset XForm and that will set the origin of the pivot point correctly, but it resets the axis to the world X, Y, and Z, which is not what you want in many cases.\n\nSo, I created this script that fixes this problem. The script is XNAUtilitiesOwen.ms. Right click on the link and choose Save As.\n\nInstallation\n\nTo install you either:\n\nIn the Utilities Rollout, hit the MaxScript button and choose Run Script. Select the XNAUtilitiesOwen.ms script to run. This installs the utility. Then choose it from the Utilities list box to display it.\n\nAlternatively, you can drop the utility into the 3D Studio Max Scripts/Startup directory and it will be automatically loaded on Startup.\n\nHow it works\n\nA 3D Studio Max node has a transform associated with it (just called transform). This sets where the origin of the node local coordinate system is relative to the parent. This is the pivot point. Also associated with the node is an object offset transform. The mesh vertices are multiplied by the object offset transform, then the node transform then the parent transform. This is what allows you to freely move the pivot point. If you move the pivot point, it changes the node transform. To keep it from moving the model when you move the pivot point, the object offset transform is changed by an inverse amount, cancelling the effect on the vertices.\n\nThe problem is that what XNA is getting is not the vertices after the object offset transform, which sets the objects relative to the pivot. Instead, it is getting the actual model vertices and only the modifier stack has been applied. So, the transform for the bone in XNA is the product of the object offset transform and the node transform. For pivot points to work right, the object offset transform needs to be an identity matrix. I created a script that zeros that transform and creates an XForm modifier on the stack that does the same transformation. Since XNA gets the vertices after modifiers, it all works."
                    }
                ]
            },
            "6": {
                "pageid": 6,
                "ns": 0,
                "title": "Scripting",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "Archon scripting is a much expanded iteration on the original STUB scripting.  The original documentation is included/updated below.\n\n== Script Syntax ==\n\nCScript is a simple scripting language, based on the basic C syntax. It provides a simple framework to hook it up to an application, effectively the function call handling.\n\nEven if you have not had experience with scripting languages before, you can begin to add or alter your custom scripts using just a simple text editor (see the Tools section for details on how to help make editing better with syntax highlighting and other useful features).\n\nThe team recommend taking a look at the existing scripts to begin to see the way the scripting works. Beginning by tweaking existing scripts is a great way to see something onscreen quickly.\n\nAll scripting must be part of a function. A function has the form:\n\n <code>FUNCTION <name>( [<param>], [<param>], ...)\n {\n \t<function body>\n }</code>\n\nFor example\n\n <code>FUNCTION Tick( side ) \n {\n }</code>\n\nor\n\n <code>FUNCTION Process( TType data )\n {\n }</code>\n\nThere is a limit of 12 parameters that can be passed to a given function.\n\nAll functions return a value, although you do not have to use it, nor use the return should you decide not to. To return a value use:\n\n <code>return <value> ;</code>\n\nNote that a call to return will skip any further processing in the function and exit with the value immediately.\n\n=== Macros ===\n\nYou can define macros - textual substitutions - in the same way as for C.  Note that #/## notations are not supported.  E.g.\n\n <code>#define MAX_UNITS 256</code>\n\n==== Predefined Macros ====\n\nSome macros may be predefined based on other data files.  The names of these predefined macros will always begin with a $ character and all characters will be in uppercase.\n* Macros will be predefined for all colours specified in the COLOURDICTIONARY chunk of DATA/UISETTINGS.TXT that are appropriate for use where script commands expect colours as parameters.\n* Macros will be predefined for all fonts specified in SYSTEM/FONT.TXT that are appropriate for use where script commands expect fonts as parameters.\n\nFor example, <code>DrawMapString(x, y, $SMALLFONT, $ALERTCOLOUR)</code>\n\n=== Structures ===\n\nYou can define structures in a similar way to C.  The format is:\n\n <code>struct <typename>\n { \n \t<contents>\n }</code>\n\nFor example\n\n <code>struct TPos\n {\n \tint x ;\n \tint y ;\n }\n \n struct TObject\n { \n \tint type ;\n \tTPos position ;\n \tint orders[4] ;\n }</code>\n\nAccess is as per standard C syntax:\n\n <code>TObject obj ;\n \n obj.type = 5 ;\n obj.orders[0] = 0 ;\n obj.position.x = 9 ;</code>\n\n=== Control ===\n\nYou have 2 ways to control the flow of a function. The IF statement, and the FOR statement. All code executed by an IF or FOR statement must be enclosed in a block (within a { } pair).\n\nAn IF statement has the form:\n\n<code>if( <condition> )\n {\n \t<execute if condition true>\n }\n else if( <condition 2> )\n {\n \t<execute if condition 2 true>\n }\n else\n {\n \t<execute if neither condition false>\n }</code>\n\nNote that the else keyword and following code is optional. Where the condition can be made up of various logical operators such as && (and) and || (or). So an example statement would be:\n\n <code>if( ( a == 10) || ( b == 5 ) )\n {\n }</code>\n\nA FOR statement has the form:\n\n <code>for(<start>; <condition>; <delta>)\n {\n }</code>\n\n<start> is a statement initialising the loop variable, <condition> is a check where the loop will continue so long as it is true, and the <delta> statement is a simple expression incrementing (or decrementing) the loop variable. So the statement:\n\n <code>for( i=0; i<10; i++ )\n {\n }</code>\n\nwould repeat the code inside the block with i having values of 0 to 9 inclusive, before moving onto any following code.\n\nKey Differences with C\n\n+ There is no operator priority. Brackets are supported and their use recommended.\n\n+ IF statements can can use only a single && or || statement pair when expressions are not contained in brackets. That is:\n\n <code>if( a == 0 && b == 0 && c == 0 )\t\tis invalid\n \n if( (a == 0) && (b == 0) && (c == 0) )\tis valid</code>\n\n+ All atomic variables are signed integers.\n\n+ Single line IF and FOR result expressions are not allowed:\n\n <code>if(a == 0)\t\t\t\t\t\t\tis invalid\n \ta = 10 ;\n \n if(a == 0)\t\t\t\t\t\t\tis valid\n {\n \ta = 10 ;\n }</code>\t\n\n+ All structures are passed by reference to functions (e.g. any changes to a passed in struct in a function will affect the passed in variable in the calling function).\t\t\t\t\t\t\t\n\n\n=== Including Files ===\n\nYou can include other files in your scripts. These can contain useful utility functions, either of your own, or from the game. The syntax for including a file is:\n\n <code>include \"filename.bsf\"</code>\n\n(note that #include will work also)\n\nThe script system will look for the file in the following places in the following order:\n\n same folder as the initial file\n <campaign folder>/DATA/BATTLE/SCRIPTS\n <campaign folder>/DATA/SCRIPTS\n DATA/BATTLE/SCRIPTS\n DATA/SCRIPTS\n filename as provided\n\n=== Singletons ===\n\nAny variables defined outside a function are considered to be global, singleton variables.  These variables are a single instance across all scripts that access them.  You can also initialise singletons (but not local variables) this initialiser lists.  These should exactly match the number of entries, and do not support sub-lists.  E.g.\n\n <code>int gArray[3][2]={0,1,2,3,4,5} ;</code>\n\n=== The char Type ===\n\nYou can define and use arrays of chars as strings.  Versions of the sprintf and strcpy functions exist.  These functions are safe, in that they cannot exceed the bounds of their output strings.\n\n <code>char name[32] ;\n char work[32] ;\n int someValue ;\n \n \tsomeValue = 99 ;\n \tname[0] = 'A' ;\n \tPrintStringLiteral( name ) ;\n \tsprintf( work, \"%d\", someValue ) ;\n \tstrcpy( name, work ) ;</code>\n\nLimitations to note:\n\nchar arrays must be multiples of 4 in size, multidimensional arrays are supported.\n\n== The Debugger ==\nThere is an integrated script debugger which can be activated with <b>CTRL+F3</b>.  This allows you to check variable values, flow, etc.  Note that the debugger is still work in progress.  You can insert a breakpoint into your code using the \n\n <code>DebugBreak;</code>\n\nintrinsic, as well as dynamic breakpoints you set yourself in the code.\n\n=== User Watch List ===\nTo add an expression, type the expression in the edit box below the list, or you can hit W to add the current mouseover expression to the watch list.  DEL should delete an entry in the list.  The list is saved and loaded between sessions.\n\nNote that only expressions which evaluate to an integer or string are currently accepted (so you cannot enter an array element then explore it).  I am planning to improve this.\n\nWhen maximum script debugging is enabled (only on builds built to support this) then add a # to the start of the expresion.  E.g. to break on myBreakVar enter #myBreakVar into the editbox.  Note that this requires the DEBUGMODE value in USER.TXT to be 32 or 64 (64 enables CTRL+0 (zero) to break into a running script.  Enabling this causes a notable reduction in script performance.\n\n== Performance ==\n=== For Loops ===\nSome loop constructs will execute more quickly than others.  Specifically loops that are on a variable from a numeric start, with a less than test against either a numeric value or a simple variable, and a ++ increment.\n\nFaster\n for(i=0;i<10;i++)\n for(i=0;i<count;i++)\n\nNot faster\n for(i=0;i<=10;i+=1)\n for(i=x;i<array[7].count;i++)"
                    }
                ]
            }
        }
    }
}