Creating a desktop environment style GUI

User avatar
Vadi
Posts: 4903
Joined: Sat Mar 14, 2009 3:13 pm

Re: Creating a desktop environment style GUI

Post by Vadi »

I'd rather have a function to set the scrollbars CSS than setting a color. That's more flexible.

User avatar
KaVir
Posts: 86
Joined: Mon Feb 08, 2010 8:38 pm
Contact:

Re: Creating a desktop environment style GUI

Post by KaVir »

I had the fillBackground property set, the problem was that the images themselves didn't actually have transparent backgrounds - in my other plugin that was done automatically, and it's been that way so long that I didn't really think about it. Anyway I grabbed a tool called TransparentPNG and converted the images.

I also created another set of smaller avatars. It'll mean a larger download, but not excessively so.

For the circle on the top map, and the dots on the bottom map, I created a new "shapes" folder and just added some pngs with transparent backgrounds.

So now the map looks like this:

Image

Or if you're in a dungeon, like this:

Image

You can't click on the map or miniavatars yet, but at least they update in real-time as you move around. There's still quite a lot to add, but it's coming together.

I've also managed to get sound working, so I'll integrate that into the script as well to take advantage of my soundpack.

User avatar
Vadi
Posts: 4903
Joined: Sat Mar 14, 2009 3:13 pm

Re: Creating a desktop environment style GUI

Post by Vadi »

This does look really nice. Enticing :)

User avatar
Omit
Posts: 190
Joined: Sun Aug 01, 2010 10:54 pm
Location: Middle Earth
Contact:

Re: Creating a desktop environment style GUI

Post by Omit »

Very nice!

User avatar
KaVir
Posts: 86
Joined: Mon Feb 08, 2010 8:38 pm
Contact:

Re: Creating a desktop environment style GUI

Post by KaVir »

I got the mud to send MSP sound triggers through ATCP, so all I need at the client end is:

Code: Select all

function SOUND(event, args)
  if atcp.MSDPSOUND ~= nil then
    playSoundFile ("sounds/"..atcp.MSDPSOUND)
  end -- if
end -- SOUND
Works fine, the only drawback is that it can only play one sound at a time - so if there's a thunderstorm sound playing in the background, and someone punches you, the thunderstorm sound will be cut off. Is there any way around this?

On the GUI front, things are coming along okay. I've been a bit busy with RL work lately but I've managed to add the energy bars at the bottom, the character avatar in the top left, and the spell timer icons below it:

Image

User avatar
Vadi
Posts: 4903
Joined: Sat Mar 14, 2009 3:13 pm

Re: Creating a desktop environment style GUI

Post by Vadi »

I suspect that'd need a fix in playSound's behavior. Heiko's the one to coment on that, though.

User avatar
KaVir
Posts: 86
Joined: Mon Feb 08, 2010 8:38 pm
Contact:

Re: Creating a desktop environment style GUI

Post by KaVir »

I finally got around to adding the little energy bars below the miniavatars (the ones that appear on the right, below the two maps). However I've noticed they don't vanish when someone is killed - see here:

Image

After some investigation, I discovered that using hideWindow() on a gauge causes it to appear empty, instead of making it vanish. I'm not sure if this is intentional or not, but I need a way to remove the gauge entirely. Is there some way to do this, or at least a workaround?

User avatar
Vadi
Posts: 4903
Joined: Sat Mar 14, 2009 3:13 pm

Re: Creating a desktop environment style GUI

Post by Vadi »

Gauges are really two labels... there should be a hideGauge, but if it's not, then hideWindow(originalname.."_back") will do it.

User avatar
KaVir
Posts: 86
Joined: Mon Feb 08, 2010 8:38 pm
Contact:

Re: Creating a desktop environment style GUI

Post by KaVir »

With a lot of help from Vadi, I managed to get MXP-style links working last night. I actually send the data in a slightly different format for Mudlet, to make it easier to parse.

The trigger looks for the following pattern: \t<send>(.*)</send>

This executes the following script:

Code: Select all

selectCaptureGroup(1)
setUnderline(true)
setFgColor(255,255,255)
replace(matches[2])
setLink([[send("]]..matches[2]..[[")]], matches[2])
deselect()
resetFormat()
I then have a couple of similar triggers for the other send formats. In this screenshot you can see what it looks like in action:

Image

The underlined bold text is all clickable, and you can hover over it with the mouse to see what happens when you click.

There are still two issues I'm having trouble with though. The first is the colouring - Vadi explained to me last night that colour is stripped when the text is replaced, and that I could use functions to find the colour and then set the colour manually. I've tried doing this without much success, so I think I will have to send the rgb value with the link - not a major problem, although it may take some tweaking to ensure I get the right colours. For now I just colour everything white.

The second problem is a bit more strange. It seems that the clickable text is equal to the length of the pattern rather than the highlighted part. So for example if I have the following:

"You can type '<send>score</send>' to view your current attributes at any time."

Then this will be currently displayed as:

"You can type 'score' to view your current attributes at any time."

However you can actually click on the link as if it were highlighted as:

"You can type 'score' to view your current attributes at any time."

I.e., it includes the length of the "<send>" and "</send>" when calculating how long the clickable part of the text should be.

It's still usable, but could cause conflicts if I have multiple links on the same line.

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: Creating a desktop environment style GUI

Post by tsuujin »

Well, I sat down to write you a small snippet of code to show you how to colorized links, and found a bug in insertLink.
When you tell it to use the current formatting, it simply won't print. At first I was getting an error from the GUIUtils.lua and went to find it, realized that insertLink was calling fg directly not setFgColor. So I made custom colors in the color_table and tried to set those and now I get no error but it still doesn't print the link.

I'm stumped, for the moment.

Post Reply