v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Editing User:Sphr/f

Jump to navigation Jump to search

Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.


The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 93: Line 93:
  
 
==1d array==
 
==1d array==
*[[User:Sphr/f/array1_elem]]
 
  
Format:
+
*[[User:Sphr/f/array1_elem]] | <nowiki>{{{1}}}</nowiki> | ''num-elements'' | ''data ...''
<nowiki>{{User:Sphr/f/array1_elem</nowiki> | <nowiki>{{{1}}}</nowiki> | ''num-elements'' | ''data ...'' <nowiki>}}</nowiki>
+
Used to define a 1d array data template
Used to define a 1d-array-data-page.
 
  
To prepare the data template, create a new page and use the above format for the content.
+
*[[User:Sphr/f/array1_size]] | ''1d-array data template''
 
+
Gets the size defined in the 1d-array data template
E.g.: Suppose I create a data page named "MyArray" of 9 elements with content : a,b,c,d,e,f,g,h,i
 
  <nowiki>{{ User:Sphr/f/array1_elem | {{{1}}} |9|a|b|c|d|e|f|g|h|i}}</nowiki>
 
 
 
To use, just include the data page as a template with the desired element index (beware, no range checking!!!!)
 
 
 
E.g.: The following shows some template calls for this example and the corresponding results
 
{|
 
|-
 
| Template call||Result
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray|1}}</nowiki> || a
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray|2}}</nowiki> || b
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray|3}}</nowiki> || c
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray|4}}</nowiki> || d
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray|5}}</nowiki> || e
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray|6}}</nowiki> || f
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray|7}}</nowiki> || g
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray|8}}</nowiki> || h
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray|9}}</nowiki> || i
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:User:Sphr/f/array1_size | :MyArray }}</nowiki>||9
 
 
 
|}
 
 
 
*<nowiki>{{:</nowiki>[[User:Sphr/f/array1_size]] | ''1d-array-data-page-name'' <nowiki>}}</nowiki>
 
Gets the size defined in the 1d-array-data-page.
 
 
 
E.g.: The following retrieves the size of MyArray example defined above, which is 9.
 
  
 
==2d array==
 
==2d array==
*[[User:Sphr/f/array2_elem]]
 
Format:
 
<nowiki>{{User:Sphr/f/array2_elem</nowiki> | <nowiki>{{{1}}}</nowiki> | <nowiki>{{{2}}}</nowiki> | ''num-rows'' | ''num-cols'' | ''data ...'' <nowiki>}}</nowiki>
 
Used to define a 2d array-data-page
 
 
To prepare the data page, create a new page and use the above format for the content.
 
 
E.g.: Suppose I create a data page named "MyArray2" of 3x3 elements with the element at row ''y'' and col ''x'' as "r''y''c''x''".
 
  <nowiki>{{ User:Sphr/f/array2_elem|{{{1}}}|{{{2}}}|3|3|r1c1|r1c2|r1c3|r2c1|r2c2|r2c3|r3c1|r3c2|r3c3 }}</nowiki>
 
 
E.g.: The following shows some template calls for this example and the corresponding results
 
{|
 
|-
 
| Template call||Result
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray2|1|1}}</nowiki> || r1c1
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray2|1|2}}</nowiki> || r1c2
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray2|1|3}}</nowiki> || r1c3
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray2|2|1}}</nowiki> || r2c1
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray2|2|2}}</nowiki> || r2c2
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray2|2|3}}</nowiki> || r2c3
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray2|3|1}}</nowiki> || r3c1
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray2|3|2}}</nowiki> || r3c2
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:MyArray2|3|3}}</nowiki> || r3c3
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:User:Sphr/f/array2_size1 | :MyArray2 }}</nowiki>||3
 
|- style="background:lightgrey;" align="center"
 
|<nowiki>{{:User:Sphr/f/array2_size2 | :MyArray2 }}</nowiki>||3
 
 
|}
 
  
 +
*[[User:Sphr/f/array2_elem]] | <nowiki>{{{1}}}</nowiki> | <nowiki>{{{2}}}</nowiki> | ''num-rows'' | ''num-cols'' | ''data ...''
 +
Used to define a 2d array data template
  
*<nowiki>{{:</nowiki>[[User:Sphr/f/array2_size1]] | ''2d-array-datapage-name'' <nowiki>}}</nowiki>
+
*[[User:Sphr/f/array2_size1]] | ''2d-array data template''
Gets number of rows defined in the 2d-array-data-page
+
Gets number of rows defined in the 2d-array data template
  
*<nowiki>{{:</nowiki>[[User:Sphr/f/array2_size2]] | ''2d-array-datapage-name'' <nowiki>}}</nowiki>
+
*[[User:Sphr/f/array2_size2]] | ''2d-array data template''
Gets number of cols defined in the 2d-array-data-page
+
Gets number of cols defined in the 2d-array data template
  
 
*<nowiki>{{:</nowiki>[[User:Sphr/f/array2_index]] | ''row-desired'' | ''col-desired'' | ''num-rows'' | ''num-cols'' <nowiki>}}</nowiki>
 
*<nowiki>{{:</nowiki>[[User:Sphr/f/array2_index]] | ''row-desired'' | ''col-desired'' | ''num-rows'' | ''num-cols'' <nowiki>}}</nowiki>
 
Used internally to computes internal index
 
Used internally to computes internal index

Please note that all contributions to Dwarf Fortress Wiki are considered to be released under the GFDL & MIT (see Dwarf Fortress Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)