Before I just write it myself: Is there any prexisting commands or function sets to echo segments of a file to the screen? For example, if I have a text file of the below format:
;;id,index name
This is a text message
This is a text message
This is a text message
;;id,index name
(etc)
I would pass id/or index name to the function, and it would respond by echoing the associated contents. Even better would be rendering html, and allowing use of formatting/image linking/etc
Function to print indexed text from file?
-
- Posts: 334
- Joined: Thu Mar 05, 2015 2:53 am
-
- Posts: 334
- Joined: Thu Mar 05, 2015 2:53 am
Re: Function to print indexed text from file?
Hadn't heard anything one way or the other, so wrote a quick function to do so - It's extremely basic, just text to screen/doesn't handle colors/html/etc. Quite likely has bugs, I haven't used it excessively yet. The main thing is I need to write some usage documentation for my mudlet package, and this lets me easily organize/edit it in a single file.
The datafile is of the format
;;number,item name
text
text
;;number,item name
etc
Usage: typing '#help' prints the contents of 'index'. '#help anythingelse' searches the file for the 'anythingelse'' entry, and echoes that to the screen.
The above code is inside a '#help' alias, the pattern for it is ^#help ?(.*)?
The datafile is of the format
;;number,item name
text
text
;;number,item name
etc
Usage: typing '#help' prints the contents of 'index'. '#help anythingelse' searches the file for the 'anythingelse'' entry, and echoes that to the screen.