Page 1 of 1

Separate chat windows

Posted: Fri May 15, 2009 9:06 pm
by Apocalyptic
How do I make separate chat windows in Mudlet? I wish to put my tells in one window, and house and city chats in their own windows. Looking to make three windows to display chat despite the main game window. How do I do this? Thanks.

Re: Separate chat windows

Posted: Fri May 15, 2009 9:25 pm
by Heiko
Import the compass/gauges demo package. It has a chat window. Look at how it's done. It's not complicated.

Re: Separate chat windows

Posted: Sat May 16, 2009 1:58 pm
by Vadi
I'll make a separate chat capture package this weekend that serves as a better example (it'll properly get multi-line messages too and whatnot).

Re: Separate chat windows

Posted: Sat May 16, 2009 3:08 pm
by Caled
This to work with wrapwidth 0.

createMiniConsole("chancap",0,2,700,300)
setBackgroundColor("chancap",20,20,20,100);
setMiniConsoleFontSize("chancap", 10)
setWindowWrap("chancap", 85);
setTextFormat("chancap",55,0,0,0,0,255,0,0,0);

If you place the above code into a script object (scripts -- > new)
a chat window (mini console) will be created in the top left corner of the main window. It will be visible, though I personally prefer a seamless black background, and after finding the perfect position for my chat window, I changed it to a black background by changing the 3 underlined 20s to 3 zeros.

To move the mini console, we should be able to use:
moveUserWindow( name )
but I have not managed to get that to work. I assumed the full syntax to be
moveUserWindow( "chancap", 950, 100 )
but that does nothing. Until we learn the proper syntax from Heiko (which I forgot to ask), the work around is to change the position values in the very first line above, which I underlined in red. The problem being that those changes won't be seen until you restart mudlet. (Don't forget to save profile before restarting.)

To capture your channels to this window, create a trigger:
Name: Channel capture
Pattern type: located at beginning of line
Patterns:
(The Crafting Guild of Sapience):
(Market):
(Novice):
etc - just keep adding them for each channel you want to capture to this window. You could have one regex pattern to match all - but why bother? This is still just the one trigger and its so easy to add multiple patterns.


Script:
selectString(line,1)
setBgColor(0,0,0);
copy()
appendBuffer("chancap");

Note: The 3 numbers in setBgColor() should be the same as the three in
setBackgroundColor("chancap",10,10,10,100);
I only changed them to 10, 10, 10 there, for the purpose of being able to view the console while you get its size and position right.

Re: Separate chat windows

Posted: Sat May 16, 2009 3:20 pm
by Vadi
Eee! Code tags!

Re: Separate chat windows

Posted: Sat May 16, 2009 10:33 pm
by Caled
There was no indentation there to preserve, and I wanted to be able to colour/underline a couple of things to make it easier to explain. If it was easy to create a sample package, I would do that instead, but its not.

To share a script from my main package, I have to save a copy of my entire profile, open that up on a new profile, delete everything except what I want to share, then save the entire profile.

Its the biggest design flaw that I can suggest in the script editor: keeping triggers, aliases etc completely separate from one another means they cannot be exported as one single xml file.

Re: Separate chat windows

Posted: Sat May 16, 2009 10:57 pm
by Vadi
Not at all. It was not designed to be exportable like that - how I made it was that there would be a special export dialog where you'd select all the settings you'd like to select. Hopefully in the future it'll replace an all-profile export.

Re: Separate chat windows

Posted: Mon May 18, 2009 6:54 am
by Heiko
it's:
moveWindow( name , x , y )
hideWindow( name )
showWindow( name )

Re: Separate chat windows

Posted: Mon May 18, 2009 7:09 am
by Heiko
Caled wrote:If it was easy to create a sample package, I would do that instead, but its not.

To share a script from my main package, I have to save a copy of my entire profile, open that up on a new profile, delete everything except what I want to share, then save the entire profile.

Its the biggest design flaw that I can suggest in the script editor: keeping triggers, aliases etc completely separate from one another means they cannot be exported as one single xml file.
You can export a script by simply selecting the script and clicking on export. That's it.
The same goes for everything else. If you want to combine elements in packages like trigger + scripts you have to export both and then import both in an empty profile and export that as your complete package.
We can improve the export/package system, but this should be discussed in detail in the development forum.