![]() ![]() Im going to give you a little bit more information about the mud I play.Ĭurrently I'm playing a mud called zombie-mud. i'm gonna give it a good read through later and see if I can't figure out how to get this to work. I've briefly read over what you've wrote. Wow Thanks for the reply and explaining thing's very thoroughly. If you have questions about what I did or why, I'd be happy to explain, just try to ask specific questions so I can give clear answers. Note that I haven't tested this, so there might be typos and bugs and such that I failed to catch.Ĭode: | lua local my_enemies = my_enemies or - clears the list of enemies in the room Here is some quickly thrown together code to help fill in the blanks, and get things going for you. And its code will look like this: reset_enemies() Your exits trigger will then call a function we will call: reset_enemies. Any character that would normally have special meaning in a trigger pattern should have a backslash before it to "escape" it, so that the pattern looks for that character, instead of interpreting it in the normal way it is used. Note the backslash before the square bracket. ![]() So, to capture that, I would use a pattern like this: ^\[Exits: In the game I play, that line looks like this: Since you don't need to actually know what the exits are, you can just trigger off the beginning of the line. Generally, the easiest thing to trigger off of here is the line that shows the exits in the room you are walking into/looking at. Note that you MUST have the parentheses after the function name, even if you aren't giving it any arguments.Īnd then you need a trigger that will tell your script to clear the list of enemies it sees in the room, so that as you move around, it doesn't continue to think that the enemies in the first room are in the second room, etc. And its code will look like this: next_enemy() The alias's code will look like this: attack_enemy(matches)Īnd then you need a key/macro, bound to F1, and it will call a function that we will call next_enemy. The alias will then call a function we will call: attack_enemy. Note that you can change the 'attack' portion to be whatever you want, like 'k' or 'aa', or whatever. The pattern will look something like this: ^attack (\w )$ Then you will need an alias, that will let you capture the names of enemies that you attack, and store in your list. That will call the function, and pass along the second match for the trigger (the first match is always the entire text matching the trigger pattern, which in this case would be the whole line). The trigger's code will look like this: check_enemy(matches) This function will be in the script mentioned above, and we are going to call it: check_enemy. The trigger will then call a function, and pass the captured name of whatever enemy to that function for it to do something with. The parentheses signify a "capture group", which means that whatever is inside them will be available to reference with your code. ![]() The square brackets group things together into a "class" of characters, any of which can be matched by that position (so the will match either 'a' or 'A'), the ? means that the preceding character is optional (so there can be a 'n' or no 'n'), and \w signifies a "word" character (letters, numbers, and underscores), and \s signifies a "white space" character, spaces, tabs, etc., and the means one or more of the preceding characters (so will match any number of word and white space characters in a row, up until capturing more will make the pattern not match any more). The ^ signifies the beginning of a line of text, and the $ signifies the end. I don't know exactly how your particular MUD signifies that, but it might have a pattern that looks something like this: Second, you will need a trigger that will look for the presence of potential enemies in the room. ![]() I'll put together some example code for that toward the bottom of the post. The script will have all of the functions that I mention later on, and it will also be used to maintain your list of targets, as a table. So, you are going to need a number of different things set up to make this work.įirst, you are going to need a script, with which everything else will interact (I like to put all the real code in scripts so you can make changes centrally, without having to find little bits in triggers and aliases and such). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |