How To Ask For Scripting Help
If you can't find the answer to your question on your own, this forum is an excellent resource. Many knowledgeable and helpful people post here regularly. In this post, there are some tips on how to ask a question that will make you more likely to get an answer.
Here are a few things that you should always do when asking for help with scripting:
1. Post your scripts!
While we may sometimes be able to guess your problem, especially if it's a common one, you're much more likely to get the right answer first (and to get an answer quickly) if you post your scripts. And I mean all of the relevant scripts, even the long ones.
If they make your post look very long, then I recommend wrapping them in spoiler tags. This hides your scripts and adds a button that can be used to toggle their visibility. Here's an example of a spoiler:
Here's the BBCode I used:
[spoiler]Look, I'm a spoiler![/spoiler]
2. Use code tags!
Like spoiler tags, code tags change the way your scripts are displayed. In particular, they ensure your scripts use a fixed-width font, and they maintain whitespace. If you just paste a script straight into your post, it will appear flat (i.e. unindented) and be very difficult to follow. More than anything else, this makes people who could help you less inclined to read about your problem.
Here's an example of some code:
Here's some code!Here's the BBCode I used:
[code]Here's some code![/code]
It's also possible to use xml tags for this, and they don't seem to apply any syntax highlighting (which is more annoying than anything here). They can be used like this:
Here's some code!
Here's the BBCode I used:
[xml]Here's some code![/xml]
2.a) Indent your scripts!
Please please please make good use of whitespace so your scripts are easy to follow at a glance. This is something you should always do, whether you're posting a script, releasing a mod, or even creating a script for your own private use. It's a good habit, plain and simple.
Here's a (nonsense) example of a correctly indented script (note: inside a code tag inside a spoiler tag):
Whether you use tabs or spaces for indentation is entirely up to you, so long as you do use them. It's worth noting that you may need to change your posting mode to simple (click on the switch in the upper left corner of the posting box) in order for tab characters to work properly.
Making good use of extra linebreaks is also a good idea, although this is more of a personal thing - different people will break up their scripts in different ways. For example, you can see that I've added empty lines at the start and ends of my events. That's just me - you don't need to do it like that - but adding empty lines at sensible places can make scripts easier to read.
3. Explain your problem clearly!
I've seen so many threads that just say something like "it's not working", and inevitably the first reply, if anyone bothers to reply to such a vague thread, is "please explain the problem in more detail". Let's do us all a favour and skip that step entirely - please explain your problem clearly in your opening post:
- What do you want to happen?
- What have you done (i.e. how is everything set up? This includes posting your scripts)
- What is happening instead?
If you are having issues following a tutorial, please post a link to the tutorial as well.
3.a) Show us your errors!
As part of explaining your problem clearly, please post any compiler errors that you're getting, if that's relevant to your problem. If you have compiler errors, make sure they're posted with the entire script (in spoiler tags). It can be useful to put the list of errors in spoiler and code tags, like your script, as well.
I ask you to post the entire script when you have compiler errors (although it's generally useful anyway) because these errors report line numbers, and unless we can see your whole script we'll have to manually find the line giving the error you're reporting.
4. Give your thread a descriptive name!
It might be tempting to name your thread "Script won't work!" or "Help me please", or something else that's very vague. However, if you name your thread something more specific, such as "How do I print debug text to console?" or "Getting a Script to Correctly Return a Global Value" (both actual examples of well-named threads that I looked at because of the name) anyone looking at the forum with the knowledge required to help you will be more likely to recognise your thread as something they can help with.
5. Reply if you figure it out
Sometimes, you figure out your own problem before anyone answers. If this is the case, post the solution! Even if you think nobody cares, there's nothing more frustrating than searching for the answer to a problem you've been having, and all you can find is a thread asking the exact same question followed by "Never mind, I figured it out". Let's do all we can to rid the world of this problem.
Cipscis