Warning, /games/kmuddy/DESIGN is written in an unsupported language. File is not indexed.

0001 
0002 This document describes the architectural changes in KMuddy, that will be done
0003 after KMuddy 1.0 is out (though some of these might be implemented sooner).
0004 It is by no means complete, and it's also a bit disorganized, so be careful ;)
0005 
0006 Many parts of this are already completed, and some are obsolete.
0007 
0008 SCRIPTING LANGUAGE
0009 ------------------
0010 This is how things should work:
0011 - [ expression ] - evaluate expression, put result
0012 - /expression - evaluate expression, ignore result
0013 - allow indentation in front of /
0014 - also option of aliases/... to strip leading spaces to allow better indenting
0015 - change old syntax and perhaps provide converter ( /set name value becomes /set("name","value") )
0016 - unify functions and macros - everything will be a function, some may simply return nothing relevant
0017 - speedwalk: make it simply a substitution for a new /walk(path) command
0018 - repeater: substitution for a /rep command, /rep must also parse its parameter as cCommand etc
0019 - new class cCommand that holds the parsed command, so we don't need ugly tricks
0020 - make ""s optional for single-word strings
0021 - ability to send a cCommand through an event, and actually use this in the command processing code
0022 - ability to have a script wait for a condition - other things will be executed in the meantime, until the condition is met
0023 - conditions: expression is true, variable is set to something, some time has elapsed, some number of lines has been received, a particular line is received, etc.; and /wait commands to match
0024 - provide/consume commands, consume will halt execution until a resource becomes available
0025 - foreach loop
0026 - better support for lists and arrays and such in scripting syntax, the functions work but are not very intuitive
0027 - ability to declare sub-routines and call them
0028 - change aliases to be actual anonymous sub-routines instead of being expanded directly into the command list
0029 - get rid of pseudo-variables, they're confusing and stupid, having aliases as subroutines will allow us to do that
0030 - subroutines will of course halt execution of caller until they're done, and then caller will continue execution
0031 - Kross: ability to define sub-routines in various scripting languages - requires testing to see how slow/fast this would be; also need access to variables etc.
0032 
0033 
0034 
0035 
0036 Basic structure
0037 ---------------
0038 lib/ - classes that are shared by KMuddy core and plug-ins
0039 lib/widgets - some commonly used widgets
0040 kmuddy/ - the core functionality
0041 kmuddy/dialogs - core dialogs
0042 plugins/ - plug-ins
0043 
0044 The lib/ directory contains classes that can be manipulated by plug-ins - displayer,
0045 ANSI parser, status line, preferences and so on...
0046 
0047 There must NOT be any dependencies on core in lib.
0048 
0049 PLUG-INS
0050 --------
0051 The following plug-ins are to be considered base plug-ins - will be distributed
0052 together with KMuddy, as they provide important functionality...
0053 
0054 MULTILINE - multi-line edit (the separate one)
0055 TRANSCRIPT - basic transcript
0056 VARIABLES - GUI and macros for manipulating variables (the storage classes are in
0057   core)
0058 COMMANDS - many useful commands (/disp, /sysmsg, /quit, /status, ...)
0059 SCRIPTING - external scripting, variable server, /exec command
0060 
0061 These plug-ins are not so important, they might be distributed with KMuddy or
0062 separately, as determined later.
0063 
0064 ADVTRANSCRIPT - advanced transcript (maybe merge with TRANSCRIPT?)
0065 TIMERS - timer support, /rep
0066 STATISTICS - connection statistics
0067 COLORS - expand some sequences in user commands into ANSI color codes
0068 VARTRIG - triggers reacting on variable changes
0069 MXPTRIG - MXP-related stuff, special triggers mostly (MXP support is in core
0070     and libmxp)
0071 MAPPER - the mapper
0072 MATH - many math functions usable in expressions
0073 STRINGS - functions/macros for string manipulation
0074 FILES - functions/macros for file manipulation
0075 DB - database support
0076 
0077 Handling of lists and groups
0078 ----------------------------
0079 - all objects organizable into groups
0080 - some object groups need priorities, others don't
0081 - each object belongs to exactly one group
0082 - the list editor should be able to modify the groups
0083 - cSaveableList should be modified so that it contains a list of groups, each of them
0084   containing a list of objects (i.e. list of lists)
0085 - all that has to be loaded/saved
0086 - each group and object should know how to disable itself
0087 - list editor should have Enable/Disable button (or checkboxes near items or
0088   something), must be configurable (disabling a variable makes no sense)
0089 - separate group-management should no longer be needed
0090 
0091 Global/profile settings
0092 -----------------------
0093 Current way of having two methods per config option (get/set) is not very good.
0094 We should use another approach - a couple of mappings, one for each option type
0095 (int, bool, string, ...). When saving stuff, care should be taken not to mix two
0096 valueswith equal name, but different type (could be done by prepending/appending
0097 type-prefix/suffix to name, or by having one group per type). Everyone who wants
0098 some config-option should also provide default value, returned if such option
0099 hasn't been set yet.
0100 
0101 Managing aliases/trgigers/groups via input-line
0102 -----------------------------------------------
0103 Macros should be provided to allow adding/modifying/deleting/(de)activating of stuff.
0104 TODO: those macros
0105 
0106 storing session-related data in plug-ins
0107 ----------------------------------------
0108 method 1: map<cSession *, cDataStorage *> data; - for data that should not be saved
0109 method 2: storing in cConnPrefs - if that data has to be remembered between sessions
0110 
0111 saving lists/larger data/... in plug-ins (to a separate file)
0112 -------------------------------------------------------------
0113 cConnPrefs knows current profile name - add methods to return path where configfile
0114 should be written.
0115 Profile import/export has to be modified to support those files! (currently it
0116 has a fixed list of files to export/import)
0117 
0118 syncing dialogs
0119 ---------------
0120 - lists should emit some signal, whenever a change occurs, so that dialogs can be
0121 kept in sync (triggers can alter stuff with the new macros, even if the dialogs
0122 are modal (so there's no reason to have those dlgs modal)
0123 
0124 Triggers and scripting
0125 ----------------------
0126  SEE FORUMS :)
0127 
0128 Events/actions
0129 --------------
0130 Many objects will be capable of registering themselves with an event/action
0131 class. Here they will be allowed to publish method calls and register events
0132 that they can trigger. Some plug-in wil then provide functions to call those
0133 methods and also to call some command(s) when some event fires off.
0134 Most things shall be based on these events - e.g. timers will be hooked to
0135 some timeout event, alias/trigger processing will also be based on some event
0136 (with help of the calling class - we need to set some flags about things like
0137 gagging and so).
0138 Some priorities for event handlers may need to be introduced.
0139 There could be an entire module that would allow the user to hook their macros
0140 on various events; it may also provide something like /invokeevent to allow
0141 hooking on custom events (something like /notify for external scripts).
0142 
0143 Custom commands and functions
0144 -----------------------------
0145 There will be some plug-in that will allow custom commands (similar to aliases,
0146 but it'd be clear that these are custom commands and not MUD commands) and
0147 functions (these can then be included in []-eval blocks).
0148 Functions need to return some value.
0149 The function is simply a list of expressions + possibility to assign result
0150 of that expression to some variable (expressions can't do that natively due
0151 to immediate variable expansion)
0152 Some special variable holding result of last expression will also be useful.
0153 Result of the very last expression of the function shall be the return value
0154 of the whole function.
0155 Recursive calls may also be allowed (LIMITED due to lack of local
0156 variables).
0157 
0158 Tags
0159 ----
0160 - each object can have a tag (more tags?).
0161 - you can export all objects with some tag(s) or import them, possibly renaming
0162 each tag, or delete all existing objects with a given tag and import new ones,
0163 or whatever you want.
0164 - list of defined tags + some description...
0165