Alaparser

by Alathon
Command parser for MUDs [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Alathon.Alaparser##version=11

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://Alathon.Alaparser##version=11

166 downloads
Version v0.2
Date added: Jul 30 2012
Last updated: Aug 10 2012
4 fans
An easy to use, expandable command parser meant for text-based games and MUDs. It works by allowing you to define commands that follow a format of sequential arguments, and will resolve the arguments for you (Such as finding mobs, making sure something is a number, etc).

Why use Alaparser over the alternatives?


  • The entire library is built to be extendable and overridable, such that you can get it to work exactly like you want. None of the other parsers currently available are built to be extended.
  • Despite that, Alaparser works out-of-the-box by simply creating a single datum, defining the structure for commands and sending client input to the parser.
  • Things which games often want to customize (Such as what text should match a mob or obj) are made to be very easy to customize.
  • AbyssDragon.Parser has outstanding bugs, that won't get fixed because AbyssDragon is no longer on BYOND. It also requires quotes around text arguments, which is very impractical for MUDs you connect to via telnet.
  • Ebonshadow's MUD parser has severe constraints on command format, and does not resolve command arguments very well.
  • There is no noticeable performance difference between the ones I've tested (Alaparser, and AbyssDragon.Parser); both pretty much parse between 4000 - 6000 commands per second, which is enough unless you have over a few thousand players online in a single DD instance. In which case you probably have other problems (And a great MUD!).


Documentation for the library is an on-going process, and is not entirely done yet. There is a fairly comprehensive demo as part of the library, that showcases many of the different features of the command syntax.

This project is also hosted on GitHub here, feel free to submit issues there (or here), patches, etc..

Comments

JamesJX: (Feb 22 2015, 7:15 pm)
The parser as of now backings enough peculiarities to be completely useful for any MUD use; the ones left are fundamentally amenities (Such as having the capacity to characterize pseudonyms for an order). You can check the issue tracker on GitHub for normal overhauls, and I'll attempt and keep the form on the BYOND center as a la mode as could be expected under the circumstances, until the library is on a more steady form.





________________________________________________
Unlock the key of your success by [url=http://www.test-king.com/onlinecourses/ CFA-Level-1.htm]Testking cfa course[/url] and testking.By using [url=http://www.test-king.com/ cert-ITIL-V3-Foundation.htm]itil foundation[/url] our latest and study material, you can easily pass [url=http://www.quincy.edu/]www.quincy.edu[/url]



Alathon: (Aug 7 2012, 3:56 am)
IScet wrote:
Still do not get it exactly... in my example of code... for instance... how can I get look to simply run my ShowMap() code from the parser... i have the lib checked... but maybe i need to see exactly MY commands running it cause I can not even remotely wrap my mind around this..

It sounds like you're more struggling with the basics of how BYOND even works. If that is the case, this might not be the right place to start. You may want to read some general BYOND tutorials first, that explain how verbs, procedures and so on work.
IScet: (Aug 6 2012, 7:04 pm)
Still do not get it exactly... in my example of code... for instance... how can I get look to simply run my ShowMap() code from the parser... i have the lib checked... but maybe i need to see exactly MY commands running it cause I can not even remotely wrap my mind around this..
Alathon: (Aug 6 2012, 9:19 am)
IScet wrote:
Code:
> Command
> say
> format = "say; any";
> command(client/C, txt) {
> C << "You say, '[txt]'"
> }
>

if this is correct I can not get it to work at all... was just going for barebones because it wont work... I have the Alaparser checked under my Libs... then I type say hello and does not work...

Thats because thats not all you need to do. Defining commands lets the library know what you want commands to be structured like, but the parser isn't ever getting what the client types.

First things first, go ahead and update the library to the newest version, I just updated it.

Then check the documentation under readme.dm, under 'How do I set up the library to work?'.
IScet: (Aug 6 2012, 5:42 am)
Code:
Command
say
format = "say; any";
command(client/C, txt) {
C << "You say, '[txt]'"
}


if this is correct I can not get it to work at all... was just going for barebones because it wont work... I have the Alaparser checked under my Libs... then I type say hello and does not work...

mob/proc/ShowMap()
var
buf = ""
top = min(y+client.view, world.maxy)
bottom = max(y-client.view, 1)
left = max(x-client.view, 1)
right = min(x+client.view, world.maxx)

for(var/yy = top, yy >= bottom, yy--)
for(var/xx = left, xx <= right, xx++)
var/turf/T = locate(xx,yy,z)
var/mob/M = locate() in T
if(M)
buf += M.text
else
buf += T.text
buf += "\n"
mb_msgout(buf)
mb_msgout("Location: [x],[y]")

mob/verb
Look()
ShowMap()
North()
step(usr,NORTH)
ShowMap()
South()
step(usr,SOUTH)
ShowMap()
East()
step(usr,EAST)
ShowMap()
West()
step(usr,WEST)
ShowMap()


This is the rest of my code that I had setup in verbs and stuff and working fine... all this before I realized that I can't use verbs for TELNET and now I can't get it all to work at all ;(