From The Mana World
m (User:Kess/eAthena scripting moved to User:Kess/Scripting: I'm going to rework this) |
(Narrow down scope a bit; rewrote punctuation) |
||
Line 1: | Line 1: | ||
This is | This is a proposal-in-making on standardizing both eAthena and TMWserv scripting. Any suggestions are welcome to be posted on the discussion page. | ||
== | == Typographical style == | ||
There exist various schools on typographical conventions, and most of them vary depending on situation. The following are recommendations for writing scripts in the Mana World. Examples for both [[eAthena Scripting Standards|eAthena]] and [[scripting|TMWserv]] will follow alongside each other. These style recommendations should of course be adjusted to the language in question when doing [[translations]]. | |||
=== | === Punctuation === | ||
# Ending a sentence: | |||
#* Use multiple punctuation marks sparingly. | |||
#* Refrain from separating sentences with two or more spaces. | |||
# Something cut off or missing: | |||
#* Use an [http://en.wikipedia.org/wiki/Ellipsis ellipsis] (…) for something missing. (Replace with three dots, ..., in eAthena scripting.) | |||
#* Use an [http://en.wikipedia.org/wiki/Dash#Em_dash em dash] (—) for something cut off. (Replace with two normal dashes in eAthena scripting.) | |||
# Offsetting text parenthetically: | |||
#* Use the [http://en.wikipedia.org/wiki/Dash#Em_dash em dash] (—) surrounded by a single pair of spaces. (Replace with two normal dashes in eAthena scripting.) | |||
# Intervals and other ranges: | |||
#* Use an [http://en.wikipedia.org/wiki/Dash#En_dash en dash] (–) for marking ranges, both numeric and other. (Replace with two normal dashes in eAthena scripting.) | |||
#* Compounds use the normal dash. | |||
''' | '''eAthena example''' | ||
// 1. Sentence ending punctuation | |||
mes "A sentence. Another sentence!"; | |||
// 2. Missing or cut off text | |||
mes "\"No, I don't want to--\""; | |||
mes "It seems ... he died."; | |||
// 3. Parenthetically offset text | |||
mes "By this apple -- and not any other -- she will rule the world."; | |||
// 4. Ranges | |||
mes "Lately the Tulimshar--Hurnscald highway is rather non-lethal."; | |||
mes "\"Give me 100--200 itens, pliz!\""; | |||
'''TMWserv example''' | |||
-- 1. Sentence ending punctuation | |||
do_message(npc, char, "A sentence. Another sentence!") | |||
-- 2. Missing or cut off text | |||
do_message(npc, char, "“No, I don’t want to—â€") | |||
do_message(npc, char, "It seems … he died.") | |||
-- 3. Parenthetically offset text | |||
do_message(npc, char, "By this apple — and not any other — she will rule the world.") | |||
-- 4. Ranges | |||
do_message(npc, char, "Lately the Tulimshar–Hurnscald highway is rather non-lethal.") | |||
do_message(npc, char, "“Give me 100–200 itens, pliz!â€") | |||
=== Quotes === | |||
* Use \" for direct speech. | * Use \" for direct speech. | ||
** For the double quotation mark not to interfere with the scripting code, a backslash needs to be prepended it. | ** For the double quotation mark not to interfere with the scripting code, a backslash needs to be prepended it. | ||
Line 26: | Line 56: | ||
mes "<span style="color:green;">\"</span>Aw, you <span style="color:green;">don't</span> have enough gold on you!<span style="color:green;">\"</span>"; | mes "<span style="color:green;">\"</span>Aw, you <span style="color:green;">don't</span> have enough gold on you!<span style="color:green;">\"</span>"; | ||
=== Text formatting === | |||
* Item and monster names, please use the names in the way shown by the client (e.g., Black Scorpion, Bottle of Sand) outside direct speech in the dialogues. | * Item and monster names, please use the names in the way shown by the client (e.g., Black Scorpion, Bottle of Sand) outside direct speech in the dialogues. | ||
* Emphasis may be formatted with capital letters, use it sparingly. | * Emphasis may be formatted with capital letters, use it sparingly. | ||
Line 35: | Line 65: | ||
mes "\"I fought, of course! It hit me here <span style="color:green;">*points at a bruise at his shoulder*</span>.\""; | mes "\"I fought, of course! It hit me here <span style="color:green;">*points at a bruise at his shoulder*</span>.\""; | ||
=== | == Scripting style == | ||
Should in general follow the [[Hacking#Coding_style_guidelines|coding style guidelines]]. | |||
=== Comments === | |||
* Each file should begin with a comment block describing the scope and use of the file. | * Each file should begin with a comment block describing the scope and use of the file. | ||
** <span style="color:red;">Put a template here?</span> | ** <span style="color:red;">Put a template here?</span> | ||
=== Indentation === | |||
* All indentations are made with tabs, one for each indentation level. | * All indentations are made with tabs, one for each indentation level. | ||
* Labels use no indentations at all. | * Labels use no indentations at all. | ||
Line 55: | Line 87: | ||
close; | close; | ||
=== Blocks of code === | |||
* Code blocks should be separated from each other in a dinstinct way; the best way of doing it is to insert a blank line between code blocks. | * Code blocks should be separated from each other in a dinstinct way; the best way of doing it is to insert a blank line between code blocks. | ||
* Do not add blank lines within individual blocks. | * Do not add blank lines within individual blocks. | ||
* The opening brackets should be at the end of the parent line, not in a new line; the closing ones should be on a line of their own. | * The opening brackets should be at the end of the parent line, not in a new line; the closing ones should be on a line of their own. | ||
Revision as of 12:51, 25 February 2009
This is a proposal-in-making on standardizing both eAthena and TMWserv scripting. Any suggestions are welcome to be posted on the discussion page.
Typographical style
There exist various schools on typographical conventions, and most of them vary depending on situation. The following are recommendations for writing scripts in the Mana World. Examples for both eAthena and TMWserv will follow alongside each other. These style recommendations should of course be adjusted to the language in question when doing translations.
Punctuation
- Ending a sentence:
- Use multiple punctuation marks sparingly.
- Refrain from separating sentences with two or more spaces.
- Something cut off or missing:
- Offsetting text parenthetically:
- Use the em dash (—) surrounded by a single pair of spaces. (Replace with two normal dashes in eAthena scripting.)
- Intervals and other ranges:
- Use an en dash (–) for marking ranges, both numeric and other. (Replace with two normal dashes in eAthena scripting.)
- Compounds use the normal dash.
eAthena example
// 1. Sentence ending punctuation mes "A sentence. Another sentence!"; // 2. Missing or cut off text mes "\"No, I don't want to--\""; mes "It seems ... he died."; // 3. Parenthetically offset text mes "By this apple -- and not any other -- she will rule the world."; // 4. Ranges mes "Lately the Tulimshar--Hurnscald highway is rather non-lethal."; mes "\"Give me 100--200 itens, pliz!\"";
TMWserv example
-- 1. Sentence ending punctuation do_message(npc, char, "A sentence. Another sentence!") -- 2. Missing or cut off text do_message(npc, char, "“No, I don’t want to—â€") do_message(npc, char, "It seems … he died.") -- 3. Parenthetically offset text do_message(npc, char, "By this apple — and not any other — she will rule the world.") -- 4. Ranges do_message(npc, char, "Lately the Tulimshar–Hurnscald highway is rather non-lethal.") do_message(npc, char, "“Give me 100–200 itens, pliz!â€")
Quotes
- Use \" for direct speech.
- For the double quotation mark not to interfere with the scripting code, a backslash needs to be prepended it.
- Contractions and quotes within the direct speech use the single quote '.
// Quote example mes "\"Ah, Agostine! The 'legendary tailor'!\""; mes "\"Aw, you don't have enough gold on you!\"";
Text formatting
- Item and monster names, please use the names in the way shown by the client (e.g., Black Scorpion, Bottle of Sand) outside direct speech in the dialogues.
- Emphasis may be formatted with capital letters, use it sparingly.
- Actions may be put inside asterisks, use it sparingly.
// Formatting example mes "\"I was fighting scorpions for experience and I bumped into a RED one.\""; mes "\"I fought, of course! It hit me here *points at a bruise at his shoulder*.\"";
Scripting style
Should in general follow the coding style guidelines.
Comments
- Each file should begin with a comment block describing the scope and use of the file.
- Put a template here?
Indentation
- All indentations are made with tabs, one for each indentation level.
- Labels use no indentations at all.
- Menus have all their options on their own lines, and indented one level.
- If clauses...
// Indentation example L_label: mes "What do you want to do?"; next; menu "Spend money", -, "Script a fun quest", L_good_choice; close;
Blocks of code
- Code blocks should be separated from each other in a dinstinct way; the best way of doing it is to insert a blank line between code blocks.
- Do not add blank lines within individual blocks.
- The opening brackets should be at the end of the parent line, not in a new line; the closing ones should be on a line of their own.