mini window cursor control and printing demo

Post Reply
User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

mini window cursor control and printing demo

Post by Heiko »

Code: Select all

-- set up the small system message window in the top right corner 

-- determine the size of your screen
WindowWidth=0;
WindowHeight=0;
WindowWidth, WindowHeight = getMainWindowSize();

-- define a mini console named "sys" and set its background color
createMiniConsole("sys",WindowWidth-650,0,650,300)
setBackgroundColor("sys",85,55,0,255);

-- you *must* set the font size, otherwise mini windows will not work properly
setMiniConsoleFontSize("sys", 12);
-- wrap lines in window "sys" at 65 characters per line
setWindowWrap("sys", 60);
-- set default font colors and font style for window "sys"
setTextFormat("sys",0,35,255,50,50,50,0,0,0);

-- clear the window
clearUserWindow("sys")

moveCursorEnd("sys")
-- note: most functions can take an optional first window-name parameter (here: "sys")
-- that tells Mudlet which window you want to operate on. For the main screen this can be left out
-- e.g. setFgColor( 10,10,0) would set the fg color of the main screen
setFgColor("sys", 10,10,0)
setBgColor("sys", 0,0,255)
echo("sys", "test1---line1\n<this line is to be deleted>\n<this line is to be deleted also>\n")
echo("sys", "test1---line2\n")
echo("sys", "test1---line3\n")
echo("sys", "test1---line4\n")
echo("sys", "test1---line5\n")
moveCursor("sys", 1,1)

-- deleting lines 2+3
deleteLine("sys"); 
deleteLine("sys");

-- inserting a line at pos 5,2
moveCursor("sys", 5,2);
setFgColor("sys", 100,100,0)
setBgColor("sys", 255,100,0)
insertText("sys","############## line inserted at pos 2/2 ##############");

-- inserting a line at pos 0,0
moveCursor("sys", 0,0)
selectCurrentLine("sys");
setFgColor("sys", 255,155,255);
setBold( "sys", true );
setUnderline( "sys", true );
setItalics( "sys", true );
insertText("sys", "------- line inserted at: 0/0 -----\n");

setBold( "sys", true )
setUnderline( "sys", false )
setItalics( "sys", false )
setFgColor("sys", 255,100,0)
setBgColor("sys", 155,155,0)
echo("sys", "*** This is the end. ***\n");

tezoost
Posts: 1
Joined: Mon Feb 16, 2015 11:47 am

Re: mini window cursor control and printing demo

Post by tezoost »

Is there a way for Mudlet to understand if the current cmd is empty?

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: mini window cursor control and printing demo

Post by Vadi »

Not possible to check what is currently in the command line box at the moment

Post Reply