Chat Console Positioning

Post Reply
icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Chat Console Positioning

Post 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") ?

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Chat Console Positioning

Post 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)

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Chat Console Positioning

Post by icesteruk »

Thanks,

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

?

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Chat Console Positioning

Post 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.

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Chat Console Positioning

Post 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)

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Chat Console Positioning

Post 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")

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Chat Console Positioning

Post by icesteruk »

Thanks :)

User avatar
Omni
Posts: 131
Joined: Fri Feb 12, 2010 10:26 am

Re: Chat Console Positioning

Post by Omni »

For channel capturing, can just do (Channel Name): as a begin of line substring pattern type.

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Chat Console Positioning

Post 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! :)

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Chat Console Positioning

Post 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

Post Reply