Page 1 of 1

Chat Console Positioning

Posted: Wed Sep 25, 2013 2:23 pm
by icesteruk
So, I'm throwing together a simple Chat Window but having difficulties with positioning it and keeping it at a certain size..

What I have is,
Code: [show] | [select all] lua
function ChatWindow()
createMiniConsole("chatcap", 10, 2, 310, 202)
setBackgroundColor("chatcap",20,20,20,100);
setMiniConsoleFontSize("chatcap", 10)
setWindowWrap("chatcap", 85);
setTextFormat("chatcap",55,0,0,0,0,255,0,0,0);
moveWindow("chatcap", 1030, 13)
end
The position/size I'm trying to get it at is -

-- x = "-320", y = "13",
-- width = "300",
-- height = "280",

-

so my question is, for consoles it is something like createConsole("NAMEOFCONSOLE", "FONTSIZE", "??", "numberoflinestall", "positionX" "Y") ?

Re: Chat Console Positioning

Posted: Wed Sep 25, 2013 2:56 pm
by Jor'Mox
createMiniConsole(name,x,y,width,height)

It is generally best to create the console, and then move and resize it, like this:
createMiniConsole(name,0,0,0,0)
resizeWindow(name,width,height)
moveWindow(name,x,y)

Re: Chat Console Positioning

Posted: Wed Sep 25, 2013 3:30 pm
by icesteruk
Thanks,

Happen to know the best way to capture lines such as
(channel): name says, "this and that"

?

Re: Chat Console Positioning

Posted: Wed Sep 25, 2013 4:02 pm
by Jor'Mox
^\((channel)\): (\w+) says, "(.*)"$

If you have non-letter characters allowed in names, you obviously need to be a bit more careful with how you capture their names, but other than that... something like the above should work pretty well.

Re: Chat Console Positioning

Posted: Wed Sep 25, 2013 4:07 pm
by icesteruk
oh I meant would it be something like

echo("chatname", matches[2])

or stringLine(line, 1) Never tried to make a chat window before and unsure how to 'catch' that line. :/

I been trying to look for just a simple chat window which grabs all the channels into 1 screen and not this tabbed chat (Granted tab chat will be better BUT I only got a small screen so the tables will break the design of it)

Re: Chat Console Positioning

Posted: Wed Sep 25, 2013 4:31 pm
by Jor'Mox
Oh, well, once you have a pattern that captures the whole line, just do this:
Code: [show] | [select all] lua
selectCurrentLine()
copy()
appendBuffer("chatname")

Re: Chat Console Positioning

Posted: Wed Sep 25, 2013 5:08 pm
by icesteruk
Thanks :)

Re: Chat Console Positioning

Posted: Mon Sep 30, 2013 6:10 am
by Omni
For channel capturing, can just do (Channel Name): as a begin of line substring pattern type.

Re: Chat Console Positioning

Posted: Mon Sep 30, 2013 7:45 am
by phasma
Or if your MUD supports it (all the IRE games do), just enable GMCP.Comm and completely do away with even needing a trigger! :)

Re: Chat Console Positioning

Posted: Thu Oct 03, 2013 6:19 am
by icesteruk
fetaera wrote:Or if your MUD supports it (all the IRE games do), just enable GMCP.Comm and completely do away with even needing a trigger! :)

Aye too lazy to mess with that code and try to figure that out :P