Page 3 of 6

Re: Creating a desktop environment style GUI

Posted: Fri Feb 18, 2011 4:44 pm
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).

Re: Creating a desktop environment style GUI

Posted: Sat Feb 19, 2011 12:50 am
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.

Re: Creating a desktop environment style GUI

Posted: Sat Feb 19, 2011 5:39 am
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)

Re: Creating a desktop environment style GUI

Posted: Sat Feb 19, 2011 9:56 am
by Heiko
First you have to apply the color and other format to the selection before replacing it. Then it should work alright.

Re: Creating a desktop environment style GUI

Posted: Fri Feb 25, 2011 12:03 am
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.

Re: Creating a desktop environment style GUI

Posted: Fri Feb 25, 2011 1:37 am
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)?

Re: Creating a desktop environment style GUI

Posted: Fri Feb 25, 2011 1:43 am
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.

Re: Creating a desktop environment style GUI

Posted: Fri Feb 25, 2011 1:44 am
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.

Re: Creating a desktop environment style GUI

Posted: Fri Feb 25, 2011 1:58 am
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.

Re: Creating a desktop environment style GUI

Posted: Fri Feb 25, 2011 2:19 am
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[])