Alias including a Variable

Posted by Morgoth on Mon 16 Jun 2003 03:01 PM — 12 posts, 50,452 views.

Israel #0
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?
Israel #1
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
USA #2
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.
Amended on Mon 16 Jun 2003 09:42 PM by Flannel
Canada #3
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?
Amended on Fri 20 Jun 2003 03:45 PM by Bobble
#4
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?
USA #5
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)
#6
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?
Canada #7
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.
Amended on Wed 25 Jun 2003 01:53 AM by Bobble
#8
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 (.+)
Canada #9
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).
Australia Forum Administrator #10
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.
#11
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.