How do I comment my code?
If there are two or more developers that are working of the same game and both of htem are writing plotscript, you may need to write comments so that the other person knows precisely what the line is doing. But plotscripts like any form of coding are a language in itself if you type a comment directly, Hspeak.exe wil rightfully of that your comment are not plotscript language.
So how can Hspeak.exe can make the difference between line of codes which should be executed and lines which are simple comments?
Enter the hastag #
Let's take a very simple script
#---------------------------------------------------------------------------------------- plotscript, Inn customer script, begin suspend npcs suspend player if (check tag (tag: children disappear)=off) then begin show text box (24) # Inn Customer : Did you have a nice day ? wait for text box end, else begin show text box (26) wait for text box end #end for the if check tag resume npc resume players end# end for the script #----------------------------------------------------------------------------------------
In this example above, there are two comments. These comments indicates the use of each end command. This way it prevents Hspeak.exe from making an error and the other developper from deleting the lines carelessly. The other use of the # is to specify the content of the text box.
You can check by yourself the importance of this little sign by deleting one of them, saving your file and trying to import it. Hspeak will display an error message.
Things to remember[edit]
- What is after # is not seen as proper code and is skipped while importing your hss file. This is how Hspeak make the difference between line of codes and comments.
- You can't delete them without deleting the whole comment
- When # is missing the error does not explicitely says that the # is missing but it is pretty easy to tell. Most of the time it's XXXX is not a valid command
Things you may want to know[edit]
- If the comment is very long, create two line which starts with #
- A comment in arabic in chinese (any language which do not use the roman alphabet) even if the # is placed before will prevent you hss file from beeing compiled by Hspeak.exe . So if you're more at ease with
commenting in these languages, we recommend to use a separate file (in the doc format. It manages foreign fonts very well) and write your comment. Given every comment a number.
On your hss file just write something like
show text box (24) # See comment number 12 on the dedicated attached file wait for text box