Alias and Targeting in Achaea
Re: Alias and Targeting in Achaea
It's been some ten years since I played Achaea, so I can't provide you with what you need offhand.
You're going to need to create a table containing all of the armor you want to wear (if you're not trying to just do a re-wear of something forcibly taken off). Then you're going to need to determine if you have balance or not. The prompt provides this information regularly, you can parse it from there. From there, it's a simple process or wearing it when you do have balance and not trying when you don't.
Of course, if you could provide lines of all relevant text, I may be able to help you out.
You're going to need to create a table containing all of the armor you want to wear (if you're not trying to just do a re-wear of something forcibly taken off). Then you're going to need to determine if you have balance or not. The prompt provides this information regularly, you can parse it from there. From there, it's a simple process or wearing it when you do have balance and not trying when you don't.
Of course, if you could provide lines of all relevant text, I may be able to help you out.
Re: Alias and Targeting in Achaea
They are different. Lua strings are immutable, so each concat operation allocates a new string with both values. Since string.format works from the C side of things, it just uses a single buffer to assemble the final string.tsuujin wrote:it's really not different, except that using string.format makes things easier to read in large strings so I've gotten into the habit of using it for everything. using the concatenation operator ("..") works fine but looks clunky and makes it harder to debug later on in a lot of circumstances.Wennef wrote:How is this different from:tsuujin wrote:pattern: ^sst (\w+)$
you can substitute "sst" with whatever you want
body: send(string.format("strike %s sternum",matches[2]))
send("strike " .. matches[s] .. " sternum") is it better or quicker?
I don't believe there's much of a speed difference one way or the other. The concatenation operator does fewer processes on the string so would likely be faster, but the degree of which would be infinitesimal.
Take a look at http://www.lua.org/pil/11.6.html
Re: Alias and Targeting in Achaea
Yeah, over thousands of concurrent concatenations the performance issue of concatenation becomes a problem. I've dealt with this before, with Lua taking several minutes to complete what I thought to be simple concats. That said, there's only a couple of operations per string if you only concatenate once or twice and the memory usage isn't horrible.
I haven't seen any recent benchmarks, but I know back in the day there was some concern over the speed of passing information out of the lua interpreter to be handled by external functions. I have to imagine that this is no longer an issue (if it ever really was to start).
However, for the Lua novice (to whom my comment was directed) it really doesn't matter and is simply personal preference. I like string.format, because I can see the string without being broken down into small segments over, potentially, multiple lines. That said, I still use the concat. operator for simple joins from time to time.
I haven't seen any recent benchmarks, but I know back in the day there was some concern over the speed of passing information out of the lua interpreter to be handled by external functions. I have to imagine that this is no longer an issue (if it ever really was to start).
However, for the Lua novice (to whom my comment was directed) it really doesn't matter and is simply personal preference. I like string.format, because I can see the string without being broken down into small segments over, potentially, multiple lines. That said, I still use the concat. operator for simple joins from time to time.
Re: Alias and Targeting in Achaea
I'm just trying to employ something that makes me re-wear my armor when it's forcibly taken off.
You remove a suit of ring mail.
A trigger that would see that, understand when I have balance, and re-wear as soon as possible.
You remove a suit of ring mail.
A trigger that would see that, understand when I have balance, and re-wear as soon as possible.
Re: Alias and Targeting in Achaea
ok, here's what you want to do. Create a trigger for your prompt, and use regex to parse out the last few characters where your balances are stored.
Here is my prompt trigger for Midkemia Online. It won't work for you, but you can use it as a reference:
then, for your rewear trigger, you're going to check to see if you have balance when you get the item removed, and if you do you're going to simply rewear it. Otherwise, you're going to set up a tempTrigger (or something else of your choosing) to rewear it when you do have balance.
Here is my prompt trigger for Midkemia Online. It won't work for you, but you can use it as a reference:
i use this to figure out if I have balance:
Play around with that for a bit and see if you can get it working for you, or ask for more help if you need it.
then, for your rewear trigger, you're going to check to see if you have balance when you get the item removed, and if you do you're going to simply rewear it. Otherwise, you're going to set up a tempTrigger (or something else of your choosing) to rewear it when you do have balance.
Re: Alias and Targeting in Achaea
I'm not even sure what command to use that identifies I've regained balance or sees that I've regained balance so that it re-wears the armor.
Re: Alias and Targeting in Achaea
your balances are at the end of your prompt. it's probably an "e" and an "x" that appear when you do have balance. The idea is to capture your prompt with a trigger and basically ask if you have balance of not.Kyle wrote:I'm not even sure what command to use that identifies I've regained balance or sees that I've regained balance so that it re-wears the armor.
Whenever you regain balance, you'll see a line from the MUD that states you have regained it. you can use this to determine that you do, indeed, have balance again.
Re: Alias and Targeting in Achaea
I think I may have found a solution. I setup a trigger that works off a timer and immediately puts on the armor just as I gain balance.
Re: Alias and Targeting in Achaea
But what if you already have balance when you lose the armor? It'd be a waste not to just wear it right away.Kyle wrote:I think I may have found a solution. I setup a trigger that works off a timer and immediately puts on the armor just as I gain balance.