Help please.

Post Reply
tarrant
Posts: 49
Joined: Thu Apr 15, 2010 10:36 pm

Help please.

Post by tarrant »

Hi, i just discovered this client.
I've been using zmud/cmud for years on my mac with parallels. been looking out for a good mac client.
Unfortunately, i can't for the life of me, understand how it works. But, i'd like to learn. So, please bear with me.

So, i'm trying to capture my health, spellpoints etc into a createMiniConsole.

Code: Select all

font_size = 13
local x, y = calcFontSize( font_size )
createMiniConsole("StatusBar",0,0,0,0)
setMiniConsoleFontSize("StatusBar", font_size)
resizeWindow( "StatusBar", x*175, y*1.5 )
setBackgroundColor("StatusBar",255,0,0,0)


I don't want a gauge, so for starters, i have this.

Code: Select all

cecho ( "StatusBar", "<green>Hp: [" .. hpCur .. "/" .. hpMax.. "] <white>Sp: [" .. spCur .. "/" .. spMax .. "]" )

Is this the right/best way to do it? Any suggestions?
Oh, and instead of having it at the top of the screen, how do i make it such that its at the bottom and doesn't block the text.

Also, i got this from the Mudlet Manual

Code: Select all

function resizeEvent( event, x, y )
        echo("RESIZE EVENT: event="..event.." x="..x.." y="..y.."\n")
end
i put under scripts. doesn't seem to work. no idea why. help please!
Thanks

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

Re: Help please.

Post by Heiko »

To put a status bar below the main screen, you'll need to make room for it by setting an appropriate bottom border for the main text console. Then you can put your mini console in the free border space. You can either do this manually -> preferences or via script (->set border functions in the manual).

A better alternative is using the new Geysir layout manager. This will be part of the next release and currently needs to be imported as a seperate package -> package section and Geysir sub forum in the Development forum.

tarrant
Posts: 49
Joined: Thu Apr 15, 2010 10:36 pm

Re: Help please.

Post by tarrant »

cool thanks. i'll check it out.

tarrant
Posts: 49
Joined: Thu Apr 15, 2010 10:36 pm

Re: Help please.

Post by tarrant »

I'm sorry, i don't get it. How do i create a new miniconsole using this Geyser?

lex
Posts: 55
Joined: Fri May 14, 2010 2:28 pm

Re: Help please.

Post by lex »

Hi, I have some example for you (see code bellow). Everything was tested in Mudled 1.1.1

1. install Geyser
2. create new script and copy and paste following code
3. optionally create new trigger that will call ag.cl_paste() method.
Trigger regex must be something like "^()SAY:(.*)$" e.g. method will select and use 3rd capture group

I tried to keep everything as simple as possible with some comments, so it will be hopefully clear. In nutshell, you just have to create top container and add some child container (see method ag.cl_paste()).

Code: Select all

-- this will just create separate namespace (ag = Aardwolf GUI)
ag = ag or {}			-- (line means use existing ag or create new one)
ag.top = ag.top or nil		-- top container
ag.chatLog = ag.chatLog or nil	-- mini console


function ag.init()
	-- create top container (will consume all available space)
	ag.top = Geyser.Container:new(
		{
			name="Aardwolf GUI Top Container",
			x=0, 
			y=0,
			width="100%", 
			height="100%"
		} 
	)
	-- add UI elements
	ag.cl_init()
	-- TODO debug output
	Geyser.display(ag)
	Geyser.display(ag.top)
	Geyser.display(ag.chatLog)
end


----------------------------------
-- chat log stuff
--
function ag.cl_init()
	ag.chatLog = Geyser.MiniConsole:new(
		{
			name = "ChatLog_MiniConsole",
			x = "55%", 
			y = "0%",
			width = "45%",
			height = "50%"
		}, 
		ag.top
	)

	ag.chatLog:setColor(0, 0, 50, 0)
	ag.chatLog:setFontSize(11)
	ag.chatLog:setWrap(70)
end


-- you can call this from trigger
-- for example "^()SAY:(.*)$"
function ag.cl_paste()
	ag.chatLog:echo("\n")
	selectCaptureGroup(3)
	copy()
	appendBuffer(ag.chatLog.name)
	-- TODO - only if you want to remove selected line from main window
	--	deleteLine()
end


----------------------------------
-- create GUI
-- 
ag.init()
-- demo test
ag.chatLog:echo("\n yeah, it's working")

Post Reply