Synopsis: TEDIT - text entry database - description and usage. April 98 Date: Tue, 21 Apr 1998 21:19:12 +0200 (MET DST) From: "Erwin S. Andreasen" To: Dave Clapper cc: Rom Mailing List Subject: RE: Suggestions wanted (I may regret this...) On Tue, 21 Apr 1998, Dave Clapper wrote: > Here, here! Removing titles was one of the first things I did when > starting over. The more classes you add, the more unwieldy that table > becomes. And, if I recall correctly, R's Legacy doesn't even allow > characters to change their titles: they have to be changed by imms. You're > not the only one with this personal gripe. Now we are on the subject of preinitialized tables of data: I have personally moved just about everything that is an array of text or numbers into a virtual file system. The file system part is just for organizing it - but the idea is that something like say, a list of titles is in a text entry (a text "file"). That text entry has name, and can be edited (just using the standard string editor). It also saves/load from disk. So, the text entry that contains titles for the Mage class would be in the file sys/titles/Mage. The code that sets the title would look something like this: sprintf(buf, "sys/titles/%s", class_table[ch->class_no].name); const char *title = get_entry(buf, ch->level); if (title) set_title(ch, title); The get_entry function will find this file and get the Nth entry in it, or return NULL. A few other helper functions also exist, like random_message, which picks any random string from a given file. This is useful for a hint system for example: the file sys/hints contains all the hints messages.. and once per tick, a newbie with the HINT channel on just gets: random_message("sys/hints") sent to him. That hint system used once have 50 lines of code: load_hints, save_hints, a function of listing current hints, one for editing and a command to do so. All that was replaced by 1 line of code with the text file system. So as you can see, the system is extremely powerful and can make online editing of data much easier. I have text entries for the following things: time names (month, year, day, time of day), poses, various global parameters, objects that are creatd when you cast Create Food, stat names for str. etc stats (e.g. low, very low, average), death messages sent when someone is killed with a certain type of weapon/spell, stories that Bards can tell, all the greeting screens (one file contains a list with names of greeting screens, and then a random one is picked), newbie equipment based on class race (e.g. sys/equipment/drow is the list of EQ that drow get), titles that newbies get, messages mobs say when they attack you after you attacked them and fled, insults mobs shout when they kill you ... etc. Mobprogs can also use the text files: pick a random or set line from them, or write to them. Admins can also use it for notes. And finally, they can be used to temporarily create new files or annotations to existing files (e.g. help/files/combat will add a new help file named "combat" and help/annot/summary will append the text in there to the 'help summary' whenever someone requests it). Oh yeah, finding a given line in a file is fast, since the file is indexed: the text entry contains an array containing the start offset of each line - that array is recreated whenever someone changes the entry. ============================================================================== Erwin Andreasen Herlev, Denmark UNIX System Programmer <*> (not speaking for) DDE ==============================================================================