To come back to our question how to select all occurrences of "Tom" and highlight them: cannot contain any function definitions because they are automatically generated functions themselves because this makes usage a lot easier.
because they require you to put your code in proper functions that can be called by your other trigger-scripts, timer-scripts etc. Note that script items differ from all other "scripts" in triggers, timers, actions etc. You add a function like this to a script containing you main function definitions. How to select all occurrences of "Tom" and highlight them? The defined capture groups start with 2). Note: Both selectCaptureGroup() and matches start with group 1 (which is the whole match. The best way is to use selectCaptureGroup( number ) to select the proper capture group and then perform your actions on it e.g. status_of_weapons echo ( notice ) send ( "put weapons in backpack" ) - the following 2 lines color the first capture - group red and the second group blue - see below for details selectCaptureGroup ( 2 ) setFgColor ( 255, 0, 0 ) selectCaptureGroup ( 3 ) setFgColor ( 0, 0, 255 )
Number_of_weapons = matches status_of_weapons = matches notice = number_of_weapons. If we have the table matches, matches is the first element, matches the n-th element. Lua tables can basically be considered multidimensional arrays and dictionaries at the same time. 6.1.5.12 continue: true or false (for music).4.8 Viewing and editing the database contents.3.2 How to delete the previous and current lines.3.1 Do stuff after all triggers/aliases/scripts are run.2.12 How to add a background for Mudlets buttons?.2.11 How to move the command line over?.2.9 How to enter a carriage return / enter command?.2.8 How to delete everything between two lines?.2.7 How to target self or something else?.2.6 How can I make a trigger with a next-line condition?.2.5 How can I make a key that toggles between commands?.2.4 How to play a sound when I receive communication while afk?.2.3 How to format an echo to a miniConsole?.2.2 How to highlight my current target?.1.4.1 Inserting text in the middle of the line.1.4 Cursor Movement and Cursor Placement.1.2.1 Changing and formatting text from the MUD.1.2 Sending commands or printing information messages.1.1 Lua interface functions - triggers, timers etc.However, the actual act of table declaration is innocuous, so if you are only concerned about performance, it isn't an issue.Įdit: And, for clarity, to make a global variable, all you have to do is NOT put "local" before the declaration. So long as you only have a few things going on, global level variables are usually just fine, but they can become problematic if you find yourself with a lot of different scripts, looking for room in a now cluttered name-space. If you want a local level table, then you would need to declare it in a script, because one declared in a trigger would be discarded after the trigger fired, and a totally new one would be created the next time the trigger fired. If you want a global level table, then you can declare it inside a trigger without any difficulty, so long as you declare it in a manner similar to how I did above (so that existing values are preserved if there are any, and if the variable doesn't exist yet, an empty table is created). What is the best place to declare a table? Is it okay if I put it in a trigger and it runs multiple times? Or should I put it somewhere else?