Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ VBscript
➜ Changing Accelerators by Groups
Changing Accelerators by Groups
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Myrilith
(5 posts) Bio
|
Date
| Sat 20 Oct 2007 11:39 PM (UTC) |
Message
| I run MUSHClient from a laptop keyboard, so I'm missing the keypad to use for simple directions. I've worked out a system of Accelerators to make up for this, usually along the lines of
Accelerator "CTRL+8", "north"
I've also got a secondary set of accelerators to meet some of the common functions, and these are like
Accelerator "CTRL+ALT+8", "drink mana"
What I'm trying to do is establish a kind of group of accelerators, so that I can change modes and thus change the keybindings. For example, the CTRL+ALT+8 combination would if I was in, say, "Magic" mode, but if I was in "Combat" mode it would instead. I also have a third Debate mode.
I've worked out a system using an accel_mode variable and if-then statements to adjust what set of actions my accelerators perform. The problem that I'm running into is that if I have to re-process the script every time I change modes, or it won't register the change. It looks something like this:
if GetVariable ("accel_mode") = "combat" then
Accelerator "CTRL+ALT+8", "drink health"
end if
if GetVariable ("accel_mode") = "magic" then
Accelerator "CTRL+ALT+8", "drink mana"
end if
if GetVariable ("accel_mode") = "debate" then
Accelerator "CTRL+ALT+8", "drink bromide"
end if
If I switch modes and then re-process, it will do whichever set of actions accompanies the mode I'm in. But if I don't reprocess, I can switch modes as many times as I want and it will only do one set, the mode that was in place the last time the script was processed.
There -has- to be a better way to do this. ^.^ (BTW, I've also tried using ELSE IF statements, but didn't have any success at all with it.) What can I do?
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 21 Oct 2007 01:18 AM (UTC) |
Message
| How do you switch modes? This seems like the time to redo the accelerators.
Another way would be to make generic aliases that decide at the last moment what to do, eg.
Accelerator "CTRL+ALT+8", "ctrl+alt+8_alias"
Now make an alias which matches on "ctrl+alt+8_alias" and have it make the decision in its script (based on your current mode).
However I think it is simpler just to redo the group of accelerators at the moment you change modes. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Myrilith
(5 posts) Bio
|
Date
| Reply #2 on Sun 21 Oct 2007 02:45 AM (UTC) |
Message
| Ha! That's fantastic, Nick. For some reason, I thought that accelerators had to be loaded in some sort of world-wide script, like the one I load on startup.
It fixed a world of problems -- with this and several other things -- knowing that accelerators can be changed spontaneously like other scripts, they don't have to be... preserved... anywhere. Thanks! | Top |
|
Posted by
| Myrilith
(5 posts) Bio
|
Date
| Reply #3 on Tue 23 Oct 2007 03:43 PM (UTC) |
Message
| Okay, that worked. I went on, crafted almost the entirety of my system, and now I'm coming back to this:
Is there any way to send Accelerator commands into the command history? If it's a simple statement then I can do it without any trouble by usingAccelerator "ALT+9","/SendPush ""say Hello!"""
Several of my accelerators, though, are set to fire an alias, and I can't get these aliases to work.
For example, if I had an alias "sayhi" that would send "say Hello!" to the world, it doesn't work to useAccelerator "ALT+9","/SendPush ""sayhi"""
I can't get it to recognize that this is an alias. (BTW, I know it's a valid alias, because it works if I type it directly into the command window.)
Is there any way to make an Accelerator send an alias both into the command history and to execute immediately? | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #4 on Tue 23 Oct 2007 04:02 PM (UTC) |
Message
| The alias could do a sequence of PushCommand();SetCommand("alias itself");PushCommand(), to clear the command window, add its own match text to the window, and then clear it again, pushing itself into the command history.
If you want to keep the original text in the command window, then I suppose something like this should do it:
prev_command = GetCommand()
SelectCommand()
PasteCommmand("alias")
PushCommand()
SetCommand(prev_command)
| Top |
|
Posted by
| Myrilith
(5 posts) Bio
|
Date
| Reply #5 on Tue 23 Oct 2007 06:54 PM (UTC) |
Message
| Oh, okay -- I think I get it.
So I should set the alias itself to put the command in the history. Instead of just setting the alias to send "say Hello!" to the World, send something like "world.sendPush "say Hello!"" to Script.
Again, a simple solution. ^.^ Thanks. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
18,643 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top