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.

Difference between revisions of "User:Sphr/f"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
template function test
+
=template function test=
 +
 
 +
If any "function call" results in an undefined wikipage, it means the implementation for that value is still missing.
 +
 
  
 
==inc==
 
==inc==
*[[User:Sphr/f/inc]]
+
===[[User:Sphr/f/inc]]===
 +
<nowiki>{{:Sphr/f/inc|x}}</nowiki> where x is a number gives value of x+1 if implemented.
 +
 
 +
implementation
 
*[[User:Sphr/f/inc_0]]
 
*[[User:Sphr/f/inc_0]]
 
*[[User:Sphr/f/inc_1]]
 
*[[User:Sphr/f/inc_1]]
Line 15: Line 21:
 
*[[User:Sphr/f/inc_10]]
 
*[[User:Sphr/f/inc_10]]
 
*[[User:Sphr/f/inc_11]]
 
*[[User:Sphr/f/inc_11]]
 +
*[[User:Sphr/f/inc_12]]
 +
*[[User:Sphr/f/inc_13]]
 +
*[[User:Sphr/f/inc_14]]
 +
*[[User:Sphr/f/inc_15]]
 +
*[[User:Sphr/f/inc_16]]
 +
*[[User:Sphr/f/inc_17]]
 +
*[[User:Sphr/f/inc_18]]
 +
*[[User:Sphr/f/inc_19]]
 +
*[[User:Sphr/f/inc_20]]
 +
 +
==dec==
 +
===[[User:Sphr/f/dec]]===
 +
<nowiki>{{:Sphr/f/dec|x}}</nowiki> where x is a number gives value of x-1 if implemented.
 +
 +
implementation
 +
*[[User:Sphr/f/dec_1]]
 +
*[[User:Sphr/f/dec_2]]
 +
*[[User:Sphr/f/dec_3]]
 +
*[[User:Sphr/f/dec_4]]
 +
*[[User:Sphr/f/dec_5]]
 +
*[[User:Sphr/f/dec_6]]
 +
*[[User:Sphr/f/dec_7]]
 +
*[[User:Sphr/f/dec_8]]
 +
*[[User:Sphr/f/dec_9]]
 +
*[[User:Sphr/f/dec_10]]
 +
*[[User:Sphr/f/dec_11]]
 +
*[[User:Sphr/f/dec_12]]
 +
*[[User:Sphr/f/dec_13]]
 +
*[[User:Sphr/f/dec_14]]
 +
*[[User:Sphr/f/dec_15]]
 +
*[[User:Sphr/f/dec_16]]
 +
*[[User:Sphr/f/dec_17]]
 +
*[[User:Sphr/f/dec_18]]
 +
*[[User:Sphr/f/dec_19]]
 +
*[[User:Sphr/f/dec_20]]
  
 
==add==
 
==add==
*[[User:Sphr/f/add]]
+
===[[User:Sphr/f/add]]===
 +
<nowiki>{{:Sphr/f/add|x|y}}</nowiki> where x,y are numbers gives value of x+y if implemented.
 +
 
 +
implementation
 
*[[User:Sphr/f/add_0]]
 
*[[User:Sphr/f/add_0]]
 
*[[User:Sphr/f/add_1]]
 
*[[User:Sphr/f/add_1]]
Line 23: Line 67:
 
*[[User:Sphr/f/add_3]]
 
*[[User:Sphr/f/add_3]]
 
*[[User:Sphr/f/add_4]]
 
*[[User:Sphr/f/add_4]]
 +
 +
 +
===[[User:Sphr/f/minus]]===
 +
<nowiki>{{:Sphr/f/minus|x|y}}</nowiki> where x,y are numbers gives value of y-x if implemented.
 +
 +
implementation
 +
*[[User:Sphr/f/minus_0]]
 +
*[[User:Sphr/f/minus_1]]
 +
*[[User:Sphr/f/minus_2]]
 +
*[[User:Sphr/f/minus_3]]
 +
*[[User:Sphr/f/minus_4]]
  
 
==mult==
 
==mult==
*[[User:Sphr/f/mult]]
+
===[[User:Sphr/f/mult]]===
 +
<nowiki>{{:Sphr/f/mult|x|y}}</nowiki> where x,y are numbers gives value of x*y if implemented.
 +
 
 +
implementation
 
*[[User:Sphr/f/mult_0]]
 
*[[User:Sphr/f/mult_0]]
 
*[[User:Sphr/f/mult_1]]
 
*[[User:Sphr/f/mult_1]]
Line 31: Line 89:
 
