![]() MoveCursor( "main", 20, 3950 ) will move the cursor on the 20th character from the left on line number 3950. MoveCursor( windowName, x, y ) This will move the user cursor of window windowName to the absolute (x/y) coordinates in the text. These are the tools to help you with the job: Mudlet allows you to insert text arbitrarily within the buffer - in the previous line, in the previous ten lines, or even the first line that you've ever saw. Then the output will be changed to: "Mary and walk to the diner." SelectString ( "Tom", 1 ) replace ( "" ) This could be done with following script: Replacing the word "Tom" with "Betty" in the line: Jim, Tom and Lucy are learning a new spell. ![]() You select a word or a sequence of characters from the line and then issue commands to do actions on the selected data. If you want to edit, replace, delete or reformat text from within your trigger scripts you have to keep this in mind if you don’t want to lose all text format information such as colors etc.Īs the text is linked with data structures containing the format of the text, the cursor position inside the line is important if data is being changed. Consequently, the text that is being passed on to the trigger processing unit is a small subset of the data received from the MUD. Before triggers can be run on the MUD data, Mudlet has to strip all format codes from the text and store it in data structures associated with the text. However, things get much more complicated with the data received from the MUD, from now on referred to as input stream. When sending commands to the MUD - from now on referred to as output stream - alias scripts find the command that was issued by the user stored in the variable "command".īy manipulating the value, the command can easily be changed before it is being sent to the MUD. This will send the data directly and bypass the alias expansion.Ĭhanging and formatting text from the MUD You have to use send( ) inside an alias script to prevent recursion. If you use expandAlias( command ) inside an alias script the command would be doubled. Note: The variable "command" contains what was entered in the command line or issued via the expandAlias( ) function. 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.
0 Comments
Leave a Reply. |