|
Stevestones01 Beginner
Joined: 25 May 2010 Posts: 14
|
Posted: Sun Jul 18, 2010 3:51 pm
Pause output |
Ok, I'm basically wondering if there is a command that will pause output until I tell it I want more to be displayed.
To give an example...when I type WHO it lists all visable people in the game, and after so many it says to type more to continue the list.. like below
Code: |
-------------------------------------------------------------------------------
Random1 - Room
Random2 - Room
Random3 - Room
Random4 - Room
Random5 - Room
Random6 - Room
Random7 - Room
Type MORE to continue reading. (78% shown)
|
So, I have an alias that reads in every one on the list and then outputs it in the format I want. However, it doesn't do that pause and type more to continue part so it just spams off of the screen. Any way to basically get it to do what it does normally? Or am I just going to have to deal with it? |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Jul 19, 2010 3:29 pm |
There are several ways you could do it. I assume you are storing the information in a variable, perhaps a stringlist variable. Create a second variable containing the number of the next item from the stringlist that needs to be displayed. When displaying, you loop through the stringlist for the number of lines you want to display, and store the number of the next item into the second variable. When you trigger the MORE, you simply do another loop, starting at the item number of the second variable. To trigger the MORE, you have a couple options.
The first option would be a trigger of ONINPUT type, with a pattern of "*", which is normally disabled and only enabled when you are waiting for a MORE. The second option would be a button which execute the MORE. As with the trigger, this button could be left disabled normally, and only enabled when waiting for a MORE--while disabled, the button would not be displayed. The third option would be the #YESNO command, which opens a dialog box with buttons. |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Jul 19, 2010 3:56 pm |
This would do 15 at a time before pausing for more input. This was written on the fly here on the board, but should be close... might be mismatched brackets.
Code: |
#ALIAS out_test {#LOOP 1-15 {#ECHO %item(@list, %i)};#VAR more_pos 16;#ECHO {More message here}}
#ALIAS more {$more_end = @more_pos + 14;#IF ($more_end > %numitems(@list)) {$more_end = %numitems(@list)};#LOOP @more_pos-$more_end {#ECHO %item(@list, %i)};#IF ($more_end < %numitems(@list)) {more_pos = @more_pos + 15;#ECHO {More message here}} {#ECHO {End of List message here, or leave this out.}}}
|
Known issue... I'm out of time so I don't have the initial alias testing to see if the more is needed. oops. Ciao. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Jul 19, 2010 4:08 pm |
Actually, I just noticed this was for CMUD... so I would do it totally a different way. Using local variable and different looping schema... give me 10 minutes.
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Jul 19, 2010 4:36 pm |
CMUD Version, man this is so much easier in CMUD... :D
Ok, here it is in XML:
Code: |
<alias name="output_test" id="32">
<value>$pages = %int((%numitems(@list) - 1) / 15) + 1
$start = 1
$end = $start + 14
#LOOP $pages {
#LOOP $start,$end {
#ECHO %item(@list, %j)
}
#IF ($pages > %i) {
#ECHO {Page %i of $pages, echo more to continue.}
$start = $start + 15
$end = $end + 15
#IF ($end > %numitems(@list)) {$end = %numitems(@list)}
#WAITFOR {more}
} {
#ECHO {List output complete.}
}
}</value>
</alias> |
And here's the alias' contents
Code: |
$pages = %int((%numitems(@list) - 1) / 15) + 1
$start = 1
$end = $start + 14
#LOOP $pages {
#LOOP $start,$end {
#ECHO %item(@list, %j)
}
#IF ($pages > %i) {
#ECHO {Page %i of $pages, echo more to continue.}
$start = $start + 15
$end = $end + 15
#IF ($end > %numitems(@list)) {$end = %numitems(@list)}
#WAITFOR {more}
} {
#ECHO {List output complete.}
}
} |
I have the script saying to "echo more" so that you're sending it with an echo instead of as a word to the MUD.
#ECHO more
will continue your script output. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Stevestones01 Beginner
Joined: 25 May 2010 Posts: 14
|
Posted: Fri Jul 23, 2010 1:49 am |
thanks for all the help. I appreciate it
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Fri Jul 23, 2010 2:15 am |
Any time, it was actually a good learning experience for me. I've only recently begun making CMUD scripts and taking advantage of the new features of CMUD (Such as #WAITFOR) in those scripts. For example, I only recently learned that #WAITFOR wont work with multi-patterns... {Patt1|Patt2} and have it fire on either. Hoping Zugg has this in CMUD 3.xx :)
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
|
|