Metzger
Jun 10 2007, 10:28 PM
I wonder if anyone has already done what I'm looking for. Right now, I use predefined aliases for my venoms and I have quite a few of them. But I'm interested in something a little more flexible.
So I got it set up to where if I do
V A C
It envenoms with Aconite and Curare
and if I do
V C A
It envenoms with Curare, and then Aconite.
The problem I'm having is I want no spaces, and if I do this in the actual alias line
v%1%2
ZMud has no idea what I'm trying to do when I input vac, vca
According to the manual, it says you can use ? to denote a single character. However, it doesn't seem to work. v?? in the alias, and in game vac, vca, there's no go.
Any ideas on how to match a single alphabet character?
Darroth
Jun 10 2007, 10:35 PM
Why Don't you just make variables like @leftwield and @rightwield with your weapons in them reflexed to set when you wield. Then simple aliases like #alias vac envenom @leftwield with aconite;envenom @rightwield with curare
Metzger
Jun 10 2007, 10:38 PM
That's what I have. I have a couple dozen of them. Alas, I keep thinking up stuff on the spur of the moment to do that I don't have in my system. So what I'd like to do is have a backup system that lets me customize in an instant, rather than having to write another alias.
Darroth
Jun 10 2007, 10:40 PM
You seem bored.
Merulac
Jun 10 2007, 10:47 PM
Make an onimput trigger with the pattern v(\w)?(\w)?
That will do what you want easily.
kinilan
Jun 10 2007, 11:02 PM
I find buttons are so much easier. I've got two sets one for my axes and one for my rapiers. I find it is much easier to envenom that way rather than how I used to do it with aliases. plus I can envenom while I hit the ol' DSL button.
Trevize
Jun 10 2007, 11:09 PM
If you don't mind having just one space, you can set it up so V AC and V CA would work. Just set it to check the %begins and %ends of %1. Without using oninput triggers, that's the best I can come up with.
Xandeus
Jun 11 2007, 12:07 AM
Solution would be to create a "command input" trigger. As your pattern to match use: v(\w)(\w)
In your code #gag the original command (vac, etc) and do whatever you want with the %1 and %2 variables. Doing it with a command input trigger is much more flexible in this case than an alias because with an alias you'd need to create an alias for every possible combination.
Metzger
Jun 11 2007, 01:05 AM
So it'd be
#alias {v(/w)(/w)} {#if {%1="a"} {envenom @wield1 with aconite} {#if {%1="c"} {envenom @wield1 with curare} {#if {%2="a"} {envenom @wield2 with aconite} {#if {%2="c"} {envenom @wield2 with curare}
Something along those lines?
EDIT: Doin' something wrong.
Trevize
Jun 11 2007, 01:25 AM
Oninput trigger, not alias.
Xandeus
Jun 11 2007, 02:27 AM
Create a trigger and on one of the tabs choose 'command input' as the trigger type.
Merulac
Jun 11 2007, 02:42 AM
QUOTE (Metzger @ Jun 10 2007, 09:05 PM)

So it'd be
#alias {v(/w)(/w)} {#if {%1="a"} {envenom @wield1 with aconite} {#if {%1="c"} {envenom @wield1 with curare} {#if {%2="a"} {envenom @wield2 with aconite} {#if {%2="c"} {envenom @wield2 with curare}
Something along those lines?
EDIT: Doin' something wrong.
You did three things wrong there, possibly four. First, it's a trigger, not an alias. It has the "onimput" option so it triggers off the command line instead of text from the MUD. Second, you got your slashes wrong. They should be forward slashes '\' not backslashes '/'. Third, if you use the trigger verbatim the way I posted it, it needs to be a regex trigger. Now, the possible fourth thing you did wrong is use if statements. A much easier way would be to use a database variable, say @venoms, where @venoms.a == aconite, and @venoms.c == curare. Then, you could just have two commands. evenom @wield1 with @venoms.%1, and envenom @wield2 with @venoms.%2. That's the easiest way I can think of doing it, since all you need to do is make one database variable, instead of a dozen or more #if statements.
Trevize
Jun 11 2007, 06:04 AM
QUOTE (Merulac @ Jun 10 2007, 10:42 PM)

... has the "onimput" ...
That's the second time you've said that. It's oninput, not onimput.
Merulac
Jun 11 2007, 04:41 PM
well, *cough* that's what happens when I post late at night when I haven't had a day off in two weeks *shame* I'll go crawl in a corner and read a dictionary now..
Caelan
Jun 11 2007, 04:47 PM
What about something like this?
http://forums.achaea.com/index.php?showtop...amp;hl=deadeye#Easy enough to modify so instead of STU it was aco (or just 'A')
Trendor
Jun 11 2007, 07:59 PM
QUOTE (Caelan @ Jun 11 2007, 04:47 PM)

