User:Ferretwings/Notes

From Terraria Wiki
Jump to navigation Jump to search
Notes for creating templates and stuff

<User:Ferretwings>   <My Talk Page>   <My Sandbox>   <My recent contributions>   <All my contributions>

Lookup

create a better navigational index up top
what are ico, svg, webp, ogg, mp3, sc2map, ogv, oga, flac, wav, webm
examples of how to use the about template

Uncategorized Notes

to access a sprite's history: #filehistory
source code:

  • wiki Sell value = this.value / 500
  • wiki Velocity (deprecated sspeed) = this.shootSpeed
  • wiki Use time = this.useAnimation - 1
  • this.useStyle = 5 spear?

CSS Notes

Extension:CSS (installed on this wiki, and used on this page) allows CSS stylesheets to be included on wiki pages. Examples of usage include: {{#css:MyStyles.css}} and {{#css:css code}}.
When using this extension, clicking "Show preview" (while editing) in the bottom set of tabs will allow the editor to see the results of the css.
Editors are free to use this extension on thier user pages — css formatted with {{#css:}} will not affect other pages. {{#css: usermadetagname {background-color: red;} [data-something|=beginningword] {background-color: khaki;} [data-something1] {background-color: pink;} [data-something2=blankorvalue] {background-color: moccasin;} [data-something~=lookingforthis] {background-color: lightcyan;} [data-something^=beginningvalue] {background-color: powderblue;} [data-something$=endingvalue] {background-color: peachpuff;} [data-something*=somevalue] {background-color: sandybrown;}

  1. d {background-color: purple;}

.e {background-color: red;} div span span span {background-color: orange;} div > span {background-color: yellow;} div + p {background-color: lightgreen;} div p ~ span {background-color: cyan;} .greenbox {background-color: green;color: white; padding: 0 20px; text-align: center;} .greenbox:hover {background-color: blue;} div > p::first-letter {background-color: tomato;} .dropdown {position: relative;display: inline-block;} .dropdown-content {

   display: none;
   position: absolute;
   background-color: #f9f9f9;
   min-width: 160px;
   box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
   padding: 12px 16px;
   z-index: 1;}

.dropdown:hover .dropdown-content {display: block;} .allspans span {background-color: violet;} .mytable {border-collapse: collapse; border-bottom: 1px solid lightblue;} .mytable .header {text-align: center; border-top: 1px solid gray; border-bottom: 1px solid gray;} .mytable tr {vertical-align: top;} .mytable td {border-top: 1px solid lightblue;} }}

css code usage result
Unsupported by Mediawiki
usermadetagname {background-color: red;} <usermadetagname>tagname</usermadetagname> <usermadetagname>tagname</usermadetagname>
[data-something|=beginningword] {background-color: khaki;} <span data-something="beginningword more words">attr|=beginning word</span> (beginningword may be followed by a space or -) attr|=beginning word in attr
Everything that follows works fine
#d {background-color: purple;} <span id=d>id</span> id
.e {background-color: red;} <span class=e>class</span> class
span {background-color: violet;} <span>all spans,</span><div><span>every</span></div><p><span>single</span></p><span>one</span> formats all spans,
every

single

one
— use with care.
Attribute Selectors
[data-something1] {background-color: pink;} <span data-something1=hello>attribute</span> attribute
[data-something2=""orvalue] {background-color: moccasin;} <span data-something2=blankorvalue>attr=</span> attr=
[data-something~=lookingforthis] {background-color: lightcyan;} <span data-something="words, lookingforthis and more words">attr~=some word</span> (unless at the beginning/end, lookingforthis must be surrounded by space) attr~=a word found in the attr
[data-something^=beginningvalue] {background-color: powderblue;} <span data-something="beginningvalueand other stuff">attr=beginning value</span> attr=beginning value
[dat-something$=endingvalue] {background-color: peachpuff;} <span data-something="Some words andendingvalue" (cannot end with ;)>attr=ending value</span> attr=ending value
[data-something*=somevalue] {background-color: sandybrown;} <span data-something="Some words, thensomevalue, then more" (found anywhere within)>attr=some value within</span> attr=some value within
Combinators
div span span span {background-color: orange;} <div><span><span><span>all</span> <span>"span"</span> <div><span>descendants</span> </div><p>of div span span</p></span></span></div>
all "span"
descendants

of div span span

div > span {background-color: yellow;} <div><span>immediate</span> <span>children</span> of div <p><span>not this</span></p></div>
only immediate  "span" children of div

this span is another level down

div + p {background-color: lightgreen;} <div></div><p>adjacent p sibling of div</p><p>not this</p>

adjacent "p" sibling of div

this p isn't adjacent

div p ~ span {background-color: cyan;} <div><p></p><span>all span siblings </span>of p <span>in div</span><div><span>not this</span></div></div>

all "span" siblings of p in div
this span is another level down
Pseudo Elements and Pseudo Classes
div > p::first-letter {background-color: tomato;} <div><p>immediate p children of div,</p><p>1st letter</p></div>

immediate "p" children of div,

1st letter

.greenbox {background-color: green;}
.greenbox:hover {background-color: blue;}
<span class=greenbox>hello</span> hello
.dropdown {position: relative;display: inline-block;}

.dropdown-content {display: none;}
.dropdown:hover .dropdown-content {display: block;}

<div class="dropdown">Dropdown<div class="dropdown-content">[[File:console only.png|32x10px|link=]]</div></div>
 

Form test

{{#css:

  1. input[type="text"] {
   width: 150px;
   display: block;
   margin-bottom: 10px;
   background-color: yellow;}
  1. input[type="button"] {
   width: 120px;
   margin-left: 35px;
   display: block;}

}} This wiki does not support forms. Extension:InputBox can be used to create boxes for search, page/section creation, and page move/rename.

<form name="input" action="" method="get"> (since it doesn't work, the rest of the code has been commented out)


Wiki Labeled Section Transclusions

Tranclusion line Used by
{{#lst:Bomb|bomb}} Bouncy Bomb, may add to Sticky Bomb
{{#lst:Altar|hardmode ores}} Hardmode#Hardmode_Ores, may add to Ores#Hardmode
{{#lst:Altar|ore locations}} Hardmode#Hardmode_Ores
{{#lst:Critter|description}} Squirrel, may add to other critter pages
{{#lst:Critter|bug net}} Squirrel
{{#lst:Critter|statue}} Squirrel
{{#lst:Expert Mode|coins}} Coins

Experiments with url links

/index.php?title=Special:Contributions/Ferretwings&offset=&limit=2000&taget=Ferretwings
Special:Contributions/Ferretwings
https://terraria.wiki.gg/index.php?title=Special:Contributions/Ferretwings&offset=&limit=2000&taget=Ferretwings

Links

wikipedia:Terraria Other wikis: wikia, ign, gameiki

Terraria_Wiki:Administrator_Guide

Community forums Terraria Online forums (now defunct)
Terraria Reddit
Twitter: ReLogic Twitter Terraria Twitter icon Cenxx twitter icon Demilogic twitter icon Pedguin (Terraria streamer and friend of Cenxx)
Wiki editing help:Gamepedia Help:WikisWikipedia Help:Editing
Gempedia Forums Gamepedia Extensions
Templates Item Infobox NPC Infobox
Global variables/constants and Parser functions Parser functions
Common.css CSS help Extension:CSS
Codecademy HTML tutorial and testing HTML help HTML Color Picker
Data IDs Item IDs (Steam Community)
Category:Items Category:Craftable_items
different way to list recipes: Recipes
Recipes/Sawmill {{Sawmill Recipes}} [[Dragon armor/Crafting]] [[Terra_Blade/Crafting]]

String functions
Images
Magic words
Dymanic Page List
Labeled Section Transclusion
HTML tables Help:Tables
Mediawiki Templates
Variables
Calculation
Parser function hooks migration guide?I was looking for the style for wikitable
some shared cssgot 1/2 way down
Wikibase Lua need to test

My other user pages:help.gamepedia, and Gamepedia Wikipedia
Sandboxes: Public Sandbox, Template, Sandbox Test


Useful HTML entities:

&#32;(breakable space), &nbsp;(non-breakable space), &ensp; &emsp;(en space & em space), &#124; and {{!}}( | pipe character),
&amp;( & ),&lt;and&#60;( < ),&#123;( { ) #
More can be found here (not all may be available for use): HTML 4 Entities and HTML Char References.


Namespaces {{ns:}}
Index Name Purpose Talk
0 (Main) "Real" content; articles.

The subject namespace has no prefix.

Talk 1
2 User User pages.

Editing a User talk page generates a notification for the user.

User talk 3
4 Terraria Wiki Information about the wiki.

Defined by Manual:$wgMetaNamespace, which unless manually set otherwise, defaults to Manual:$wgSitename.

Terraria Wiki talk 5
6 File Media description pages File talk 7
8 MediaWiki Site interface customization

Only editable by users with the 'editinterface' permission.

MediaWiki talk 9
10 Template Template pages Template talk 11
12 Help Help pages Help talk 13
14 Category Category description pages Category talk 15
-1 Special Holds special pages N/A
-2 Media Alias for direct links to media files
see also https://help.gamepedia.com/Namespaces
https://terraria.gamepedia.com/api.php?action=query&meta=siteinfo&siprop=namespaces
https://www.mediawiki.org/wiki/Extension_default_namespaces
{{padleft:}} ok hello_____hello (doesn't work with space or &#32;)
Sections <section begin=TheSectionName/>text or table to be shared<section end=TheSectionName/>
Assists
User Type of help
User:Chrisf1020 red/green color blindness
User:Shadow_Robin 3DS?

Page Names

{{FULLPAGENAME}} User:Ferretwings/Notes Namespace and full page title (including all subpage levels).
{{PAGENAME}} Ferretwings/Notes Full page title (including all subpage levels) without the namespace.
{{BASEPAGENAME}} Ferretwings Page title of the page in the immediately superior subpage level without the namespace ("Title/foo" on "Help:Title/foo/bar").For more complex splitting, use {{#titleparts:}}
{{SUBPAGENAME}} Notes The subpage title ("bar" on "Help:Title/foo/bar").
{{SUBJECTPAGENAME}} User:Ferretwings/Notes
{{ARTICLEPAGENAME}} User:Ferretwings/Notes Full page name of the associated subject (e.g. article or file). Useful on talk pages.
{{TALKPAGENAME}} User talk:Ferretwings/Notes Full page name of the associated talk page.
{{ROOTPAGENAME}} Ferretwings Name of the root of the current page. Would return Title on page Help:Title/Foo/Bar
{{NAMESPACE}} User

Sortable tables

class="sortable"

Test Item Notes
line1 um a1text with "a1" hidden in front, when sorted a1 comes before aa
line2 ok aamore text, prefix "aa" is hidden
line3 well then bagain, more text, prefix "b" is hidden
linez ha AAn... This line has no hidden prefix. If you use hidden prefixes, all lines will need them.

Infoboxes

sizing the image:
| image = The Destroyer.png{{!}}210px    <!-- although infoboxes have a "size=" parameter-->
<!-- when 2 images are to be displayed side-by-side with specific links -->
| image = [[File:{{PAGENAME}}.png|inventory icon]]   [[File:{{PAGENAME}} (equipped).png|when active]]
| placeable =	 yes/no
<!-- internal flags & tags -->
| auto =	 yes, if weapon/item autoswings/autofires by holding the use key/button
| consumable = true
| listcat =	 a supplemental category name to include the current item in a DPL list, eg. "arrows" causes the item to display at Arrows. "summoning items"
| listcat2 =	 identical to listcat: an additional supplemental category name
| listexclude =	 yes, to exclude the current template from DPL lists
| allversions =	 yes (only PC/Console/Mobile content, where no "___ content only" banner is present)
| hardmode =	 yes, for items that only become available in Hardmode worlds
| shoot =  projectile id
{{#ifeq:{{NAMESPACE}}|{{ns:0}}|<!-- I'd like an example of when this wouldn't be true
-->{{#if:{{{type|}}}|[[Category:{{{type}}} items]]}}<!--
-->{{#if:{{{type2|}}}|[[Category:{{{type2}}} items]]}}<!--
-->{{#ifeq:{{{allversions|}}}|yes|[[Category:Desktop content]][[Category:Console content]][[Category:Mobile content]]}}<!--
-->{{#ifeq:{{lc:{{{consumable|}}}}}|true|[[Category:Consumable items]]}}<!--
-->{{#if:{{{listcat|}}}|[[Category:{{{listcat}}}]]}}<!--
-->{{#if:{{{listcat2|}}}|[[Category:{{{listcat2}}}]]}}<!--
-->{{#ifeq:{{{hardmode|}}}|yes|[[Category:Hardmode-only items]]}}<!--
else nothing-->}}{{translation projects}}

Parser Functions

Parser
Function
Example Result
String Functions
#len {{ #len: a b }}, {{ #len: &nbsp; }}, {{ #len: &#32; }},
{{ #len: <nowiki>This is a </nowiki>test }}
5, 6, 5, 4
#pos {{ #pos: This is a test | is | 3 }}, {{ #pos: This is a test | this }},

{{ #pos: <nowiki>This is a </nowiki>test | test }}

5, , 0
#rpos {{ #pos: This is a test | is }}, {{ #rpos: This is a test | is }},
{{ #rpos: This is a test | this }}, {{ #rpos: <nowiki> This is a </nowiki>test | test }}
2, 5,

-1, 0

#sub {{ #sub:Icecream | 3 }}, {{ #sub:Icecream | 0 | 3 }}, {{ #sub:Icecream | -3 }},

{{ #sub:Icecream | 3 | -3 }}, {{ #sub:<nowiki>This is a </nowiki>test | 1 }}

cream, Ice, eam,

cr, est

Expr, If, and Date/Time Functions
#expr

{{#expr: 1 and 0}}, {{#expr: 1 + 2}}
{{#expr:{{formatnum:12,345.6789|R}}+100 round 2}}
{{#expr:{{formatnum:12,345.6789|R}}+100 round 0}}
{{#expr:{{formatnum:12,345.6789|R}}+100 round -2}}
{{#expr:ceil 12.2 + floor 12.2 + trunc 12.2}}

0, 3
12445.68
12446
12400
37

#if {{#if: 1|y|n}}, {{#if: 1==2|y|n}}, {{#if: |y|no text}} y, y, no text
{{#if:{{{1|}}}|param 1={{{1}}}|param 1 is empty}} param 1 is empty
#ifeq

{{#ifeq: Foo | foo | equal | not equal}}
{{#ifeq: 01 | 1 | equal | not equal}}
{{#ifeq: 1*1 | 1 | equal | &ne;}}
{{#ifeq:{{#expr: 1*1}} | 1 | equal | not equal}}

not equal
equal

equal

#iferror {{#iferror:{{#expr: 1 + 2 }} | error | correct}} correct
{{#iferror:{{#expr: 1 + 2 }} | error}} 3
{{#iferror:{{#expr: 1 + x }}}}, {{#iferror:{{#expr: . }}|err|ok}} , ok
#ifexpr {{#ifexpr: 1 > 0 | y | n }} y
{{#ifexpr: 1 > 0 | | n }}
#ifexist {{#ifexist: User_talk:Ferretwings | exists | doesn't exist }} exists
{{#ifexist: Media:Gemspark Waterfalls.png |exists |doesn't exist}} exists
Note: Only a limited number are allowed on a page. see a.new (to select links to unexisting pages)
or a:not(.new) (to select links to existing pages).
#rel2abs {{#rel2abs: {{FULLPAGENAME}}}}, {{FULLPAGENAME}} User:Ferretwings/Notes, User:Ferretwings/Notes
{{#rel2abs: /quok | Help:Foo/bar/baz }} → Help:Foo/bar/baz/quok
{{#rel2abs: ../quok | Help:Foo/bar/baz }} → Help:Foo/bar/quok
{{#rel2abs: ../. | Help:Foo/bar/baz }} → Help:Foo/bar
{{#rel2abs: ../quok/. | Help:Foo/bar/baz }} → Help:Foo/bar/quok
{{#rel2abs: ../../quok | Help:Foo/bar/baz }} → Help:Foo/quok
{{#rel2abs: ../../../quok | Help:Foo/bar/baz }} → quok
#switch {{#switch: 2 | 1 = one | 2 = two | none of the above }} second
{{#switch: 3 | 1= one | #default= none of the above | 2= two}} none of the above
{{#switch: 2 | 1= one | 2 | 3= two or three | 4= four}} two or three
{{#switch: A | a= A | b= B | = empty | NA}} NA
{{#switch: 0+1 | 1= one | 2= two | NA}} NA
{{#switch: {{#expr: 0 + 1}} | 1= one | 1= won't show |2= two | NA}} one
{{#switch: 1=2 |
1=2 =raw | 1<nowiki>=</nowiki>2 =nowiki | 1&#61;2 =html | 1{{=}}2 =template | NA}}
html
comparing
#ifeq
#switch
#ifexpr
PHP compares two numbers of type integer:
{{#ifeq: 12345678901234567 | 12345678901234568 | equal | not equal}} not equal
{{#switch: 12345678901234567 | 12345678901234568 = equal | not equal}} not equal
MediaWiki converts literal numbers in expressions to type float, which, for large integers like these, involves rounding:
{{#ifexpr: 12345678901234567 = 12345678901234568 | equal | not equal}} equal
#time {{CURRENTTIMESTAMP}} 20240503072358
{{#time: Y-y"(##)"-L-F-M-n-m"(##)"-W"(YearWeek)"}} 2024-24(##)-1-May-May-5-05(##)-18(YearWeek)
{{#time: l-D-j-d"(##)"-w"(0-6)"-N"(1Mon-7Sun)"-z"(YearDay)"}} Friday-Fri-3-03(##)-5(0-6)-5(1Mon-7Sun)-123(YearDay)
{{#time: G"(24hr)"/g:i:s H"(24hr)"/h:i:s(##) a"/"A}} 7(24hr)/7:23:58 07(24hr)/07:23:58(##) am/AM
{{#time: "TimeZone"=e/T, "DST"=I, "GMT&#x02213;"=O/P/z}} TimeZone=UTC/UTC, DST=0, GMT∓=+0000/+00:00/123
{{#time: "There are" t "days in this month of" F}} There are 31 days in this month of May
{{#time: "Best for sorting:" c }} Best for sorting: 2024-05-03T07:23:58+00:00
{{#time: "Best for calendars/planners:" r }} Best for calendars/planners: Fri, 03 May 2024 07:23:58 +0000
{{#time: r|now }} Fri, 03 May 2024 07:23:58 +0000
{{#time: r|+2 hours }}, {{#time: d F|{{#time: r|31 May 2016}} -1 months}} Fri, 03 May 2024 09:23:58 +0000, 01 May (note:Apr30+1)
{{#time: d F Y|January 0 2008 }}, {{#time: d F |February 29 2007 }} 31 December 2007, 01 March
#timel As far as I can tell, this functions identically to #time.
#titleparts {{#titleparts: Talk:Foo/bar/baz/quok }} → Talk:Foo/bar/baz/quok
{{#titleparts: Talk:Foo/bar/baz/quok | 1 }} → Talk:Foo See also {{ROOTPAGENAME}}
{{#titleparts: Talk:Foo/bar/baz/quok | 3 | 2 }} → bar/baz/quok
{{#titleparts: Talk:Foo/bar/baz/quok | | 2 }} → bar/baz/quok
{{#titleparts: Talk:Foo/bar/baz/quok | -1 }} → Talk:Foo/bar/baz Strips one segment from the end of the string. See also {{BASEPAGENAME}}.
{{#titleparts: Talk:Foo/bar/baz/quok | -4 }} → Strips all 4 segments from the end of the string
{{#titleparts: Talk:Foo/bar/baz/quok | -5 }} → Strips 5 segments from the end of the string (more than exist)
{{#titleparts: Talk:Foo/bar/baz/quok | | -1 }} → quok Returns last segment. See also {{SUBPAGENAME}}.
{{#titleparts: Talk:Foo/bar/baz/quok | -1 | 2 }} → bar/baz Strips one segment from the end of the string, then returns the second segment and beyond
{{#titleparts: Talk:Foo/bar/baz/quok | -1 | -2 }} → baz Start copying at the second last element; strip one segment from the end of the string