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 »

Hm... can you paste the code that is not working? insertLink with or without on the latest git works fine for me.

I think there was a specific way to do this replacement while keeping the selection size properly adjusted, but I thought that selectCaptureGroup was it. Apparently not (or the order of the statements needs to be reversed).

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 managed to get the colours working - I can now send one or two RGB values with the link:

Image

I wouldn't use the above colour scheme personally, it's just to demonstrate how it can combine foreground and background colours in the links (eg 'rare' items are cyan and 'artifacts' are red, therefore an 'uncommon artifact' is cyan text on a red background).

The link length is still an issue though, so I had to disable links from the help suggestions because they overlap (if you try to view a help file and it doesn't exist, it uses soundex to provide a list of other possibilities).

It's still very much a work in progress, but if you want to get a feel for what MXP would be like in Mudlet you can download the scripts and images from here: http://www.godwars2.org/download/mudlet/ (I've put the sounds there as well, in case anyone wants to see what MSP would be like). The images (and sounds) folders go in the Mudlet folder, as do the XML files.

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 »

for reference, here's the code I was using that is non-functional:
Code: [show] | [select all] lua
moveCursor("main",selectString(matches[1],1),getLineCount())
replace("")
color_table["customBG"] = {getBgColor()}
color_table["customFG"] = {getFgColor()}
fg("customFG")
bg("customBG")
sf = [[send("%s")]]
moveCursorEnd()
insertLink(matches[1],sf:format(matches[1]),matches[1],true)

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

Re: Creating a desktop environment style GUI

Post by Heiko »

First you have to apply the color and other format to the selection before replacing it. Then it should work alright.

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

Re: Creating a desktop environment style GUI

Post by Vadi »

KaVir wrote:The link length is still an issue though, so I had to disable links from the help suggestions because they overlap (if you try to view a help file and it doesn't exist, it uses soundex to provide a list of other possibilities).
Can you paste the code you are currently using? I'm sure it can be solved.

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

Re: Creating a desktop environment style GUI

Post by KaVir »

This is the trigger:

Code: Select all

\t<send>(.*)</send>
This is the code:

Code: Select all

selectCaptureGroup(1)
setUnderline(true)
setFgColor(255,255,255)
replace(matches[2])
setLink([[send("]]..matches[2]..[[")]], matches[2])
deselect()
resetFormat()
And this is what it looks like:

Image

Notice how the the links (the underlined text) are fine - except when two are displayed on the same line.



And...on an unrelated note, see the moon above the maps? Is there any easy way to make it rise and set behind the frame of the map, without redrawing the frame (which then requires redrawing the map)?

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

Re: Creating a desktop environment style GUI

Post by Vadi »

What is the text you're sending, so I can simulate it?

Oh and... this looks like a regex problem, doens't it? It's matching across the whole line all the way to the other one.

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

Re: Creating a desktop environment style GUI

Post by Vadi »

The moon - I'm not sure how are you doing it. It's not possible to change the Z order of things yet though once they are made.

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

Re: Creating a desktop environment style GUI

Post by KaVir »

If you want to simulate it on another mud you'll need to remove the tab from the front, but you could just display something like:

Code: Select all

<send>link1</send>
And that'll work, then do:

Code: Select all

<send>link1</send> and <send>link2</send>
And you'll see they bleed into each other.

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

Re: Creating a desktop environment style GUI

Post by Vadi »

Yeah I'm positive it's the regex matching the whole thing. Try enabling the match all option, and then display(matches) on a line with multiple ones to see how they get stored (one after another in matches[])

Post Reply