YATCO

Share your scripts and packages with other Mudlet users.
Post Reply
Nors
Posts: 1
Joined: Tue Jan 28, 2014 6:19 am

Re: YATCO 2.3

Post by Nors »

Is there any way to work this into a diku based mud, by chance? I'm relatively new to scripting, so I'm not even really sure where to begin at trying to convert it to a diku and I can't seem to get it to work on the MUD that I'm playing.

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: YATCO 2.3

Post by demonnic »

This should be entirely mud agnostic currently, it is really just some geyser windows and hooks to put stuff into them. Everything should be driven by triggers which you have to set up yourself for the mud you are on.

Can you be a bit more specific about the problems you are having?

gunsmile
Posts: 1
Joined: Mon Feb 24, 2014 6:20 pm

Re: YATCO 2.3

Post by gunsmile »

Is there a way to change font style or font family at all?

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

Re: YATCO 2.3

Post by phasma »

Easiest way is to apply a stylesheet. I use this tabbed chat in my own system, so this might be useful to you.
(This is only the functions as I load my system different than most people, but the code is there if you look).
Code: [show] | [select all] lua
-- Chat Window

-- Credit to demonnic@freenode and Mudlet forums

ui.chat = ui.chat or {}
ui.chat.tabs = ui.chat.tabs or {}
ui.chat.config = ui.chat.config or {}
ui.chat.windows = ui.chat.windows or {}
ui.chat.tabsToBlink = ui.chat.tabsToBlink or {}
ui.chat.config.activeColors = ui.chat.config.activeColors or {}
ui.chat.config.inactiveColors = ui.chat.config.inactiveColors or {}

ui.chat.use = true
ui.chat.config.timestamp = "HH:mm:ss"
ui.chat.config.timestampCustomColor = false
ui.chat.config.timestampFG = "slate_grey"

ui.chat.config.timestampFG = {
255,
0,
0,
}

ui.chat.config.timestampFG = "red"
ui.chat.config.timestampBG = "blue"
ui.chat.config.location = "topright"

ui.chat.config.channels = {
"All",
"Tells",
"Org",
"Guild",
"Order",
"Combat",
"Misc"
}

ui.chat.config.Alltab = "All"
ui.chat.config.blink = true
ui.chat.config.blinkTime = 3
ui.chat.config.blinkFromAll = true
ui.chat.config.fontSize = 8
ui.chat.config.preserveBackground = false
ui.chat.config.gag = false
ui.chat.config.lines = 12
ui.chat.config.width = 60

ui.chat.config.activeColors = {
r = 205,
g = 92,
b = 92,
}

ui.chat.config.inactiveColors = {
r = 190,
g = 190,
b = 190,
}

ui.chat.config.windowColors = {
r = 0,
g = 0,
b = 0,
}

ui.chat.config.activeTabText = "white"
ui.chat.config.inactiveTabText = "white"
ui.chat.currentTab = ui.chat.currentTab or ui.chat.config.Alltab or ui.chat.config.channels[1]

ui.cc = ui.cc or {}
ui.cc.last = ui.cc.last or ""
ui.cc.types = {
["newbie"] = "Misc",
["market"] = "Misc",
["coven"] = "Combat",
["ct"] = "Org",
["cgt"] = "Org",
["gt"] = "Guild",
["gts"] = "Guild",
["gnt"] = "Guild",
["clt"] = "Misc",
["sqt"] = "Combat",
["tell"] = "Tells",
["says"] = "Misc",
["ot"] = "Order",
["shipt"] = "Misc",
["ft"] = "Misc",
["envoys"] = "Misc",
["guidet"] = "Misc"
}

function sChatSwitch(chat)
	local r = ui.chat.config.inactiveColors.r
	local g = ui.chat.config.inactiveColors.g
	local b = ui.chat.config.inactiveColors.b
	local newr = ui.chat.config.activeColors.r
	local newg = ui.chat.config.activeColors.g
	local newb = ui.chat.config.activeColors.b
	local oldchat = ui.chat.currentTab
	if ui.chat.currentTab ~= chat then
		ui.chat.windows[oldchat]:hide()
		ui.chat.tabs[oldchat]:setColor(r, g, b)
		ui.chat.tabs[oldchat]:setStyleSheet(ui.css.default:getCSS())
		ui.chat.tabs[oldchat]:echo([[<p style="font-size:9px; font-family: ']] .. s.ui_font .. [[';"><b><font color="PaleTurquoise">]] .. oldchat, ui.chat.config.inactiveTabText, "c")
		if ui.chat.config.blink and ui.chat.tabsToBlink[chat] then
			ui.chat.tabsToBlink[chat] = nil
		end
		if ui.chat.config.blink and chat == ui.chat.config.Alltab then
			ui.chat.tabsToBlink = {}
		end
	end
	ui.chat.tabs[chat]:setColor(newr,newg,newb)
	ui.chat.tabs[chat]:setStyleSheet(ui.css.active_chat_tab:getCSS())
	ui.chat.tabs[chat]:echo([[<p style="font-size:10px; font-family: ']] .. s.ui_font .. [[';"><b><font color="PaleTurquoise">]] .. chat, ui.chat.config.activeTabText, "c")
	ui.chat.windows[chat]:show()
	ui.chat.currentTab = chat