*[[User:Sphr/f/mult_3]]
 
*[[User:Sphr/f/mult_3]]
  
==array2_elem==
+
=Arrays=
 +
Finally got this part working with help from [[User:VengefulDonut|VengefulDonut]], without whom I would have reached a "dead-end" and would have taken a long break by doing something else.... like making more gfx tiles...
 +
 
 +
==1d array==
 +
*[[User:Sphr/f/array1_elem]]
 +
 
 +
Format:
 +
<nowiki>{{User:Sphr/f/array1_elem</nowiki> | <nowiki>{{{1}}}</nowiki> | ''num-elements'' | ''data ...'' <nowiki>}}</nowiki>
 +
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.
 +
 
 +
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==
 
*[[User:Sphr/f/array2_elem]]
 
*[[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
 +
 +
|}
 +
 +
 +
*<nowiki>{{:</nowiki>[[User:Sphr/f/array2_size1]] | ''2d-array-datapage-name'' <nowiki>}}</nowiki>
 +
Gets number of rows defined in the 2d-array-data-page
 +
 +
*<nowiki>{{:</nowiki>[[User:Sphr/f/array2_size2]] | ''2d-array-datapage-name'' <nowiki>}}</nowiki>
 +
Gets number of cols defined in the 2d-array-data-page
 +
 +
*<nowiki>{{:</nowiki>[[User:Sphr/f/array2_index]] | ''row-desired'' | ''col-desired'' | ''num-rows'' | ''num-cols'' <nowiki>}}</nowiki>
 +
Used internally to computes internal index

Latest revision as of 18:12, 11 January 2008

template function test[edit]

If any "function call" results in an undefined wikipage, it means the implementation for that value is still missing.


inc[edit]

User:Sphr/f/inc[edit]

{{:Sphr/f/inc|x}} where x is a number gives value of x+1 if implemented.

implementation

dec[edit]

User:Sphr/f/dec[edit]

{{:Sphr/f/dec|x}} where x is a number gives value of x-1 if implemented.

implementation

add[edit]

User:Sphr/f/add[edit]

{{:Sphr/f/add|x|y}} where x,y are numbers gives value of x+y if implemented.

implementation


User:Sphr/f/minus[edit]

{{:Sphr/f/minus|x|y}} where x,y are numbers gives value of y-x if implemented.

implementation

mult[edit]

User:Sphr/f/mult[edit]

{{:Sphr/f/mult|x|y}} where x,y are numbers gives value of x*y if implemented.

implementation

Arrays[edit]

Finally got this part working with help from VengefulDonut, without whom I would have reached a "dead-end" and would have taken a long break by doing something else.... like making more gfx tiles...

1d array[edit]

Format:

{{User:Sphr/f/array1_elem | {{{1}}} | num-elements | data ... }}

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.

E.g.: Suppose I create a data page named "MyArray" of 9 elements with content : a,b,c,d,e,f,g,h,i

 {{ User:Sphr/f/array1_elem | {{{1}}} |9|a|b|c|d|e|f|g|h|i}}

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
{{:MyArray|1}} a
{{:MyArray|2}} b
{{:MyArray|3}} c
{{:MyArray|4}} d
{{:MyArray|5}} e
{{:MyArray|6}} f
{{:MyArray|7}} g
{{:MyArray|8}} h
{{:MyArray|9}} i
{{:User:Sphr/f/array1_size | :MyArray }} 9

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[edit]

Format:

{{User:Sphr/f/array2_elem | {{{1}}} | {{{2}}} | num-rows | num-cols | data ... }}

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 "rycx".

 {{ User:Sphr/f/array2_elem|{{{1}}}|{{{2}}}|3|3|r1c1|r1c2|r1c3|r2c1|r2c2|r2c3|r3c1|r3c2|r3c3 }}

E.g.: The following shows some template calls for this example and the corresponding results

Template call Result
{{:MyArray2|1|1}} r1c1
{{:MyArray2|1|2}} r1c2
{{:MyArray2|1|3}} r1c3
{{:MyArray2|2|1}} r2c1
{{:MyArray2|2|2}} r2c2
{{:MyArray2|2|3}} r2c3
{{:MyArray2|3|1}} r3c1
{{:MyArray2|3|2}} r3c2
{{:MyArray2|3|3}} r3c3
{{:User:Sphr/f/array2_size1 | :MyArray2 }} 3
{{:User:Sphr/f/array2_size2 | :MyArray2 }} 3


Gets number of rows defined in the 2d-array-data-page

Gets number of cols defined in the 2d-array-data-page

Used internally to computes internal index