Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sat Dec 01, 2007 2:45 pm   

Idea[2.14] %scroll
 
I was thinking that with the %line function we can retrieve lines, but when it comes to making a system that automatically configures itself to a mud we need a way to search the scroll back buffer. There already is a way in the #SCROLL command, but the usage of it is messy for this and there is no way to know how many lines were returned. I am proposing a function version of this be made.

Syntax: %scroll(pattern,var1,var2,...varN)
Returns a list of lines that matched the specified pattern. 0 is the most recent line, 1 is the next oldest, etc. The optional VarN arguments contain the names of variables to store any captured subpatterns (subpatterns surrounded by parenthesis). The captured subpatterns are be in the form of a list. If no lines match null is returned and any variables in the varN arguments are unchanged.

Example:
Code:
#SHOW This is a line.
#SHOW This is another line!
#SHOW Yet another line of text.
#SHOW That should be enough lines.
#SHOW %scroll("^T") %scroll("(%w).$",LastWord) %scroll("another") @LastWord
Displays:
This is a line.
This is another line!
Yet another line of text.
That should be enough lines.
0|2|3 0|1|3 1|2 lines|text|line

The varN part might be over the top.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Dec 03, 2007 5:45 pm   
 
I'll add that to the wish list for the future.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net