![]() If anyone has any ideas how to set a trigger to find the room name, please let me know. Beginners should use Mudlets automated highlight triggers in the beginning to highlight the text that has been triggered on to get the hang of the different trigger and pattern types. Maybe reference the Lua function getRooms ( ) I don't know. These instructions will build TheFaes modded Mudlet. I'm tired I will look into it more later.SomeStr = "He-Who-Must-Not-Be-Named is an evil man. SomeStr = someStr:gsub("He%-Who%-Must%-Not%-Be%-Named", "Voldemort") He-Who-Must-Not-Be-Named needs his reign ended, now!" Lua Function reconnect() now accepts three optional arguments, Host (string), Port (integer). This function is safe to define at a top-level of a Mudlet script: in fact it is recommended you run this function at a top-level without any kind of guards. If you want to learn more about patterns for gsub, take a swing over to this page. Reverse the order of characters in a string:įunctions make life a lot easier, and I've opted to avoid them until this point because I was hoping you'd get a hang of everything up until this point, first. ![]() However, you can pass variables into the function and do things with them, and then have the function return a value as well.įunction someOtherFunctionName (var1, var2, var3 ) Functions are best if you plan to repeat certain steps over and over. I cannibalized the following example from another IRE game's forums, though I can't recall which or who wrote it. The above looks through a table and if the item you're looking for is in the table, will return the index (or key) for it. Could be very useful if you're trying to determine if you should add something to a table or not!. ![]() Functions: Code to be performed, either on its own, on a variable, or on a collection of variables. Mudlet string functions code#īut there are two similar functions to this for tables that exist. I don't often use table functions aside from getn, insert and remove, but these will provide you with extra mobility when dealing with your coding. Like our function example, contains works nearly the same way, except it returns no value, only true or false. Returns the number of items within a table.Īgain, like our function example, index_of works nearly the same way, except that it returns a value or nil.Īdds a value to a table. Table.insert(tableName, location, value ) It has an optional parameter that tells it where in the table the value should be added. If you're interested in doing GUI stuff, you'll want to learn CSS before Mudlet's Geyser. If you're interested in databases, you'll want to take a look at LuaSQL lite. I can understand if you would rather see me find the answer on my own Vadi and you have been a great help in the past but I've spent two days on this one issue already.I know how to do both of these, and could write up a mini primer for each, but that takes a long time and a lot of patience. It looks like it would possibly sort a table in ascending or descending order or group things so that all the similar room numbers are sequential for example. Although I can follow the tutorial examples (monkey-see monkey-do style), the Lua manual itself seems to me to be written in a first principals many of which have definitions I don't fully understand. If there is a better way to do this I'm all ears as I sense there is a very elegant way to do what I want but it eludes me. As a matter of fact I need to keep rewriting what I've scripted in the past as I learn new things because I tend to beat things to death with large blocks of "clumsy" code at first. I am no programmer and probably will never be nearly as good as most people at scripting. I think your suggestions can probably be made to work.
0 Comments
Leave a Reply. |