end

function ui.chat:reset_ui()
	ui.chat.container = Geyser.Container:new({
		x = "70%", y = "0%",
		fontSize = ui.chat.config.fontSize,
		width = "29%",
		height = "35%",
    --height = string.format("%ic", ui.chat.config.lines + 2),
    }, ui.containers.main)

	ui.chat.tabBox = Geyser.HBox:new({
		x = 0,
		y = 0,
		width = "100%",
		height = "26px",
		name = "sChatTabs",
		}, ui.chat.container)
end

function ui.chat:create()
	ui.chat:reset_ui()
	local r = ui.chat.config.inactiveColors.r
	local g = ui.chat.config.inactiveColors.g
	local b = ui.chat.config.inactiveColors.b
	local winr = ui.chat.config.windowColors.r
	local wing = ui.chat.config.windowColors.g
	local winb = ui.chat.config.windowColors.b

	for i, tab in ipairs(ui.chat.config.channels) do
		ui.chat.tabs[tab] = Geyser.Label:new({
			name = string.format("tab%s", tab),
			}, ui.chat.tabBox)

		ui.chat.tabs[tab]:echo([[<p style="font-size:9px; font-family: ']] .. s.ui_font .. [[';"><b><font color="PaleTurquoise">]] .. tab, ui.chat.config.inactiveTabText, "c")
		ui.chat.tabs[tab]:setColor(r, g, b)
		ui.chat.tabs[tab]:setStyleSheet(ui.css.default:getCSS())
		--setLabelOnEnter("tab" .. tab, "chatHoverOn", "tab" .. tab)
		--setLabelOnLeave("tab" .. tab, "chatHoverOff", "tab" .. tab)
		ui.chat.tabs[tab]:setClickCallback("sChatSwitch", tab)
		ui.chat.windows[tab] = Geyser.MiniConsole:new({
			fontSize = ui.chat.config.fontSize,
			x = 0,
			y = 30,
			height = "100%",
			width = "100%",
			name = string.format("win%s", tab),
			}, ui.chat.container)

		ui.chat.windows[tab]:setFontSize(ui.chat.config.fontSize)
		ui.chat.windows[tab]:setColor(winr,wing,winb)

		local fontx,fonty = calcFontSize(ui.chat.config.fontSize)
		ui.chat.windows[tab]:setWrap(math.floor(ui.chat.windows[tab].get_width() / fontx))
    --ui.chat.windows[tab]:setWrap(ui.chat.config.width)

    ui.chat.windows[tab]:hide()
end

local showme = ui.chat.config.Alltab or ui.chat.config.channels[1]
if not sChatSwitch then
	chatSwitch(showme)
else
	sChatSwitch(showme)
end
if ui.chat.config.blink and not ui.chat.blinkTimerOn then
	ui.chat:blink()
end
end

function ui.chat:append(chat)
local r = ui.chat.config.windowColors.r
local g = ui.chat.config.windowColors.g
local b = ui.chat.config.windowColors.b
selectCurrentLine()
local ofr,ofg,ofb = getFgColor()
local obr,obg,obb = getBgColor()
if ui.chat.config.preserveBackground then
	setBgColor(r, g, b)
