![]() ![]() If you want to highlight the entire match this way, you can put parentheses around the entire pattern which will make it all a capture group as well, and thus highlighted. Now for regex triggers if you check off highlight it will highlight the capture groups for the trigger only. Lua allows you to omit the parentheses when you call a function with only a single string or table parameter, but it is generally not considered best practice to do so, and using f for string interpolation like this is the only place I typically use this capability myself.Īnd now back in the main window, we get the information echoed back to us when we use our alias The value of whatever it finds between the curly brackets in the string you feed to it will be used in that place in the string. ![]() The information in the Basic Scripting video holds true for triggers as well, so let's start this with demonnic = demonnic or ") cecho lets us print color text to the screen, and f is a function which lets you do string interpolation. Let's click on "Save Item" and get started on the script that will handle the tracking for us. We will use this pattern to track the gold we've picked up this play session. It needs a pattern, so let's go with something simple for now, You pick up (\d ) gold\.$ The color for this pattern line changes from black to blue to give a visual clue as to what type of trigger it is. ![]() Then let's click the dropdown next to the first pattern and change it from substring to perl regex. Then let's click "Add Item" and name this one "Regex1". I'll start by making a group to keep my triggers organized, call it "Basic Regex Triggers", and click "Save Item". Now with the preamble out of the way, let's begin by clicking Triggers to open the script editor up to the Triggers page. There are also links to some helpful resources for learning more about regular expressions, as well as testing and analyzing regular expressions which are touched on in the basic regular expressions video. There are links in the description for them if you'd like to review them before moving on. We have a basic regular expressions video as well as a basic substring trigger video which you may find it helpful to view first. In this tutorial, I will cover regular expression, or "perl regex" triggers in Mudlet, how to use them to extract information from your game, and some things to keep in mind when making use of them. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |