PHP Classes

File: frame3.html

Recommend this page to a friend!
  Classes of Free Ment   PHP Live Chat Browser   frame3.html   Download  
File: frame3.html
Role: Auxiliary data
Content type: text/plain
Description: HTML page
Class: PHP Live Chat Browser
Live chat with users of the same or another site
Author: By
Last change:
Date: 7 months ago
Size: 35,438 bytes
 

Contents

Class file image Download
<!DOCTYPE html> <!-- saved from url=(0062)https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3 --> <html class="client-js flexbox flexwrap" lang="en" dir="ltr"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>WML for Complete Beginners: Chapter 3 - The Battle for Wesnoth Wiki</title> <script>document.documentElement.className = document.documentElement.className.replace( /(^|\s)client-nojs(\s|$)/, "$1client-js$2" );</script> <script>(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"WML_for_Complete_Beginners:_Chapter_3","wgTitle":"WML for Complete Beginners: Chapter 3","wgCurRevisionId":69082,"wgRevisionId":69082,"wgArticleId":5678,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["WML for Complete Beginners"],"wgBreakFrames":false,"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgMonthNamesShort":["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"wgRelevantPageName":"WML_for_Complete_Beginners:_Chapter_3","wgRelevantArticleId":5678,"wgRequestId":"bcaa3400078a92718f035d1d","wgIsProbablyEditable":false,"wgRelevantPageIsProbablyEditable":false,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgWikiEditorEnabledModules":[]});mw.loader.state({"site.styles":"ready","noscript":"ready","user.styles":"ready","user":"ready","user.options":"ready","user.tokens":"loading","ext.CookieWarning.styles":"ready","mediawiki.legacy.shared":"ready","mediawiki.legacy.commonPrint":"ready","mediawiki.sectionAnchor":"ready"});mw.loader.implement("user.tokens@15m2fsb",function($,jQuery,require,module){/*@nomin*/mw.user.tokens.set({"editToken":"+\\","patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); });mw.loader.load(["site","mediawiki.page.startup","mediawiki.user","mediawiki.hidpi","mediawiki.page.ready","mediawiki.toc","mediawiki.searchSuggest","ext.CookieWarning","skins.wesmere.js"]);});</script> <link rel="stylesheet" href="./WML for Complete Beginners_ Chapter 3 - The Battle for Wesnoth Wiki_files/load.php"> <script async="" src="./WML for Complete Beginners_ Chapter 3 - The Battle for Wesnoth Wiki_files/load(1).php"></script> <style> @media screen { .tochidden,.toctoggle{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.toctoggle{font-size:94%}} @media print { .toc.tochidden,.toctoggle{display:none}} .suggestions{overflow:hidden;position:absolute;top:0;left:0;width:0;border:0;z-index:1099;padding:0;margin:-1px 0 0 0}.suggestions-special{position:relative;background-color:#fff;cursor:pointer;border:1px solid #a2a9b1;margin:0;margin-top:-2px;display:none;padding:0.25em 0.25em;line-height:1.25em}.suggestions-results{background-color:#fff;cursor:pointer;border:1px solid #a2a9b1;padding:0;margin:0}.suggestions-result{color:#000;margin:0;line-height:1.5em;padding:0.01em 0.25em;text-align:left; overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.suggestions-result-current{background-color:#2a4b8d;color:#fff}.suggestions-special .special-label{color:#72777d;text-align:left}.suggestions-special .special-query{color:#000;font-style:italic;text-align:left}.suggestions-special .special-hover{background-color:#c8ccd1}.suggestions-result-current .special-label,.suggestions-result-current .special-query{color:#fff}.highlight{font-weight:bold}</style><style> .suggestions a.mw-searchSuggest-link,.suggestions a.mw-searchSuggest-link:hover,.suggestions a.mw-searchSuggest-link:active,.suggestions a.mw-searchSuggest-link:focus{color:#000;text-decoration:none}.suggestions-result-current a.mw-searchSuggest-link,.suggestions-result-current a.mw-searchSuggest-link:hover,.suggestions-result-current a.mw-searchSuggest-link:active,.suggestions-result-current a.mw-searchSuggest-link:focus{color:#fff}.suggestions a.mw-searchSuggest-link .special-query{ overflow:hidden;text-overflow:ellipsis;white-space:nowrap}</style><meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="./WML for Complete Beginners_ Chapter 3 - The Battle for Wesnoth Wiki_files/load(2).php"> <meta name="generator" content="MediaWiki 1.31.16"> <meta name="description" content="Note: this page borrows heavily from the BuildingCampaignsTheCampaignFile page."> <link rel="shortcut icon" href="https://wiki.wesnoth.org/favicon.ico"> <link rel="search" type="application/opensearchdescription+xml" href="https://wiki.wesnoth.org/opensearch_desc.php" title="The Battle for Wesnoth Wiki (en)"> <link rel="EditURI" type="application/rsd+xml" href="https://wiki.wesnoth.org/api.php?action=rsd"> <link rel="alternate" type="application/atom+xml" title="The Battle for Wesnoth Wiki Atom feed" href="https://wiki.wesnoth.org/index.php?title=Special:RecentChanges&amp;feed=atom"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link rel="stylesheet" href="./WML for Complete Beginners_ Chapter 3 - The Battle for Wesnoth Wiki_files/css" type="text/css"> <link rel="stylesheet" type="text/css" href="./WML for Complete Beginners_ Chapter 3 - The Battle for Wesnoth Wiki_files/wesmere-1.1.9.css"> <script src="./WML for Complete Beginners_ Chapter 3 - The Battle for Wesnoth Wiki_files/modernizr.js"></script><script src="./WML for Complete Beginners_ Chapter 3 - The Battle for Wesnoth Wiki_files/load(3).php"></script> <link rel="apple-touch-icon" type="image/png" href="https://www.wesnoth.org/wesmere/img/apple-touch-icon.png" sizes="180x180"> <link rel="icon" type="image/png" href="https://www.wesnoth.org/wesmere/img/favicon-32.png" sizes="32x32"> <link rel="icon" type="image/png" href="https://www.wesnoth.org/wesmere/img/favicon-16.png" sizes="16x16"> <!--[if lt IE 9]><script src="/load.php?debug=false&amp;lang=en&amp;modules=html5shiv&amp;only=scripts&amp;skin=Wesmere&amp;sync=1"></script><![endif]--> </head> <body class="mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-WML_for_Complete_Beginners_Chapter_3 rootpage-WML_for_Complete_Beginners_Chapter_3 skin-Wesmere action-view"><div class="mw-cookiewarning-container"><div class="mw-cookiewarning-text"><span>Cookies help us deliver our services. By using our services, you agree to our use of cookies.</span><form method="POST"><input name="disablecookiewarning" class="mw-cookiewarning-dismiss" type="submit" value="OK"></form></div></div> <div id="main"> <div id="nav" role="banner"> <div class="centerbox"> <div id="logo"> <a href="https://www.wesnoth.org/" aria-label="Wesnoth logo"></a> </div> <ul id="navlinks"> <li><a href="https://www.wesnoth.org/">Home</a></li> <li><a href="https://forums.wesnoth.org/viewforum.php?f=62">News</a></li> <li><a href="https://wiki.wesnoth.org/Play">Play</a></li> <li><a href="https://wiki.wesnoth.org/Create">Create</a></li> <li><a href="https://forums.wesnoth.org/">Forums</a></li> <li><a href="https://wiki.wesnoth.org/Project">About</a></li> </ul> <div id="sitesearch" role="search"> <form method="get" action="https://wiki.wesnoth.org/index.php"> <input id="searchbox" type="search" name="search" placeholder="Search" value="" title="Search this wiki [ctrl-option-f]" accesskey="f"> <span id="searchbox-controls"> <button id="search-go" class="search-button" type="submit" title="Search"> <i class="search-icon" aria-hidden="true"></i> <span class="sr-label">Search this wiki</span> </button> </span> </form> </div> <div class="reset"></div> </div> </div> <div id="content" class="mw-content" role="main"> <a id="top"></a> <div id="wm-wiki-toolbar" role="toolbar"><ul class="wm-toolbar" role="toolbar" aria-label="Wiki"><li id="ca-nstab-main" class="selected"><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3" role="button" title="View the content page [ctrl-option-c]" accesskey="c"><i class="wm-toolbar-icon" aria-hidden="true"></i><span class="sr-label">Page</span></a></li><li id="ca-talk" class="new"><a href="https://wiki.wesnoth.org/index.php?title=Talk:WML_for_Complete_Beginners:_Chapter_3&amp;action=edit&amp;redlink=1" rel="discussion" role="button" title="Discussion about the content page (page does not exist) [ctrl-option-t]" accesskey="t"><i class="wm-toolbar-icon" aria-hidden="true"></i><span class="sr-label">Discussion</span></a></li><li id="ca-history"><a href="https://wiki.wesnoth.org/index.php?title=WML_for_Complete_Beginners:_Chapter_3&amp;action=history" role="button" title="Past revisions of this page [ctrl-option-h]" accesskey="h"><i class="wm-toolbar-icon" aria-hidden="true"></i><span class="sr-label">History</span></a></li><li id="wm-places-menu" class="wm-dropdown"><a class="wm-dropdown-trigger" href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Places" role="button"><i class="wm-toolbar-icon" aria-hidden="true"></i><span class="sr-label">Places</span><i class="wm-toolbar-dropdown-marker" aria-hidden="true"></i></a><ul class="wm-dropdown-menu" role="menu"><li id="n-mainpage-description"><a href="https://wiki.wesnoth.org/Main_Page" role="menuitem" title="Visit the main page [ctrl-option-z]" accesskey="z"><i class="wm-toolbar-icon" aria-hidden="true"></i><span>Main page</span></a></li><li id="n-recentchanges"><a href="https://wiki.wesnoth.org/Special:RecentChanges" role="menuitem" title="A list of recent changes in the wiki [ctrl-option-r]" accesskey="r"><i class="wm-toolbar-icon" aria-hidden="true"></i><span>Recent changes</span></a></li><li id="n-randompage"><a href="https://wiki.wesnoth.org/Special:Random" role="menuitem" title="Load a random page [ctrl-option-x]" accesskey="x"><i class="wm-toolbar-icon" aria-hidden="true"></i><span>Random page</span></a></li><li id="n-help-mediawiki"><a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents" role="menuitem"><i class="wm-toolbar-icon" aria-hidden="true"></i><span>Help about MediaWiki</span></a></li></ul></li><li id="wm-advanced-menu" class="wm-dropdown"><a class="wm-dropdown-trigger" href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Advanced" role="button"><i class="wm-toolbar-icon" aria-hidden="true"></i><span class="sr-label">Advanced</span><i class="wm-toolbar-dropdown-marker" aria-hidden="true"></i></a><ul class="wm-dropdown-menu" role="menu"><li id="ca-viewsource"><a href="https://wiki.wesnoth.org/index.php?title=WML_for_Complete_Beginners:_Chapter_3&amp;action=edit" role="menuitem" title="This page is protected. You can view its source [ctrl-option-e]" accesskey="e"><i class="wm-toolbar-icon" aria-hidden="true"></i><span>View source</span></a></li><li id="t-whatlinkshere"><a href="https://wiki.wesnoth.org/Special:WhatLinksHere/WML_for_Complete_Beginners:_Chapter_3" role="menuitem" title="A list of all wiki pages that link here [ctrl-option-j]" accesskey="j"><i class="wm-toolbar-icon" aria-hidden="true"></i><span>What links here</span></a></li><li id="t-recentchangeslinked"><a href="https://wiki.wesnoth.org/Special:RecentChangesLinked/WML_for_Complete_Beginners:_Chapter_3" rel="nofollow" role="menuitem" title="Recent changes in pages linked from this page [ctrl-option-k]" accesskey="k"><i class="wm-toolbar-icon" aria-hidden="true"></i><span>Related changes</span></a></li><li id="t-specialpages"><a href="https://wiki.wesnoth.org/Special:SpecialPages" role="menuitem" title="A list of all special pages [ctrl-option-q]" accesskey="q"><i class="wm-toolbar-icon" aria-hidden="true"></i><span>Special pages</span></a></li><li id="t-permalink"><a href="https://wiki.wesnoth.org/index.php?title=WML_for_Complete_Beginners:_Chapter_3&amp;oldid=69082" role="menuitem" title="Permanent link to this revision of the page"><i class="wm-toolbar-icon" aria-hidden="true"></i><span>Permanent link</span></a></li><li id="t-info"><a href="https://wiki.wesnoth.org/index.php?title=WML_for_Complete_Beginners:_Chapter_3&amp;action=info" role="menuitem" title="More information about this page"><i class="wm-toolbar-icon" aria-hidden="true"></i><span>Page information</span></a></li></ul></li></ul><ul class="wm-toolbar" role="toolbar" aria-label="User"><li id="wm-account-menu" class="wm-dropdown"><a class="wm-dropdown-trigger" href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Your account" role="button"><i class="wm-toolbar-icon" aria-hidden="true"></i><span class="sr-label">Not logged in</span><i class="wm-toolbar-dropdown-marker" aria-hidden="true"></i></a><ul class="wm-dropdown-menu" role="menu"><li id="pt-login"><a href="https://wiki.wesnoth.org/index.php?title=Special:UserLogin&amp;returnto=WML+for+Complete+Beginners%3A+Chapter+3" role="menuitem" title="You are encouraged to log in; however, it is not mandatory [ctrl-option-o]" accesskey="o"><i class="wm-toolbar-icon" aria-hidden="true"></i><span>Log in</span></a></li></ul></li></ul></div> <!-- wm-wiki-toolbar --> <h1 class="firstHeading" lang="en">WML for Complete Beginners: Chapter 3</h1> <div id="bodyContent"> <div id="siteSub">From The Battle for Wesnoth Wiki</div> <div id="contentSub"></div> <!-- start wikipage --> <div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><div class="mw-parser-output"><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctoggle">&nbsp;[<a role="button" tabindex="0" class="togglelink">hide</a>]&nbsp;</span></div> <ul> <li class="toclevel-1 tocsection-1"><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#Chapter_3:_The_main.cfg"><span class="tocnumber">1</span> <span class="toctext">Chapter 3: The _main.cfg</span></a> <ul> <li class="toclevel-2 tocsection-2"><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#The_Text_Domain"><span class="tocnumber">1.1</span> <span class="toctext">The Text Domain</span></a></li> <li class="toclevel-2 tocsection-3"><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#Defining_the_Campaign"><span class="tocnumber">1.2</span> <span class="toctext">Defining the Campaign</span></a></li> <li class="toclevel-2 tocsection-4"><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#The_Preprocessor"><span class="tocnumber">1.3</span> <span class="toctext">The Preprocessor</span></a> <ul> <li class="toclevel-3 tocsection-5"><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#Preprocessor_Directives"><span class="tocnumber">1.3.1</span> <span class="toctext">Preprocessor Directives</span></a></li> <li class="toclevel-3 tocsection-6"><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#The_Binary_Path"><span class="tocnumber">1.3.2</span> <span class="toctext">The Binary Path</span></a></li> <li class="toclevel-3 tocsection-7"><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#Directory_Inclusion"><span class="tocnumber">1.3.3</span> <span class="toctext">Directory Inclusion</span></a></li> </ul> </li> </ul> </li> </ul> </div> <h2><span class="mw-headline" id="Chapter_3:_The_main.cfg">Chapter 3: The _main.cfg</span></h2> <p>Note: this page borrows heavily from the <a href="https://wiki.wesnoth.org/BuildingCampaignsTheCampaignFile" title="BuildingCampaignsTheCampaignFile">BuildingCampaignsTheCampaignFile</a> page. </p><p>So we've created a campaign folder, but as of yet the game doesn't even know this new folder exists. In order for the game to find the folder, we have to create a special file called "_main.cfg" that tells the game where to find all of your campaign's data. Without this file, the game won't be able to find your campaign when it starts up, and consequently you won't be able to play your campaign. </p><p>So let's get started creating a "_main.cfg" file so that the game can find your campaign. </p><p>Navigate to your campaign folder, if you aren't already there. Now create a new text file and name it "_main.cfg" (just like that, including the underscore but without the quotes). Make sure you select a save-type of 'all files' and not 'text document (.txt)' for this file. If you selected 'text document (.txt)' you will actually save a file named "_main.cfg.txt" which will not be recognized by Wesnoth. Now you have created a file called "_main.cfg", but we're not done yet. Right now the file is empty, so the game still won't be able to locate your campaign yet. But fear not, all you have to do is write some specific WML inside the "_main.cfg" file and the game will be able to find your campaign just fine. </p> <h3><span class="mw-headline" id="The_Text_Domain">The Text Domain</span></h3> <p>Open the "_main.cfg" file in your text editor if you haven't already. and add the following tagset: </p> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class="">[textdomain] [/textdomain] </pre></div> <p>This tagset which specifies where the game should look for translations to the strings in the campaign (at this stage you probably won't have any translations, but it's a common practice to add a text domain just in case you get translations later on). The textdomain tag specifies a name for the textdomain, which is what is used in the [campaign] tag, and is used in campaign scenarios to connect the strings with translations. </p><p>Inside the [textdomain] tag, include the attributes <b>name</b> and <b>path</b> (don't assign values to them just yet, we'll do that in a moment): </p> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class="">[textdomain] name= path= [/textdomain] </pre></div> <ul><li><b>The "name" Attribute</b></li></ul> <p>The attribute <b>name</b> specifies the name of the text domain you are creating. The textdomain name should be unique, and start with 'wesnoth-', to ensure that it does not conflict with other textdomains that might be specified on a given system. Let's name our text domain "my_first_campaign". Don't forget to start it with "wesnoth-". Now the contents of your _main.cfg file should look exactly like this: </p> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class="">[textdomain] name="wesnoth-my_first_campaign" path= [/textdomain] </pre></div> <ul><li><b>The "path" Attribute</b></li></ul> <p>The attribute <b>path</b> specifies a path to the directory where the compiled translation files will be stored. This should be a file inside the campaign directory. Right now our translations folder is empty, but if you ever get translations for your campaign, this is the folder in which they would go. Let's assign the "translations" folder directory path, which should be "data/add-ons/my_first_campaign/translations", to this attribute. Your _main.cfg should now look like this: </p> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class="">[textdomain] name="wesnoth-my_first_campaign" path="data/add-ons/my_first_campaign/translations" [/textdomain] </pre></div> <h3><span class="mw-headline" id="Defining_the_Campaign">Defining the Campaign</span></h3> <p>And now we're going to add the [campaign] tagset. Yes, it's our old friend, the [campaign] tagset, from Chapter 1. </p> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class="">[campaign] [/campaign] </pre></div> <p>Next, inside the [campaign] tagset, include the following line: </p> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class=""> #textdomain wesnoth-my_first_campaign </pre></div> <p>This tells the game that the text strings in this file belong to the text domain you just defined above </p><p>Next we need to give the attributes <b>id</b>,<b>name</b>,<b>abbrev</b>,<b>icon</b>,<b>image</b>,<b>first_scenario</b>,<b>description</b>,<b>difficulties</b>, and <b>difficulty_descriptions</b>. Don't assign any values to these attributes yet, we'll do that in a moment. For now, just make sure that you have all of these attributes in between the campaign tags, like so (the exact order of the attributes doesn't matter, but it is recommended that you follow the order given below to make things easier for yourself when following this tutorial): </p> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Expand" class="cb-expand" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Expand</span></a></li><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class="">[campaign] #textdomain wesnoth-my_first_campaign id= name= abbrev= define= icon= image= first_scenario= description= difficulties= difficulty_descriptions= [/campaign] </pre></div> <p>Now let's go over the attributes one by one and give them their values. I'll give you a specific value to assign to each attribute, and then I'll explain why we use that particular value. </p> <ul><li><b>The "id" Attribute</b></li></ul> <dl><dd>The unique identifier of your campaign. The value of an "id" attribute can only contain lowercase alphanumeric characters and underscores. We are going to give this attribute the value "my_first_campaign", like so:</dd></dl> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class="">id=my_first_campaign </pre></div> <ul><li><b>The "name" Attribute</b></li></ul> <dl><dd>The name of your campaign. This translatable string is the name that will show up in the in-game campaign menu, where you can select which campaign you want to play. Let's give it the value "My First Campaign". Since we want this string to be translatable, don't forget to include the translation mark (the underscore) in front of the first double quote.</dd></dl> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class="">name= _ "My First Campaign" </pre></div> <ul><li><b>The "abbrev" Attribute</b></li></ul> <dl><dd>This attribute defines a campaign abbreviation that will be used as a prefix for the names of save files from that campaign. It should generally consist of the acronym of the campaign's name (i.e., the first letter of each of the words in the campaign's name, capitalized).</dd></dl> <ul><li><b>The "define" Attribute</b></li></ul> <p>This attribute creates a key that lets the game know when a user has selected to play a scenario from your campaign. </p> <ul><li><b>The "icon" Attribute</b></li></ul> <p>The image that will be displayed next to the name of your campaign in the in-game campaign selection menu. Since we need the game to locate a specific file, we [...] </p> <ul><li><b>The "image" Attribute</b></li></ul> <p>This defines the image that will appear under your campaign's description when your campaign is selected in the in-game campaign selection menu. </p> <ul><li><b>The "first_scenario" Attribute</b></li></ul> <ul><li><b>The "description" Attribute</b></li></ul> <ul><li><b>The "difficulties" Attribute</b></li></ul> <ul><li><b>The "difficulty_descriptions" Attribute</b></li></ul> <p><b>Note:</b> <i><b>(<a href="https://wiki.wesnoth.org/DevFeature" title="DevFeature">Version 1.13.2 and later only</a>)</b></i> The "difficulties" and "difficulty_descriptions" attributes have been replaced by the <a href="https://wiki.wesnoth.org/CampaignWML" title="CampaignWML">difficulty</a> tag. Please refer to a <a href="https://wiki.wesnoth.org/MakingCampaignInWML2#Difficulty" title="MakingCampaignInWML2">more recently-written tutorial</a>, and in that tutorial read on to its <a href="https://wiki.wesnoth.org/MakingCampaignInWML2#MACROS" title="MakingCampaignInWML2">macros</a> section too. </p> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Expand" class="cb-expand" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Expand</span></a></li><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class="">[campaign] #textdomain wesnoth-my_first_campaign id=my_first_campaign name= _ "My First Campaign" abbrev= _ "MFC" define=CAMPAIGN_MY_FIRST_CAMPAIGN icon= image= first_scenario=my_first_scenario description= _ "This is my first campaign." difficulties=EASY difficulty_descriptions= [/campaign] </pre></div> <h3><span class="mw-headline" id="The_Preprocessor">The Preprocessor</span></h3> <p>Before any WML file is read by Wesnoth, it goes through the preprocessor. The preprocessor will prepare the file to be read by the game. It doesn't actually recognize WML. In fact, it ignores it. Instead, it reads the <b>preprocessor directives</b>, used to create and use <a rel="nofollow" class="external text" href="https://www.wesnoth.org/macro-reference.xhtml">macros</a>. Macros are used to reduce the repetition of information just like pronouns do with names and identifiers in the English language. Don't worry about macros now, we will talk about them later. </p><p><br> </p> <h4><span class="mw-headline" id="Preprocessor_Directives">Preprocessor Directives</span></h4> <p>As mentioned above, the Preprocessor doesn't recognize WML code. It only recognizes <b>preprocessor directives</b>. While apparently similar to comments, they have a much greater impact on the code. Not only can they define and use macros, they can also be used to apply a condition for the reading of a part of the file by Wesnoth (making a part of the code be read only if you are in the Hard difficulty, for example). Using preprocessor directives can create many things, but don't worry about it yet. We will talk about it in the future. </p><p><br> </p> <h4><span class="mw-headline" id="The_Binary_Path">The Binary Path</span></h4> <p>The binary path is used to tell the game to include a certain directory in the userdata folder whenever it searches for a file. For instance, if you had a custom image in your campaign called "my_face.png", whenever the game finds a reference to that file in a scenario (e.g., you want to display that image at one of the story screens in a scenario), it will first search the core gamedata directories, then it will search any folders included in the binary path. If it cannot find the file in either the gamedata directory or in any of the directories specified in the binary path, then it will give you an error. </p><p>You will only need to include a binary path if your campaign contains custom images, sounds or music that is not included in mainline Wesnoth. If you do not have any custom images, sounds or music, then you should not include a binary path. Since we will be including some custom images in our campaign, we are going to need to include a binary path. </p><p><i><b>(<a href="https://wiki.wesnoth.org/DevFeature" title="DevFeature">Version 1.15.3 and later only</a>)</b></i> you should always include a binary path, because it can also be used for map files. That will be explained in the next chapter's map_file section. This will be supported in Wesnoth 1.15.3 and later, but will never be added to any version of the 1.12 or 1.14 series. </p><p>To create a binary path, use the following syntax: </p> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class="">[binary_path] path=data/add-ons/my_first_campaign [/binary_path] </pre></div> <p>This tells the game to search the specified userdata directory whenever it cannot locate a certain file in the gamedata directory. Note that the value of the "path" key must always begin with "data/add-ons/" followed by the name of your campaign folder. </p> <h4><span class="mw-headline" id="Directory_Inclusion">Directory Inclusion</span></h4> <p>(The final _main.cfg should end up looking something like this:) </p> <div class="codebox"><div class="codectl"><ul><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Expand" class="cb-expand" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Expand</span></a></li><li><a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_3#" title="Select All" class="cb-select" role="button"><i class="cb-icon" aria-hidden="true"></i><span class="sr-or-tinyff-label">Select All</span></a></li></ul></div><pre class="">[textdomain] name="wesnoth-my_first_campaign" path="data/add-ons/my_first_campaign/translations" [/textdomain] #textdomain wesnoth-my_first_campaign [campaign] #wesnoth-My_First_Campaign id=my_first_campaign name= _ "My First Campaign" abbrev= _ "MFC" define=CAMPAIGN_MY_FIRST_CAMPAIGN #need icon and image (take from core files, don't include external files for sake of simplicity) icon= image= first_scenario=my_first_scenario description= _ "This is my first campaign." difficulties=EASY difficulty_descriptions={MENU_IMG_TXT2 units/undead/shadow-s-attack-4.png _"Easy" _""} [/campaign] #ifdef CAMPAIGN_MY_FIRST_CAMPAIGN [binary_path] path=data/add-ons/my_first_campaign [/binary_path] {~add-ons/my_first_campaign/macros} {~add-ons/my_first_campaign/utils} {~add-ons/my_first_campaign/scenarios} #endif </pre></div> <p>(note: no units yet, save that for the adding custom units section) </p><p>Next Chapter: <a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_4" title="WML for Complete Beginners: Chapter 4">WML for Complete Beginners: Chapter 4</a> </p><p>Previous Chapter: <a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners:_Chapter_2" title="WML for Complete Beginners: Chapter 2">WML for Complete Beginners: Chapter 2</a> </p><p>Return to Main Index: <a href="https://wiki.wesnoth.org/WML_for_Complete_Beginners" title="WML for Complete Beginners">WML for Complete Beginners</a> </p> <!-- NewPP limit report Cached time: 20211207131226 Cache expiry: 86400 Dynamic content: false CPU time usage: 0.008 seconds Real time usage: 0.009 seconds Preprocessor visited node count: 44/1000000 Preprocessor generated node count: 130/1000000 Post?expand include size: 124/2097152 bytes Template argument size: 4/2097152 bytes Highest expansion depth: 3/40 Expensive parser function count: 0/100 Unstrip recursion depth: 0/20 Unstrip post?expand size: 0/5000000 bytes --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 1.337 1 -total 51.99% 0.695 1 Template:DevFeature1.13 42.70% 0.571 1 Template:DevFeature1.15 --> </div> <!-- Saved in parser cache with key wiki-mw_:pcache:idhash:5678-0!canonical and timestamp 20211207131226 and revision id 69082 --> </div> <!-- end wikipage --> <div class="printfooter"> Retrieved from "<a dir="ltr" href="https://wiki.wesnoth.org/index.php?title=WML_for_Complete_Beginners:_Chapter_3&amp;oldid=69082">https://wiki.wesnoth.org/index.php?title=WML_for_Complete_Beginners:_Chapter_3&amp;oldid=69082</a>" </div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="https://wiki.wesnoth.org/Special:Categories" title="Special:Categories">Category</a>: <ul><li><a href="https://wiki.wesnoth.org/Category:WML_for_Complete_Beginners" title="Category:WML for Complete Beginners">WML for Complete Beginners</a></li></ul></div></div><div id="lastmod"> This page was last edited on 6 December 2021, at 07:24.</div> <div class="visualClear"></div> </div> <!-- bodyContent --> </div> <!-- end content --> </div> <!-- end main --> <div id="footer-sep"></div> <div id="footer"><div id="footer-content"><div> <a href="https://wiki.wesnoth.org/StartingPoints">Site Map</a> ? <a href="https://status.wesnoth.org/">Site Status</a><br> Copyright 2003?2021 by <a rel="author" href="https://wiki.wesnoth.org/Project">The Battle for Wesnoth Project</a>. Powered by <a href="https://www.mediawiki.org/">MediaWiki</a>.<br> Site design Copyright 2017?2021 by Iris Morelle. </div></div></div> <script>(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgPageParseReport":{"limitreport":{"cputime":"0.008","walltime":"0.009","ppvisitednodes":{"value":44,"limit":1000000},"ppgeneratednodes":{"value":130,"limit":1000000},"postexpandincludesize":{"value":124,"limit":2097152},"templateargumentsize":{"value":4,"limit":2097152},"expansiondepth":{"value":3,"limit":40},"expensivefunctioncount":{"value":0,"limit":100},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":0,"limit":5000000},"timingprofile":["100.00% 1.337 1 -total"," 51.99% 0.695 1 Template:DevFeature1.13"," 42.70% 0.571 1 Template:DevFeature1.15"]},"cachereport":{"timestamp":"20211207131226","ttl":86400,"transientcontent":false}}});});</script><script>(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgBackendResponseTime":24});});</script></body></html>