end
copy()
if ui.chat.config.timestamp then
	local timestamp = getTime(true, ui.chat.config.timestamp)
	local tsfg = {}
	local tsbg = {}
	local colorLeader = ""
	if ui.chat.config.timestampCustomColor then
		if type(ui.chat.config.timestampFG) == "string" then
			tsfg = color_table[ui.chat.config.timestampFG]
		else
			tsfg = ui.chat.config.timestampFG
		end

		if type(ui.chat.config.timestampBG) == "string" then
			tsbg = color_table[ui.chat.config.timestampBG]
		else
			tsbg = ui.chat.config.timestampBG
		end

		colorLeader = string.format("<%s,%s,%s:%s,%s,%s>",tsfg[1],tsfg[2],tsfg[3],tsbg[1],tsbg[2],tsbg[3])
	else
		colorLeader = string.format("<%s,%s,%s:%s,%s,%s>",ofr,ofg,ofb,obr,obg,obb)
	end

	local fullstamp = string.format("%s%s",colorLeader,timestamp)
	ui.chat.windows[chat]:decho(fullstamp)
	ui.chat.windows[chat]:echo(" ")
	if ui.chat.config.Alltab then
		ui.chat.windows[ui.chat.config.Alltab]:decho(fullstamp)
		ui.chat.windows[ui.chat.config.Alltab]:echo(" ")
	end
end

ui.chat.windows[chat]:append()
if ui.chat.config.gag then
	deleteLine()
	tempLineTrigger(1,1, [[if isPrompt() then deleteLine() end]])
end

if ui.chat.config.Alltab then
	appendBuffer(string.format("win%s", ui.chat.config.Alltab))
end

if ui.chat.config.blink and chat ~= ui.chat.currentTab then
	if (ui.chat.config.Alltab == ui.chat.currentTab) and not ui.chat.config.blinkOnAll then
		return
	else
		ui.chat.tabsToBlink[chat] = true
	end
end
end



function ui.chat:blink()
	if ui.chat.blinkID then
		killTimer(ui.chat.blinkID)
	end

	if not ui.chat.config.blink then
		ui.chat.blinkTimerOn = false
		return
	end

	for tab,_ in pairs(ui.chat.tabsToBlink) do
		ui.chat.tabs[tab]:flash()
	end

	ui.chat.blinkID = tempTimer(ui.chat.config.blinkTime, function () ui.chat:blink() end)
end

function ui.chat:topright()
	return {
	fontSize = ui.chat.config.fontSize,
	x = string.format("-%sc", ui.chat.config.width + 2),
	y = 0,
	width = "-15px",
	height = string.format("%ic", ui.chat.config.lines + 2),
}
end

function ui.chat:topleft()
	return {
	fontSize = ui.chat.config.fontSize,
	x = 0,
	y = 0,
	width = string.format("%sc", ui.chat.config.width),
	height = string.format("%ic", ui.chat.config.lines + 2),
}
end

function ui.chat:bottomright()
	return {
	fontSize = ui.chat.config.fontSize,
	x = string.format("-%sc", ui.chat.config.width + 2),
	y = string.format("-%sc", ui.chat.config.lines + 2),
	width = "-15px",
	height = string.format("%ic", ui.chat.config.lines + 2),
}
end

function ui.chat:bottomleft()
	return {
	fontSize = ui.chat.config.fontSize,
	x = 0,
	y = string.format("-%sc", ui.chat.config.lines + 2),
	width = string.format("%sc", ui.chat.config.width),
	height = string.format("%ic", ui.chat.config.lines + 2),
}
end

function ui.chat:cecho(chat, message)
	local alltab = ui.chat.config.Alltab
	local blink = ui.chat.config.blink
	cecho(string.format("win%s",chat), message)
	if alltab and chat ~= alltab then
		cecho(string.format("win%s", alltab), message)
	end

	if blink and chat ~= ui.chat.currentTab then
		if (alltab == ui.chat.currentTab) and not ui.chat.config.blinkOnAll then
			return
		else
			ui.chat.tabsToBlink[chat] = true
		end
	end
end

function ui.chat:decho(chat, message)
	local alltab = ui.chat.config.Alltab
	local blink = ui.chat.config.blink
	decho(string.format("win%s",chat), message)
	if alltab and chat ~= alltab then
		decho(string.format("win%s", alltab), message)
	end

	if blink and chat ~= ui.chat.currentTab then
		if (alltab == ui.chat.currentTab) and not ui.chat.config.blinkOnAll then
			return
		else
			ui.chat.tabsToBlink[chat] = true
		end
	end
end

function ui.chat:hecho(chat, message)
	local alltab = ui.chat.config.Alltab
	local blink = ui.chat.config.blink
	hecho(string.format("win%s",chat), message)
	if alltab and chat ~= alltab then
		hecho(string.format("win%s", alltab), message)
	end

	if blink and chat ~= ui.chat.currentTab then
		if (alltab == ui.chat.currentTab) and not ui.chat.config.blinkOnAll then
			return
		else
			ui.chat.tabsToBlink[chat] = true
		end
	end
end

