Module:Missionreq/data/doc

Revision as of 23:14, 12 June 2020 by Banri (talk | contribs) (Created page with "{{documentation}} ==How to update this page== First off, why is this a module? This is a module because with Lua we can perform the task at hand many times more efficiently....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is the documentation page for Module:Missionreq/data

This is a documentation subpage for Module:Missionreq/data.
It contains usage information, categories, and other content that is not part of the original module page.
Module:Missionreq/data is loaded by Module:Missionreq.

How to update this page

First off, why is this a module? This is a module because with Lua we can perform the task at hand many times more efficiently.

Getting started

So how do you update this template? First off, it's not a template. The Template:Missionreq is just going to be a wrapper template so that everything is neater. The actual code for creating the list is hosted at Module:Missionreq. You do not edit this page to add new missions. To add a new mission, you need to find Module:Missionreq/data.

Why is the mission list on a different page? It's cleaner. If the main module has a problem that needs editing, it'll be more helpful to have significant changes split off from mission additions.

So how do you add a new mission? This is really easy actually, though someone without coding experience might find it confusing. I'll try to dumb it down as much as possible and take it step by step.

  1. Find Module:Missionreq/data and open the editor
  2. Find where to place a mission in alphabetical order (remember that articles—the, a, an—are not included for ordering, so "The Mission Name" begins with "Mission" and not "The")

Syntax

  1. Add a new line and start it with a tab character (you can copy that blue colored character there or copy it in the editor when you're adding)
  2. After the tab character, add the mission name surrounded with quote marks (") and surround that with square brackets. So if the mission was called "Galactic Treasure", we would add ["Galactic Treasure"] after the tab character.
  3. After that mission name, add this: = {},
  4. At this point, our whole line is:
    ["Galactic Treasure"] = {},
    It is important that every mission follow this format
  5. If there are no required mission for the mission you just added, then it is finished, and you can press save, but if there are, continue following these steps:
  6. For every mission that is required for what you are adding, edit the list (the stuff surrounded by {}) with the mission names
  7. Every mission name needs to be surrounded by quote marks (") and all of this strings need to be followed by a comma (,) except for the last one
    • Let's say the missions required are "Ship Permit" and "Travel Permit"
    1. Every mission when added to the list needs to follow the exact same casing. If there are any differences, then the list will not work properly. You can check the line the mission required is on to see what casing to use.
    2. So we want to edit {} to include those missions. Following the instructions above, we would come out with {"Ship Permit", "Travel Permit"}
      • Final product is: ["Galactic Treasure"] = {"Ship Permit", "Travel Permit"},
    • It is extremely important to remember that you cannot use a quote mark in the mission name without escaping it, because the quote is the delimiter of the string. Escaping means you add a backslash (\) before the quote. So if another mission was called "Carter's "Greatest" Discovery", it would be included in the list as "Carter's \"Greatest\" Discovery".

For examples, see the code below. You could also simply copy an existing line and then modify the contents of the quotes as required.

If you're afraid of screwing up or forget what's important, here's what absolutely needs to be remembered for names:

  • Surrounded by quotes
  • Exact casing
  • Strict consistency in name
  • Commas to separate

Sub-requirements

So what do I about missions required for the missions required for the mission I just added? Nothing, you do nothing. If you entered the name correctly into the list, then it will automatically make the sublists and the subsublists. In other words, only add missions that are direct requirements to the mission being added.

Troubleshooting

What is a script error? A script error means something went wrong. If you understand Lua, you can take a chance yourself, or you can post a message to Banri in the Discord Server.

By default, you will be prevented from saving a change to these pages if your edit has a syntax error. You may need to start from scratch and follow the instructions more obediently. If you think you did as described perfectly and still can't save, then post a message to Banri.