Client Guide

Akanbar’s HTML5 client is designed to be a robust multi-platform client that will enable players to play Akanbar and, should they desire, create a system that will be available wherever they go. The player system data is saved to Akanbar’s servers, which means if you create a system on the website while you are at home, if you then travel to a different computer and log in, your system will be be loaded and be accessible there as well. Due to it being HTML5 and most major phone browsers support that, Akanbar’s client will also be accessible on the phone, system included.

There is no current way of migrating a system from one character or another as having an export/import makes me uncomfortable with giving players the ability to manually upload files to Akanbar’s servers. Due to the location of the files as well as the ability to execute code, Zycandos is capable of seeing if a player is doing malicious things, though the design of the client should prohibit them from doing such.

Trigger, alias and macro reactions are all written in JavaScript. I will include a brief tutorial on JavaScript in the section enclosed “Basic JavaScript”. Knowledge on JavaScript, however, is not needed except for the most intricate of triggers.

Note: There is currently a 200-ish line buffer limit, but it will be customizable when I have more free time.

Logging

Logging is a simple, but powerful ally, especially from an online MUD client. Along the right-hand menu is the button, which when pressed will toggle logging. It does not save the buffer (meaning it does not save previous output, only the output received once logging begins), so use it as soon as you wish to log. Once finishing logging, the client will show you a URL to access the link and give you an option to download the HTML file that the log is stored in. The log will remain accessible online for roughly thirty days before it is deleted, as otherwise our server would begin to fill up too quickly. It is, therefore, recommended that if you value a log, you either save it immediately or bookmark it and save it later.

Auto Scrolling

If you double click the output window, auto-scrolling will pause and you can better focus on reading back a line of text without the irritation of losing your place. Moving the mouse out of the output will remove auto scrolling.

Mobile usage

The HTML5 client is accessible via mobile phone and has stylesheets applied to it that allow things to be a little better looking than normally viewing it. The player system is still accessible and active to players using the mobile client, though it is suggested you set everything up on a computer, just for ease. If you would like to play on the mobile version, it is suggested you follow the directions of http://www.howtogeek.com/196087/how-to-add-websites-to-the-home-screen-on-any-smartphone-or-tablet/, which allows you to save the icon on your home screen, making launching it significantly easier. At least via chrome, it will remove the navigation menu, making it look similar to an app.

Aliases

Aliases are a way for players to send a reaction to text the player inputs. For instance, a player might want to send a series of commands just by entering one. Alternatively, you could use an alias to make sending a complicated command easily sent. Aliases are executed recursively, so you can call “send(‘foo’)” from within another alias and “foo” is an alias, it will run the “foo” alias. This applies to within triggers and macros as well as reactions are processed the same.

Simple_Alias2
Above is a sample alias created for those who want to locate the chasmokordyl.

The first field, Name, is whatever you want it to be. The only impact it has is selecting from the list on the left.

Pattern is what you want the command the player enters to be. “^” in the beginning denotes that it is the beginning of the line. If you left off “^” in “^lc” then your alias could be triggered by a word like “alcohol”. If you wanted the command to be attack, then the pattern should be “^attack”.

Reaction is the reaction that an alias will have when the alias is run. In the above example, the client will send “locate chasmikordyl” to akanbar. If you wanted to do two commands, say “locate chasmikordyl” then “locate cuekin” then you would do another send on the next line.

That concludes a basic alias. Below is an explanation of a more complex alias, one that might be crucial if a player wanted to create a combat system.

Saved_Alias
The Pattern is different and more complex looking. It starts with the traditional ^ (again, symbolizing the start of the line), followed by “t “. Next, we see “(\w+)”. This is called a regular expression character. Regular expressions are a way to match a group of letters (characters) whose contents are unknown. (\w+) acts as a match to a group of letters and numbers. “\w” might, for instance, match “c” or “e”. It might also match “1” or any other number. If the regular expression character is followed by a “+”, as it is in the alias example, it will match one or more of the preceeding character. This means \w+ will match one or more letters or numbers, like “jaethor” or “12345” or even “jaethor12345”. In the above case of “^t (\w+)”, it will match “t horse” or “t 567” or “t horse567” or “h5o6r7s8e9” (if you wanted to be odd).
For more information on regular expressions, https://msdn.microsoft.com/en-us/library/az24scfc(v=vs.110).aspx is an excellent resource and http://regexpal.com/ is an excellent tester.

The Reaction is two lines this time, the first of which sets the variable “target” to the string who is at location 1 of the “PatternMatches” array. I will forgo explanation of arrays in hopes of questions being answered by reading http://www.w3schools.com/js/js_arrays.asp. The PatternMatches array is automatically populated when a trigger or alias is run. It is populated by the matches to the regular expressions. For instance, if your alias pattern was “^t (\w+)” and you entered “t horse123” then PatternMatches would be:
0 => t horse123
1 => horse123
This means if you were to do
echo(PatternMatches[1]), it would print out “horse123”.

If the pattern were “^wield (\w+) (\w+)” then if you entered “wield longsword123 left”, PatternMatches would be:
0 => wield longsword123 left
1 => longsword123
2 => left

The second line of the reaction echos out who the target now is. An echo is a way to print text to the output screen without sending it to Akanbar. This is a useful way of making notes to yourself. It first echos “Setting target to” and adds the value of the target variable (set above) to it. Therefore, if you did “t horse123”, it would echo “Setting target to horse123”.

Triggers

Triggers are reactions, issued by a player, to text sent by Akanbar. For instance, you might make a trigger that swings at a target (reaction) when you regain balance (trigger pattern).

Simple_Trigger
Above is an example of a trigger that will trigger upon the player recovering balance and will cause the player to swing at a heretic. While perhaps you would want to have a more complex trigger than this, it is a simple and easy to make trigger that can be useful even if you do not want a complex system.
Name is whatever you choose it to be. This will have no effect on the trigger or its efficiency.

The Pattern is what you want the client to react to. In the case of above, the web client is going to react to you recovering balance.

The Reaction is how the player is going to react once the pattern is seen. The above case has them swinging at a heretic. While this is a useful trigger, it is not perhaps the best way to build a hunting system, so we will go over a better trigger below.

In combination with the above targetting alias and a similar one that toggles “bashingMode” between true and false (not needed to know what’s happening), you can produce the following trigger.
Complex_Trigger
The Name is the same as above.

The Pattern is the same as above.

The Reaction is, however, more complex. The first line is called an if statement. Basically, if the condition within the parenthesis is true, the code within the curly braces will run. Otherwise, it will not. For more information on if statements in JavaScript, http://www.w3schools.com/js/js_if_else.asp . Let’s assume that bashingMode is indeed set to true. We’ll then be swinging at the target set earlier through the targetting alias.

Macros

I will be briefly dissecting a macro, bug the reaction is the same as the above two, so not much can be said.
Simple_Macro
Above is one of the default macros that comes loaded with the HTML5 client. In order to capture a key combination, you should press “Capture” and then immediately press the key combination you want to trigger the macro. There are some combinations that won’t work (due to browser reservations), but none come to mind. If the text in the Keys box is wrong, please send a message to whoever the coolest coder is in Akanbar.

Basic JavaScript

TODO. In the mean time, check out http://www.w3schools.com/js/

Recent Posts