giftts.blogg.se

Mudlet tables
Mudlet tables











mudlet tables
  1. #Mudlet tables how to
  2. #Mudlet tables code

Send is the Mudlet's basic function to send something to the game as though you'd typed it in as a command. If I type a basic instruction in here, such as send("hello"), and click save, you can see in the main screen here that it's performed that send immediately. Scripts are run every time you save them, and also once when the profile loads, so they're a great place to put functions which you will use later on in your triggers and aliases so they're already defined and ready to go by the time you connect to your game. This is where we will put all of our Lua instructions. These are used for dealing with events, which are a Mudlet feature which will get their own video soon, but in the meantime we can pretend these don't exist and concern ourselves primarily with this big box down here.

mudlet tables

Ok, over here on the right I just want to acknowledge the existence of the "Registered Event Handlers" and "Add User Event Handler" sections. Now over here on the left, you can use the dropdown marker to show or hide the scripts in this group, which can make it a lot easier when browsing through things later. Let's just give this a name and then save it. Then when we click on Add Item it will create the new script object inside of the folder we just created. I'll just name this 'Tutorial Scripts' or something obvious, and then we'll click on Save Item.

#Mudlet tables code

You can put code in these if you like, but I primarily use them to keep things tidy and organized in my script editor.

mudlet tables

Then we will click on Add Group to create a folder to organize our scripts in. So let's get started by clicking on scripts to bring up the script editor.

#Mudlet tables how to

Specifically, I will be covering how to create a script in Mudlet, how to write a function to group repeated actions together, and how to pass information into functions. Lua is a light weight and speedy scripting language well suited for embedding in other programs. " \n " end end setClipboardText ( parsed ) end registerAnonymousEventHandler ( "onMouseCopyExample", "onMouseCopyExample" ) ansi2decho ansi2decho(text, default_colour) Converts ANSI colour sequences in text to colour tags that can be processed by the decho() function.In this tutorial we will be going over creating basic scripts for Mudlet. symbol end end if l ~= endRow then parsed = parsed. symbol else lastColor = color parsed = parsed. An example showing implementing a hecho-friendly copy option: addMouseEvent ( "hecho copy", "onMouseCopyExample" ) function rgbToHex ( r, g, b ) local rgb = ( r * 0x10000 ) + ( g * 0x100 ) + b return string.format ( "#%x", rgb ) end function onMouseCopyExample ( event, menu, window, startCol, startRow, endCol, endRow ) - Check whether there's an actual selection if startCol = endCol and startRow = endRow then return end local parsed = "" local lastColor = nil - Loop through each symbol within the range for l = startRow, endRow do local cStart = l = startRow and startCol or 0 moveCursor ( window, cStart, l ) local cEnd = l = endRow and endCol or # getCurrentLine () - 1 for c = cStart, cEnd do selectSection ( window, c, 1 ) local symbol = getSelection ( window ) or "" - Convert the foreground color to a hex format, suitable for hecho local color = rgbToHex ( getFgColor ( window )) - Don't repeat the color if previous one was the same if color = lastColor then parsed = parsed. They deal mainly with miniconsole/label/gauge creation and manipulation as well as displaying or formatting information on the screen.ĪddCommandLineMenuEvent addCommandLineMenuEvent( label, eventName)Īdds item to right click menu associated with command line. All functions that help you construct custom GUIs.













Mudlet tables