What about something like this?
http://forums.achaea.com/index.php?showtop...amp;hl=deadeye#Easy enough to modify so instead of STU it was aco (or just 'A')
Bah, Caelan beat me to it. I used something similar to what I suggested in that thread. Only difference was venoms and added in a variable for what I was wielding. It was something like this:
CODE
#alias env {envenom @wielding.left with %db(@venoms, %1);envenom @wielding.right with %db(@venoms, %2)}
The variables @wielding.left and @wielding.right would have the
number of what I was wielding in the corresponding hand. You would want to use the number because it would just envenom the first rapier, scimitar, etc. you were wielding with both venoms if you were wielding two of the same weapons. The variable @venoms was a datarecord type variable with the short name of the venom in the left-hand column and the actual long name of the venom in the right-hand column. Worked great for those on the fly changes you are looking for. Also, I'd put it in another alias "dsl" where I could do dsl aco cur. It would envenom with aconite and curare and dsl @target. Hope it helps.
Trevize, if you recognize the variables, I did get them from your weaponry script.
Metzger
Jun 11 2007, 08:54 PM
@Xandeus, Merulac
Aha. I see what you're saying. Okay. Almost there.
I have one problem left and this can be considered a success
It is a one-handed weapon.
Damage: 130 To-hit: 140 Speed: 192
A gleaming scimitar has the following venoms or magical effects on it:
7 magical enhancements.
1) curare
2) aconite
4269h, 4228m, 19030e, 19030w exdb-[ck]-
It is a one-handed weapon.
Damage: 120 To-hit: 147 Speed: 176
A gleaming scimitar has the following venoms or magical effects on it:
1) aconite
2) aconite
3) curare
4) curare
@wield2 is applying whatever venom I input twice. Here is the exact code.
v(\w)(\w)
(Perl Regular Expression box is checked, and under Options, Type, Command Input is selected)
#if {%1="a"} {envenom @wield1 with aconite} {#if {%1="c"} {envenom @wield1 with curare}}
#if {%2="a"} {envenom @wield2 with aconite} {#if {%2="c"} {envenom @wield2 with curare}}
EDIT: Both v(\w)?(\w)? and v(\w)(\w) have that same issue.
EDIT: And I use IF statements because I don't know how to work with databases.
Slick
Jun 11 2007, 08:59 PM
OnInput triggers are going to make you hate life.
I'm still stunned people are perfectly fine with 'vac' but not 'v ac.'
Metzger
Jun 11 2007, 09:08 PM
v ac envenomed with aconite and did nothing for the other sword.
v a c worked peachy. Worst comes to worst, I may end up doing that instead. But I'd like it to work this way, because I instinctively do that anyway.
Xandeus
Jun 11 2007, 09:19 PM
I've never had any particular problem with oninput triggers. They have their applications...
The reason why your alias didn't work is because your %1 would be "ac". You'd then need to use a function to strip off the letters one by one.
Anyway this is where you need to break-out your #say statements to find out exactly why you are doing what.
Try modifying it like this:
#say 1) %1 2) %2
#if {%1="a"} {#say First Weapon/First Param; envenom @wield1 with aconite} {#if {%1="c"} {#say First Weapon/Second Param; envenom @wield1 with curare}}
#if {%2="a"} {#say Second Weapon/First Param; envenom @wield2 with aconite} {#if {%2="c"} {#say Second Weapon/Second Param; envenom @wield2 with curare}}
Now you should be able to see more clearly what is going on. If you give me what it prints out I'll probably be able to tell you what's going on.
EDIT: Both v(\w)?(\w)? and v(\w)(\w) have that same issue.
You'd only need the "?" if you want to match on "v" and "va" and "vac". It means it matches if it is there or not.
EDIT: And I use IF statements because I don't know how to work with databases.
Here's how to use the DB variables:
Done one time:
#addkey venomlookup a aconite
#addkey venomlookup c curare
Done in the code:
envenom @wield1 with %db(@venomlookup, %1)
envenom @wield2 with %db(@venomlookup, %2)
Metzger
Jun 11 2007, 09:22 PM
And That's The Game!
Thanks to everyone that helped. That last quick intro on databases sealed it. Merulac is quite correct, that's a lot easier than writing an if statement for each venom.
Iocun
Jun 11 2007, 09:26 PM
I haven't ever had any problems with oninput triggers myself. I don't have that many though, and I'm not a combattant and therefore not so often in really spammy situations. There's just some things you can't do as easily with aliases. One has been mentioned in this thread, another one would be to use them in conjunction with trigger states.
Xandeus
Jun 11 2007, 09:28 PM
Glad it worked for you... and here's hoping I'm not at the receiving end of your venoms anytime soon.
Oh and a word to the paranoid you might want to consider doing some input checking to make sure a "vav" or some such error doesn't try to slip in on a typing mistake. You could actually do that in the regular expression itself by using v([ac])([ac])
Trevize
Jun 11 2007, 09:35 PM
QUOTE (Xandeus @ Jun 11 2007, 05:28 PM)

Glad it worked for you... and here's hoping I'm not at the receiving end of your venoms anytime soon.
Oh and a word to the paranoid you might want to consider doing some input checking to make sure a "vav" or some such error doesn't try to slip in on a typing mistake. You could actually do that in the regular expression itself by using v([ac])([ac])
To elaborate, anything in square brackets is a character class, which means anything inside of it is allowed. [abcdef] would allow a, b, c, d, e, and believe it or not, f. Just include only the letters you want to check.
Xandeus
Jun 11 2007, 09:37 PM
I love regular expressions.
Slick
Jun 11 2007, 09:46 PM
QUOTE (Metzger @ Jun 11 2007, 05:08 PM)

v ac envenomed with aconite and did nothing for the other sword.
That just means there was a problem with the alias code. The one I threw up here I wrote in two minutes while at work, so there's likely a syntax error in it somewhere.
Metzger
Jun 11 2007, 10:23 PM
Yeah, I'm no coder. Adding things to my system can be real touch and go. I do my best to stick to what I know, but from time to time I have some trouble. It's not that I have something against the spacebar. It's that I've been doing it this way for 2 RL years. Suddenly throwing in spaces is gonna trip me up some.
Merulac
Jun 12 2007, 02:28 AM
I kinda skipped over most of the posts on this page, because I'm a bit tired today, but I'd like to point something out. Be careful with the + and * matching options. + will force it to match one or more times, and * will force it to match 0 or more times, but they exhibit something called "greedy matching", in that they will try to match as many as they possibly can. This can cause unexpected problems. The easy way to fix this is to use "lazy matching". Basically, instead of using v(\w)(\w), or v(\w+)(\w+), a better way would be v(\w+?)(\w+?) What this makes the regex engine do is match the \w character set just once, and then move on to the next element. This way, instead of matching as many characters as it can, it matches only one.
Xandeus
Jun 12 2007, 04:49 AM
Merulac, v(\w)(\w) == v(\w+?)(\w+?) for Metzger's purposes.
Trevize
Jun 12 2007, 11:44 PM
QUOTE (Merulac @ Jun 11 2007, 10:28 PM)

I kinda skipped over most of the posts on this page, because I'm a bit tired today, but I'd like to point something out. Be careful with the + and * matching options. + will force it to match one or more times, and * will force it to match 0 or more times, but they exhibit something called "greedy matching", in that they will try to match as many as they possibly can. This can cause unexpected problems. The easy way to fix this is to use "lazy matching". Basically, instead of using v(\w)(\w), or v(\w+)(\w+), a better way would be v(\w+?)(\w+?) What this makes the regex engine do is match the \w character set just once, and then move on to the next element. This way, instead of matching as many characters as it can, it matches only one.
Actually, if you want to do that, the best way is v([abcdef]{1})([abcdef]{1}) where abcdef is a list of the letters you'll accept. What you're saying with +? is match all you can non-greedy, where as {1} says match one.
TrixR4Kidz
Oct 27 2009, 03:08 PM
Bringing up old post here. I read this thread but I am totally new to mush and scripting period so I still can't really understand it. I am just looking for how to do a alias like vac (envenom weapon1 aconite envenom weapon2 curare) but be able to use that same alias v(\w)(\w) with the database look up for each venom.
Trevize
Oct 27 2009, 11:32 PM
QUOTE (Trevize @ Jun 12 2007, 07:44 PM)

Actually, if you want to do that, the best way is v([abcdef]{1})([abcdef]{1}) where abcdef is a list of the letters you'll accept. What you're saying with +? is match all you can non-greedy, where as {1} says match one.
I don't know why I posted this.

[abcdef]{1} is the same as [abcdef]
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.