 |
nchandler77 Newbie
Joined: 20 Jan 2008 Posts: 2
|
Posted: Sun Jan 20, 2008 6:13 am
Button to loop a set of commands and wait a bit |
Hello,
I have been searching for a way to do this and haven't figured it out yet. What I usually get is a long wait, then the looped commands spewing out onto the screen n times.
What I want to do is set up a button that when pressed, will perform a series of mud commands (some with delays between them), and then wait before doing them again ad-infinito until the button is pressed again which should break out of the loop. The purpose being to sit at a trainer and 'twink train' or repetitively perform a task and rest a bit between performing the task.
Any tips? |
|
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Jan 21, 2008 1:21 am |
Simply have the button toggle a class on/off and have an alarm inside the class performing the command you want every length of time (however long the alarm delay is).
If you want it to perform multiple commands instead of repeating a single one, then make a class for each command you want, and have each alarm enable the class for the next command and disable the class it is in. Another option is to name the alarms and have them all in a single class (better option IMO) and have the alarms turn each other on and off, and then the button only has to control the class. If you do the first option have the alarms inside of classes that are in turn all inside a main class, which is then controlled by a button.
Example A (Single Command)
| Code: |
#CLASS {Training}
#BUTTON 1 {Training Off} {#T+ ToTrain} {Training On} {#T- ToTrain} {} {1} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {}
#CLASS 0
#CLASS {Training|ToTrain}
#ALARM {*5} {DoWhateverCommand}
#CLASS 0 |
Example B (Multi Commands, Single Main Class, Class Changing)
| Code: |
#CLASS {Training}
#BUTTON 1 {Training Off} {#T+ ToTrain} {Training On} {#T- ToTrain} {} {1} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {}
#CLASS 0
#CLASS {Training|ToTrain}
#CLASS {Traingin|ToTrain|Command1}
#ALARM {*5} {DoWhateverCommand1;#T+ Command2;#T- Command1}
#CLASS {Traingin|ToTrain|Command2}
#ALARM {*5} {DoWhateverCommand2;#T+ Command3;#T- Command2}
#CLASS {Traingin|ToTrain|Command3}
#ALARM {*5} {DoWhateverCommand3;#T+ Command1;#T- Command3}
#CLASS 0 |
Example C (Multiple Commands, Single Folder, Named Alarms}
| Code: |
#CLASS {Training}
#BUTTON 1 {Training Off} {#T+ ToTrain} {Training On} {#T- ToTrain} {} {1} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {}
#CLASS 0
#CLASS {Training|ToTrain}
#ALARM "Command1" {*5} {
DoWhateverCommand
#T+ Command2
#T- Command1
}
#ALARM "Command2" {*5} {
DoWhateverCommand
#T+ Command3
#T- Command2
}
#ALARM "Command3" {*5} {
DoWhateverCommand
#T+ Command1
#T- Command3
}
#CLASS 0 |
|
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
nchandler77 Newbie
Joined: 20 Jan 2008 Posts: 2
|
Posted: Mon Jan 21, 2008 11:08 am |
Ralgith, thanks very much for your response. Option 3 makes sense I think. It certainly works.
Cheers |
|
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Jan 21, 2008 8:39 pm |
Welcome. As I said, its the best option, but not everyone gets the ideas in every situation :)
|
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
|
|
|