From The Mana World
< User:Kess
Revision as of 12:51, 25 February 2009 by Kess (talk | contribs) (Narrow down scope a bit; rewrote punctuation)

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

  1. Ending a sentence:
    • Use multiple punctuation marks sparingly.
    • Refrain from separating sentences with two or more spaces.
  2. Something cut off or missing:
    • Use an ellipsis (…) for something missing. (Replace with three dots, ..., in eAthena scripting.)
    • Use an em dash (—) for something cut off. (Replace with two normal dashes in eAthena scripting.)
  3. Offsetting text parenthetically:
    • Use the em dash (—) surrounded by a single pair of spaces. (Replace with two normal dashes in eAthena scripting.)
  4. 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.