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
➜ General
➜ Alias including a Variable
Alias including a Variable
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Morgoth
Israel (38 posts) Bio
|
Date
| Mon 16 Jun 2003 03:01 PM (UTC) |
Message
| Ok, here's what I want to do, but not sure how to.
I want to have an alias for example called 1,
envenom weapon1variable with venomname
envenom weapon2variable with venomname
So then I could make aliases that make subs set the variable to what I want. Is this possible? | Top |
|
Posted by
| Morgoth
Israel (38 posts) Bio
|
Date
| Reply #1 on Mon 16 Jun 2003 08:10 PM (UTC) |
Message
| OK I have it half solved. Each alias calls a sub that envenoms. I have two variables called weapon1, Weapon2.
Dim Weapon1, Weapon2
Sub Envenom1 (name,output,wildcs)
Dim Envenom
Envenom = split(name, "_")
Select Case Envenom(0)
Case "1"
world.send "Envenom world.getvariable ("weapon1") with epteth"
world.send "Envenom world.getvariable ("weapon2" with epteth"
Case 2.....
What I need to know is if the part with the world.send is accurate. If not, please tell me how I would write it exactly.
Thanks.
P.S - PLEASE REPLY | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #2 on Mon 16 Jun 2003 08:55 PM (UTC) Amended on Mon 16 Jun 2003 09:42 PM (UTC) by Flannel
|
Message
| the send line would be
world.send "Envenom " & world.getvariable("weapon1")& " with epteth"
world.send "Envenom " & world.getvariable("weapon2") & " with epteth"
Otherwise, It would send the text, as text, and not try to evaluate it as a function. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Bobble
Canada (76 posts) Bio
|
Date
| Reply #3 on Fri 20 Jun 2003 03:44 PM (UTC) Amended on Fri 20 Jun 2003 03:45 PM (UTC) by Bobble
|
Message
| Also, to save on a bit of typing, (depending on how many venom combos you're using). You can try this
Dim Weapon1, Weapon2
Sub Envenom1 (name,output,wildcs)
Dim Envenom
Envenom = split(name, "_")
weapon1 = world.getvariable ("weapon1")
weapon2 = world.getvariable ("weapon2")
Select Case Envenom(0)
Case "1"
world.send "Envenom " & weapon1 & " with epteth"
world.send "Envenom " & weapon2 & " with epteth"
Case 2.....
I just find this easier than typing world.getvariable over and over again.
Which do you play? Achaea, Aetolia or Imperian? |
Open the watch. | Top |
|
Posted by
| Gore
(207 posts) Bio
|
Date
| Reply #4 on Tue 24 Jun 2003 11:46 PM (UTC) |
Message
| in response to venoms, I use alt + the numpad keys for macros, well, used to with zMUD, is there anyway to use those macros with MUSHClient? And I'm having trouble trying to call a variable to a macro. With zmud, I'd have a variable called "Tar", short for target, and in F1, it would send dsl @tar, or dsl morgoth for instance. can anyone help me with this? | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #5 on Wed 25 Jun 2003 12:44 AM (UTC) |
Message
| Mushclient you can use straight numpad keys, as well as Ctrl-Numpad Keys. Along with a bunch of other combinations (see the Macro and Keypad menus).
As for the variable, youll have to do a little bit of scripting, Make the keypad send text that also coincides with an alias, then itll call the alias when you press the button, then have the alias send what you want (via scripting) |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Gore
(207 posts) Bio
|
Date
| Reply #6 on Wed 25 Jun 2003 01:51 AM (UTC) |
Message
| Alright, how exactly do you set up a macro for ctrl + keypad and alt+, I didn't seem them listed in the macros.. and I don't think I saw an add one. As for the variables, you pretty much make an alias, and put the alias in the macro? | Top |
|
Posted by
| Bobble
Canada (76 posts) Bio
|
Date
| Reply #7 on Wed 25 Jun 2003 01:52 AM (UTC) Amended on Wed 25 Jun 2003 01:53 AM (UTC) by Bobble
|
Message
| Hey Gore,
To get the macro to work, you need a tiny bit of scripting. I don't think there's a way to call a variable into a macro, but you can call an alias from a macro, and within that alias you can call variables.
To set the target variable, you might create an alias:
^tar (.+)
make it a regular expression and have it call a subroutine like:
sub target (a, b, c)
world.setvariable "tar", c(1)
end sub
Then create an alias called:
dsl
which sends: dsl @tar
make sure to check the "expand variables" option in the alias
then create your macro with this in it:
dsl
that's about it! Lemme know if it works. |
Open the watch. | Top |
|
Posted by
| Gore
(207 posts) Bio
|
Date
| Reply #8 on Wed 25 Jun 2003 01:58 AM (UTC) |
Message
| hrm, thank you but that kind of went over my head. Right now I just have a plain alias named Sta *
that sends to variable, that variable being Tar, and it sends %1
and wouldn't I get an infinite loop If I named the alias dsl? That's the name of the command. I will try it out, however.. I didn't understand what you ment by:
^tar (.+) | Top |
|
Posted by
| Bobble
Canada (76 posts) Bio
|
Date
| Reply #9 on Wed 25 Jun 2003 02:39 AM (UTC) |
Message
|
Quote: Right now I just have a plain alias named Sta *
that sends to variable, that variable being Tar, and it sends %1
Hmm, I didn't quite follow that, how do you set a variable from an alias without using a script?
Quote: and wouldn't I get an infinite loop If I named the alias dsl? That's the name of the command.
I don't think so. Why do you think you would? The macro is going to send "dsl", but MUSHclient is going to pick that up as matching the alias "dsl". When it calls that alias it's going to send "dsl @target" Why would that loop? (I'm not being facetious or sarcastic, it's entirely possible that I've missed something)
Quote: I didn't understand what you ment by:
^tar (.+)
^tar (.+) is what you would put in for your alias, then you would make sure to check the "regular expression" option.
You might not be familiar with regular expressions if you're coming over from zMUD. It doesn't use them very well. In MUSHclient, regular expressions make aliases and triggers much more versatile.
http://www.gammon.com.au/mushclient/funwithtriggers.htm
Suppose you wanted to set your target by typing "tar <targetname>" Like "tar exodus" In this case the ^ means match only if this is typed at the beginning of a line (so if you entered "the tar is sticky" it wouldn't match because tar doesn't appear at the beginning of the sentence. The .+ means match any sequence of anything (kinda like * in zMUD). The brackets around it tell MUSHclient to save whatever .+ is as a parameter (in my example, exodus would be saved as the parameter).
|
Open the watch. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #10 on Wed 25 Jun 2003 05:34 AM (UTC) |
Message
|
Quote:
Hmm, I didn't quite follow that, how do you set a variable from an alias without using a script?
An alias can "send to variable", thus %1 would set the variable.
Quote:
and wouldn't I get an infinite loop If I named the alias dsl? That's the name of the command.
The name doesn't matter, it is like a label. However there are ways you can set up loops, however MUSHclient has an "infinite loop preventer".
For example, say you had an alias that matches "blah" and sends "blah" and - and this is important - sends it to "execute" then you have a loop. It will send "blah", that will match again, it sends "blah" again, and so on. However MUSHclient detects that and stops it after 20 loops. You can try a test to see, and after typing "blah" see how many times the alias matched - it will be 20.
However normally you send the alias to the world, not to "execute" which means if you send "blah" then it goes to the MUD (probably generating a "Huh?" response) and does not cause any loops.
In your case I don't think this applies, but it is good to know it shouldn't be a major problem. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Gore
(207 posts) Bio
|
Date
| Reply #11 on Wed 25 Jun 2003 08:57 PM (UTC) |
Message
| I must say, that's really neat. I'm .. pretty new to scripting with VBScript, I've programmed in the past with VB 3.0 ("old school".. and outdated). I have a few questions about macros, but I guess I'll make a new subject for that. Thanks again everyone. | 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.
37,945 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top