function ui.chat:echo(chat, message)
	local alltab = ui.chat.config.Alltab
	local blink = ui.chat.config.blink
	echo(string.format("win%s",chat), message)
	if alltab and chat ~= alltab then
		echo(string.format("win%s", alltab), message)
	end

	if blink and chat ~= ui.chat.currentTab then
		if (alltab == ui.chat.currentTab) and not ui.chat.config.blinkOnAll then
			return
		else
			ui.chat.tabsToBlink[chat] = true
		end
	end
end

DanBoy
Posts: 8
Joined: Sun Mar 16, 2014 6:50 am

Re: YATCO 2.3

Post by DanBoy »

I Finally have everything setup and working correctly and i love it, but no matter what i do, and i know this has been covered before, i cannot stop the messages being cut off after a certain character length. This makes no sense to me as I am using Achaea and I can completely disable word wrapping with config screenwidth 0, as i have done, then i setup mudlet's wraping to 130, yet the messages still keep getting cut off, and i keep reading with achaea i should not have these problems, any help is greatly appreciated, i just want to finish the UI so i can fully transition to mudlet from the achaea html5 client.

UPDATE: I've also tried installing YATCO on a completely blank new profile with no other scripts and i still get the same result, i've tried turning gagging off and on, timestamps , disabling every script in the current profile, making the width larger, nothing seems to help here's a screen shot of whats happening:

http://postimg.org/image/rn9yo2eyt/full/

UPDATE i forgot to mention I'm using Linux but that should not be the issue

xabre
Posts: 45
Joined: Thu Mar 08, 2012 7:19 pm

Re: YATCO 2.3

Post by xabre »

@DanBoy
Do you use percomplied Mudlet installer or you compile it from sources yourself?
I had exactly the same issue as you have, and for some reason I wanted to use generic installer version, only to find that to my surprise everything works perfectly well, nothing is being cut off.

I'm on Arch, and am starting to think it may be a problem related to newer versions of lrexlib-pcre (generic installer seems to have version rex_pcre.so.2.4, while current version seems to be 2.7.2). I only suspect that since I don't have much time to investigate it fully. It's either that or some bug that was introduced just before the switch to Qt5.

If you were using installer already, then I have no clue, sorry.

tarkenton
Posts: 30
Joined: Thu Feb 07, 2013 7:33 am

Re: YATCO 2.3

Post by tarkenton »

I was curious if there's any way to have the script not append certain captures to all. For instance, I have a tab set up to catch tells/says from a certain person. My general tells/says trigger also captures those, so the effect is that anything from them shows up twice in the All tab.

DanBoy
Posts: 8
Joined: Sun Mar 16, 2014 6:50 am

Re: YATCO 2.3

Post by DanBoy »

I'm using debian, and I have qt4, And I'm using the basic package they provide, as i couldn't get it to compile for the life of me. I've been at this for days and its just getting me down by now, i just want to play a game, I can code but i don't want mudlet to be a programming chore and i can't say im a fan of lua(honestly i hate it). I"ve been trying to mimic the html5 client UI and after i figure this out, i'm pretty much done, and i can finally play the damn game, I have the Achaean theme music compiled into one big .mp3 with a timer going for it and everything, all i need is this to work and i can play the game, god. Can someone take a look at this issue, people are telling me its because I'm on linux now but that shouldn't matter. Also i've ran into people who literally have this problem in one of their profiles yet in another profile it works.
As i've said though i've even tried installing on a completely blank profile and the problem still exists and this is for Achaea which you can completely disable word wrapping so that is NOT the issue!!!!

3066h, 2595m, 15100e, 12400w ex-
Syntax: CONFIG SCREENWIDTH <width>
3066h, 2595m, 15100e, 12400w ex-
You have set your screen width to 0, which should disable wrapping completely.
3066h, 2595m, 15100e, 12400w ex-

Thanks.

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

Re: YATCO 2.3

Post by phasma »

I also use Debian and I do not experience this issue. (Running Sid at the moment). That said, this issue -is- present for me when I compile latest git. (Amongst a few other issues that all seem Qt related).

DanBoy
Posts: 8
Joined: Sun Mar 16, 2014 6:50 am

Re: YATCO 2.3

Post by DanBoy »

I can try and reinstall mudlet and all that, but in the mean time, is there any alternative to YATCO that's worth my time? I haven't seen much out there.

UPDATE- Forgot to mention I'm on Debian Wheezy

I am running mudlet like this, ../bin/run-mudlet.sh

Is this the correct way?

Post Reply