They have to be called in a trigger, or keybinding, or alias, or something like that. You can't call Lua functions from the main console. Here are some general learnings for anyone else stumbling on this thread X years from now: In my case, it was a local function, so it couldn't be called outside of the script. :pįor what it's worth, I figured out what was going on here. Want to be a part of an /r/MUD project? Fellow Redditors are lending their talents to an official RMUD codebase and game! Check it out and lend a hand! You can follow /r/mud using the rss feed or on twitter. Use the following links to only show posts of that type. Making it that much more sensitive.Welcome to /r/MUD, covering MUD, MUSH, MUX, MOO, and all other MU* variants! The "\" at the end of the regex code indicates that the character between it and the "$" symbol is the last character in the string. In this instance it would execute the code "await Vaxarn." Now take note, that if you saw - Vaxarn arrives from the ether and dies.- nothing would happen. This code then sends two commands one to dash to the north and the other to await whatever was captured. Ie, if you get - Vaxarn arrives from the ether - it will execute the code successfully. Above you'll see that the capture is going to grab anything and everything before the word "arrives" if the rest of the trigger line is indeed called. Now, it's noted that all of the command lines to be executed below the triggers are all scripted in Lua, so some functions may be a little confusing at first, but eventually you'll get the hang of it. Here's an example of a successfull variable set from a trigger. Just as when the Alias mentioned above captures everything between the "z" character and the pressing the enter key, triggers can be set to capturing specific lines as well. Setting triggers as a perl regex code is the simplest and most effective way of creating and adjusting variables. Triggers lines can be set to an Exact Match, beginning of line substring, a substring, or a perl regex code. Now when a code comes across your screen saying that "A cat enters the room." you will instantaneously pet the cute little thing! Now, just as aliases are case sensitive Triggers are as well. and set the command to be executed as - send("pet cat"). Triggers are lines of code that you tell the system "if this comes across the screen then execute the command listed below." One can enter into a trigger line - A cat enters the room. The easiest explanation of a trigger in the Mudlet environment is a giant "if/then" statement. The periods before and after the quotations are needed to indicate that the word before, in between of, or after them is a variable and it needs to put it's value there. When using a variable in a Lua script if it's not in a command that is to be sent it can be left alone for further evaluation, like - if target = "Vaxarn" then send("attack ".target). Values can be set to variables by either using aliases or triggers. Basically until you hit the enter key, you're going to set the variable's value to whatever you have just put as the input. So if i entered "z rock" into the input line it would get the value as "rock". var = matches - This would set the variable "var" to the captured value. Not this is useless unless you assign a specified variable to it.įor the regex line listed above the captured line can be set to a variable by using the "matches" function. This captures anything and everything after "z" until i hit the enter key. The Perl Regex line that i use is ^z (\w )$. One that i use often is my targeting script. Most of the time we tell what value to set to what variable. Variables are items that have values associated with them.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |