So, I have no scripting/coding know-how at all.
I'd like to start slowly building up my knowledge base into a functional approach to hunting and eventually pvp.
Right now, I'm trying to figure out how to do this:
I would like to be able to do something like: t guard to target "guard"
k to then "kill guard"
I figure eventually I'll know how to do neat stuff having to do with equilibrium and corpse gathering, but this is where I want to start.
0
Comments
http://wiki.mudlet.org/w/Manual:Introduction#Making_a_Targetting_Alias
got gud
Make a new ALIAS:
Name: Whatever you want. I called mine TARGET
Pattern: ^t (\w+)
Then in the large box: target = matches[2]
( This sets the variable named "target" to whatever follows the t )
You can make another ALIAS for k that does what you want...
ALIAS - PATTERN: ^k$
Big box: send("kill "..target)
Be sure to leave a space after "kill". And when you call a variable in this manner (in this case, your "target" variable) you do so by using the ..<variable name>. You close the quotes before the variable so it won't just output kill ..target to your screen.
You can do it a couple ways. Make a new KEY
Name it whatever you want
Key Binding: Click "Grab New Key" and hit F1
in the large box you can just put the send("kill "..target)
OR if you made the alias already for kill.. you change the last step to :
expandAlias("k")
Too cost intensive down the line when you need to worry about process speed etc
Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
Looking in the wrong place is super unhelpful.
got gud
Ctrl+C, for instance.
Chances are if all they are doing is bashing to start, they don't need to have 1337 processing, ya know?
That said, my general rule (that I often don't follow when quickly hacking things together) is that if you're repeating code in more than one place, it should be a function. Use of expandAlias is a pretty good indicator that it's being used in more than one place (even if you're not actually duplicating the code) and therefore should probably be a function.
Results of disembowel testing | Knight limb counter | GMCP AB files
I'm still finding code from years ago that makes me twitch to read it.
Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
Basically, with both of these things, and actually also with a lot of gmcp stuff (which is related to the event stuff) you can't "get the thing" or "do the thing with the function" until you somehow "call" the function.
Other than that, I understand a function as being almost like an alias... or really, just about ANYTHING. It is like some kind of "script" that you can plug in multiple places without rewriting it over and over (which yes, I get it, it's silly, and I actually am well past the point where it's genuinely cumbersome). But I just do not understand how to "talk" to the function to say "come HERE and do those things I have in you", and all of the tutorials I have ever watched or read just don't make sense (which is why the above is almost certainly a bit word salad-y).
I feel like if I could get functions, I could finally consider tackling tables sometime after that. Maybe.
You're there. I first viewed functions as aliases that were hard-coded into the system. You could actually put your code into an alias, and then call that alias on a couple different triggers to produce an effect like having a function. But functions are better - like super aliases.
Just like any alias, the function has to be defined. For that, you'll need a new script file. Then just define your new function inside the script item like so:
clock = {}; -- create an empty table when the script loads
That alone will do nothing. It shines when we put it in a couple triggers though:
trigger 1 - string to match:
The glassy obsidian of Achaea's innermost ring gleams with a dark lustre in the swiftly advancing daylight.
trigger 1 - in the box:
ClockSetTime("8", "48", "yes")
trigger 2 - string to match:
The shadows have lengthened. It is late afternoon in Achaea.
trigger 2 - in the box:
ClockSetTime("15", "12", "no")
If you wanted to flesh out that clock, you'd get the couple dozen other time patterns from the game and tie them to the corresponding numbers (you can find by timing out an achaea day, grabbing those patterns, and checking TIME for the related patterns there). Then you could add a timer that fires every 2.5 seconds (an achaean minute) and adjusts the clock table's variables. Now stick those tabled variables, clock.hour and clock.minute, in a miniwindow somewhere and you have an in-game wristwatch.
I don't mess with event handlers in mudlet (i use mushclient) so I can't offer as much help there, but it helps to think of event handlers as pre-defined triggers, of sorts. For example, you create a trigger for "You bleed 100 health." Think of that now as an event, that fires on bleeding 100 health.
When achaea sends you gmcp info, for example your vitals, there is an "event" for it that will execute (like a trigger) the functions that are tied to it. Events are nice because they can be triggered by something you don't see (like receiving gmcp info).
Hopefully that helped a little.
Currently available: Abs, Cnote, Keepalive, Lootpet, Mapmod
When you create an event you're essentially creating a code trigger that tells the code looking for that particular event to fire, so you can effectively modify a script without actually changing that script - by having the original script send an event, and creating scripts that use that event to do something.
An example of where this is useful - say you want to keep a third party script up to date but also have your own additions to the code that you need. Instead of having to rewrite the script every time the original author updates it, if they include events you can write your own script that hooks into the code seamlessly after updates.
http://forums.achaea.com/discussion/1264/mudlet-caputring-tells-to-a-separate-window
Such as
(Clan): Please welcome Smith to the Clan!
I would like to say:
(Clan): Welcome, Smith!
This is what I have that is not working:
^\(Clan\): John says, "Please welcome (\w+)
send("clt Welcome, " ..matches[2].."! Enjoy!")
--- It will "activate" but is not working.
I used to have a bunch of these in ZMud, but can't figure out how to do it in Mudlet.
- To love another person is to see the face of G/d
- Let me get my hat and my knife
- It's your apple, take a bite
- Don't dream it ... be it
You might be missing a few of the '\'.
Try this: \(Clan\)\: John says\, \"Please welcome (\w+)
send("clt Welcome, " ..matches[2].."! Enjoy!")
Side note, you usually don't want to do this because you will get newbies like "Turdswallower" that you'd probably rather not greet.
Or someone illusioning other stuff.
You're right. Do NOT want to greet the Turdswallower!
But it does frustrate me when I can't figure something out.
Can't make sounds work at all - and that was another zMud favorite.
I would send a Grove Gate on certain triggers, and my computer play would "Carry on my Wayward son" and I'd come running if I was slightly afk.
Although could also auto rezz a dropped body.
That did get me in trouble once.
- To love another person is to see the face of G/d
- Let me get my hat and my knife
- It's your apple, take a bite
- Don't dream it ... be it