Difference between revisions of "Text Formatting"

From NSV13
Jump to navigationJump to search
imported>Cheridan
(Created page with "So you're making some code to do something, and you'd like to use a chat-pane text message to inform the players about it. Good for you! Now, there's a few things to know when...")
 
imported>Kosmos
m (updated to current stuff and tweaked a bit, hopefully this could be made official some day)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
So you're making some code to do something, and you'd like to use a chat-pane text message to inform the players about it. Good for you! Now, there's a few things to know when doing this.
 
So you're making some code to do something, and you'd like to use a chat-pane text message to inform the players about it. Good for you! Now, there's a few things to know when doing this.
  
=== Use Span Classes Goddamn ===
+
== Use Span Classes Goddamn ==
 
Span classes allow for '''consistent''' and informative text formatting.
 
Span classes allow for '''consistent''' and informative text formatting.
  
You may be familiar with span classes if you have previous experience with HTML. There are various types of classes, which can all be found in SOMEWHEEEEEERE. Make sure to use the appropriate one for the situation!
+
You may be familiar with span classes if you have previous experience with HTML. There are various types of classes, which can all be found in interface/stylesheet.dm. Make sure to use the appropriate one for the situation!
  
  
 +
==== When you observe someone else doing something ====
 +
<pre>user.visible_message("[user.name] begins welding [src.name]."</pre>
  
<pre>
+
John Smith begins welding the vent.
<nowiki>user << "<span class='notice'>You begin welding the vent...</span>"</nowiki>
 
</pre>
 
  
This is a notice. Notices show up in simple blue text, and are used for benign informational messages. This notice ends with "...", which implies that the action will take a period of time to complete.
+
:This one has '''no span class'''. It's when you see something mundane and boring.
  
<pre>
 
<nowiki>user << "<span class='warning'>You can't vent crawl while you're stunned!</span>"</nowiki>
 
</pre>
 
  
This is a warning! It shows up as simple red text, and are used for things like restriction notifications, machines malfunctioning,  
+
==== When you observe yourself doing something ====
 +
<pre>to_chat(user, "<span class='notice'>You begin welding the vent...</span>"</pre>
  
<pre>
+
<span style="color:blue">You begin welding the vent...</span>
<nowiki>user.visible_message("<span class='danger'>[user.name] was shocked by the [src.name]!</span>", \</nowiki>
 
</pre>
 
  
This is danger! This is heavier red text, used in situations where someone other than yourself is being harmed or having some other potentionally harmful action taken against them, such as cuffing.
+
:This is a '''notice'''. Notices show up in simple blue text, and are used for benign informational messages. This notice ends with "...", which implies that the action will take a period of time to complete.
  
<pre>
 
<nowiki>target << "<span class='userdanger'>You are absorbed by the changeling!</span>"</nowiki>
 
</pre>
 
  
This is userdanger! Userdanger is used in only one situation: when the person receiving the text message is being directly harmed, such as from attacks or antagonist abilities.
+
==== When you can't do something ====
 +
<pre>to_chat(user, "<span class='warning'>You can't vent crawl while you're stunned!</span>"</pre>
 +
 
 +
<span style="color:red">''You can't vent crawl while you're stunned!''</span>
 +
 
 +
:This is a '''warning'''! It shows up as simple red text, and are used for things like restriction notifications and machines malfunctioning.
 +
 
 +
 
 +
==== When you see someone getting hurt or something else alarming ====
 +
<pre>user.visible_message("<span class='danger'>[user.name] was shocked by the [src.name]!</span>"</pre>
 +
 
 +
<span style="color:red">'''John Smith''' was shocked by the door!</span>
 +
 
 +
:This is '''danger'''! This is heavier red text, used in situations where someone other than yourself is being harmed or having some other potentionally harmful action taken against them, such as cuffing.
 +
 
 +
 
 +
==== When you're hurt directly ====
 +
<pre>to_chat(target, "<span class='userdanger'>You are absorbed by the changeling!</span>"</pre>
 +
 
 +
<span style="font-size:125%;color:red">'''You are absorbed by the changeling!'''</span>
 +
 
 +
:This is '''userdanger'''! Userdanger is used in only one situation: when the person receiving the text message is being directly harmed, such as from attacks or antagonist abilities.
 +
 
 +
 
 +
{{Contribution guides}}
 +
[[Category:Game Resources]] [[Category:Guides]]

Latest revision as of 13:32, 18 September 2017

So you're making some code to do something, and you'd like to use a chat-pane text message to inform the players about it. Good for you! Now, there's a few things to know when doing this.

Use Span Classes Goddamn[edit | edit source]

Span classes allow for consistent and informative text formatting.

You may be familiar with span classes if you have previous experience with HTML. There are various types of classes, which can all be found in interface/stylesheet.dm. Make sure to use the appropriate one for the situation!


When you observe someone else doing something[edit | edit source]

user.visible_message("[user.name] begins welding [src.name]."

John Smith begins welding the vent.

This one has no span class. It's when you see something mundane and boring.


When you observe yourself doing something[edit | edit source]

to_chat(user, "<span class='notice'>You begin welding the vent...</span>"

You begin welding the vent...

This is a notice. Notices show up in simple blue text, and are used for benign informational messages. This notice ends with "...", which implies that the action will take a period of time to complete.


When you can't do something[edit | edit source]

to_chat(user, "<span class='warning'>You can't vent crawl while you're stunned!</span>"

You can't vent crawl while you're stunned!

This is a warning! It shows up as simple red text, and are used for things like restriction notifications and machines malfunctioning.


When you see someone getting hurt or something else alarming[edit | edit source]

user.visible_message("<span class='danger'>[user.name] was shocked by the [src.name]!</span>"

John Smith was shocked by the door!

This is danger! This is heavier red text, used in situations where someone other than yourself is being harmed or having some other potentionally harmful action taken against them, such as cuffing.


When you're hurt directly[edit | edit source]

to_chat(target, "<span class='userdanger'>You are absorbed by the changeling!</span>"

You are absorbed by the changeling!

This is userdanger! Userdanger is used in only one situation: when the person receiving the text message is being directly harmed, such as from attacks or antagonist abilities.


Contribution guides
General Hosting a server, Setting up git, Guide to working with tgstation as an upstream repository, Downloading the source code, Guide to contributing to the game, Reporting issues, Game resources category, Guide to changelogs
Database (MySQL) Setting up the database, MySQL
Coding Coding standards, Understanding SS13 code, SS13 for experienced programmers, Binary flags‎, Getting Your Pull Accepted, Text Formatting
Mapping Guide to mapping, Map merger
Spriting Guide to spriting
Wiki Guide to contributing to the wiki, Wikicode, Maintainer Assignments