mini windows GUI

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

mini windows GUI

Post by Omit »

I am trying to recreate work I have done in mushclient using lua scripting to display graphical/clickable exits and a map on the screen but have found a lack of information on miniwindow functions to draw them. Where should I be looking for this information?
Attachments
Screenshot-MUSHclient - [The Two Towers].png

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

Re: mini windows GUI

Post by Vadi »

The manual really. There are several examples of scripts that already do this: http://forums.mudlet.org/viewtopic.php?f=6&t=981 and etc.

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

Re: mini windows GUI

Post by Omit »

Vadi wrote:The manual really. ...
Is nothing in the manual about the the functions for drawing lines/rectangles, hotspots for mouse clicks, miniwindows, (except the label in the contents) but I will look at the example and see if I can figure it out. (even a function list for these elements would be useful)

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

Re: mini windows GUI

Post by Vadi »

Well yes, that is all you need...

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

Re: mini windows GUI

Post by Omit »

ok... I think I have figured out the "createMiniConsole" and prehaps I can use the Create Label to draw my rooms (somehow that doesn't seem right) but have not found any way to Draw a line. In MushClient I used the following functions.....
WindowLine,WindowGradient,WindowRectOp,....
Are there any equivalent functions in Mudlet?

I have included a sample of the code I had been using (I realized that although the screen shot I posted looks similar to examples I have looked at, it seems to be vastly different beneath the surface)
Code: [show] | [select all] lua
function MapSpace(CC,RR,Xs,Ys,Xr,Yr,msPIXhz,msPIXvt,tile,grid,tilehighlight)
linecolor = ColourNameToRGB("firebrick")
MapNum = GetVariable("MapNum")
MapName = GetVariable("MapName")
local x = 0
local y = 0
while y<=(CC -1)do
while x<=(RR -1)do --rang[x] do
local Xz = Xs + x
local Yz = Ys + y
local cor = (MapName .. MapNum .. " "..Xz.." "..Yz)
local cor2 = (MapName .. MapNum .. " "..Xr.." "..Yr)
local HzC =msPIXhz +(y*grid)+ (tile/2)
local VtC =msPIXvt+(x*grid)+ (tile/2)
local WindowLine = msPIXhz +(y*grid)-tilehighlight--cool
local WindowRectOp = msPIXhz +(y*grid)--cool
local Er = msPIXhz +(y*grid)+ tile+tilehighlight--cool
local Nb = msPIXvt+(x*grid)--cool
local Nt = msPIXvt+(x*grid)-tilehighlight--cool
local El = msPIXhz +(y*grid)+ tile--cool
local Sb = msPIXvt+(x*grid)+ tile+tilehighlight--cool
local St = msPIXvt+(x*grid)+ tile--cool
if maps[cor]then--check if room exists
local Rm = maps[cor]
if Oroom[Rm].Sdir then
local Rdir = Oroom[Rm].Sdir
--WindowLine(win2,El , Nb, Er, Nt,linecolor, 0, 3)
if string.find (Rdir, " ne ") then
WindowLine(win2,El , Nb, Er, Nt,RGBwater, 0, tile)
end -- if
if string.find (Rdir, " n ") then
WindowLine(win2,HzC , Nb, HzC, Nt,RGBwater, 0, tile)
end -- if
if string.find (Rdir, " nw ") then
WindowLine(win2, WindowLine,Nt, WindowRectOp,Nb,RGBwater, 0, tile)
end -- if
if string.find (Rdir, " e ") then
WindowLine(win2, El,VtC, Er,VtC,RGBwater, 0, tile)
end -- if
if string.find (Rdir, " w ") then
WindowLine(win2, WindowLine,VtC, WindowRectOp,VtC,RGBwater, 0,tile)
end -- if
if string.find (Rdir, " se ") then
WindowLine(win2,El , St, Er, Sb,RGBwater, 0, tile)
end -- if
if string.find (Rdir, " s ") then
WindowLine(win2,HzC , Sb, HzC, St,RGBwater, 0,tile)
end -- if
if string.find (Rdir, " sw ") then
WindowLine(win2, WindowLine,Sb, WindowRectOp,St,RGBwater, 0, tile)
end -- if
end--of adding connections
end
x=x+1
end--if
y=y+1
x=0
end
--now reg dirs and draw rooms
local x = 0
local y = 0
while y<=(CC -1)do
while x<=(RR -1)do --rang[x] do
local Xz = Xs + x
local Yz = Ys + y
local cor = (MapName .. MapNum .. " "..Xz.." "..Yz)
local cor2 = (MapName .. MapNum .. " "..Xr.." "..Yr)
local HzC =msPIXhz +(y*grid)+ (tile/2)
local VtC =msPIXvt+(x*grid)+ (tile/2)
local WindowLine = msPIXhz +(y*grid)-tilehighlight--cool
local WindowRectOp = msPIXhz +(y*grid)--cool
local Er = msPIXhz +(y*grid)+ tile+tilehighlight--cool
local Nb = msPIXvt+(x*grid)--cool
local Nt = msPIXvt+(x*grid)-tilehighlight--cool
local El = msPIXhz +(y*grid)+ tile--cool
local Sb = msPIXvt+(x*grid)+ tile+tilehighlight--cool
local St = msPIXvt+(x*grid)+ tile--cool
if maps[cor]then--check if room exists
local Rm = maps[cor]
----ADD RegDir
if Oroom[Rm] then--added
if cor == cor2 then --check for room you are in and Highlight it
WindowRectOp (win2, 2,msPIXhz+(y*grid)-tilehighlight,msPIXvt+(x*grid)-tilehighlight,msPIXhz +(y*grid)+ tile+tilehighlight, msPIXvt+(x*grid)+tile+tilehighlight,ColourNameToRGB("goldenrod"))
end
if Oroom[Rm].Rdir then
local Rdir = Oroom[Rm].Rdir
--WindowLine(win2,El , Nb, Er, Nt,linecolor, 0, 3)
if string.find (Rdir, " ne ") then
WindowLine(win2,El , Nb, Er, Nt,linecolor, 0, 3)
end -- if
if string.find (Rdir, " n ") then
WindowLine(win2,HzC , Nb, HzC, Nt,linecolor, 0, 3)
end -- if
if string.find (Rdir, " nw ") then
WindowLine(win2, WindowLine,Nt, WindowRectOp,Nb,linecolor, 0, 3)
end -- if
if string.find (Rdir, " e ") then
WindowLine(win2, El,VtC, Er,VtC,linecolor, 0, 3)
end -- if
if string.find (Rdir, " w ") then
WindowLine(win2, WindowLine,VtC, WindowRectOp,VtC,linecolor, 0, 3)
end -- if
if string.find (Rdir, " se ") then
WindowLine(win2,El , St, Er, Sb,linecolor, 0, 3)
end -- if
if string.find (Rdir, " s ") then
WindowLine(win2,HzC , Sb, HzC, St,linecolor, 0, 3)
end -- if
if string.find (Rdir, " sw ") then
WindowLine(win2, WindowLine,Sb, WindowRectOp,St,linecolor, 0, 3)
end -- if
end--of adding connections
if  Oroom[Rm].color1 then--add color if any  noMapColor2
c1 = Oroom[Rm].color1
  if  Oroom[Rm].color2 then
c2 = Oroom[Rm].color2
   WindowGradient (win2,msPIXhz+(y*grid),msPIXvt+(x*grid), msPIXhz +(y*grid)+ tile, msPIXvt+(x*grid)+tile,
   ColourNameToRGB (c1), ColourNameToRGB (c2),1)
  else
   WindowGradient (win2,msPIXhz+(y*grid),msPIXvt+(x*grid), msPIXhz +(y*grid)+ tile, msPIXvt+(x*grid)+tile,
   ColourNameToRGB (c1), ColourNameToRGB ("white"),1)
  end
end
if cor == cor2 then --Draw room box/border
 WindowRectOp (win2, 1,msPIXhz+(y*grid),msPIXvt+(x*grid),msPIXhz +(y*grid)+ tile, msPIXvt+(x*grid)+tile,ColourNameToRGB("red"))
else
 WindowRectOp (win2, 1,msPIXhz+(y*grid),msPIXvt+(x*grid),msPIXhz +(y*grid)+ tile, msPIXvt+(x*grid)+tile,linecolor)
end
if Oroom[Rm].Adir then
 local Adir =  Oroom[Rm].Adir-------------- 
  if string.len (Adir) >2 then --add other exits box
  WindowRectOp (win2, 2,msPIXhz+(y*grid)-tilehighlight+1,msPIXvt+(x*grid)-tilehighlight+1,msPIXhz +(y*grid)+(grid/3), msPIXvt+(x*grid)+(grid/3),ColourNameToRGB("gold"))
  WindowRectOp (win2, 1,msPIXhz+(y*grid)-tilehighlight+1,msPIXvt+(x*grid)-tilehighlight+1,msPIXhz +(y*grid)+(grid/3), msPIXvt+(x*grid)+(grid/3),linecolor)
  elseif  Oroom[Rm].Rdir then
   local Rdir =  Oroom[Rm].Rdir
   if string.find (Rdir, " up ") or string.find (Rdir, " down ")or string.find (Rdir, " u ") or string.find (Rdir, " d ")or string.find (Rdir, " enter ")or string.find (Rdir, " out ") then --add other exits box
     WindowRectOp (win2, 2,msPIXhz+(y*grid)-tilehighlight+1,msPIXvt+(x*grid)-tilehighlight+1,msPIXhz +(y*grid)+(grid/3), msPIXvt+(x*grid)+(grid/3),ColourNameToRGB("crimson"))
     WindowRectOp (win2, 1,msPIXhz+(y*grid)-tilehighlight+1,msPIXvt+(x*grid)-tilehighlight+1,msPIXhz +(y*grid)+(grid/3), msPIXvt+(x*grid)+(grid/3),linecolor)
   end -- if
elseif  Oroom[Rm].Rdir then
 local Rdir =  Oroom[Rm].Rdir
 if string.find (Rdir, " up ") or string.find (Rdir, " down ")or string.find (Rdir, " u ") or string.find (Rdir, " d ") then --add other exits box
  WindowRectOp (win2, 2,msPIXhz+(y*grid)-tilehighlight+1,msPIXvt+(x*grid)-tilehighlight+1,msPIXhz +(y*grid)+(grid/3), msPIXvt+(x*grid)+(grid/3),ColourNameToRGB("crimson"))
  WindowRectOp (win2, 1,msPIXhz+(y*grid)-tilehighlight+1,msPIXvt+(x*grid)-tilehighlight+1,msPIXhz +(y*grid)+(grid/3), msPIXvt+(x*grid)+(grid/3),linecolor)
 end -- if
end -- if
end -- if
end
end
x=x+1
end--if
y=y+1
x=0
end
end--func

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

Re: mini windows GUI

Post by Vadi »

No lines yet, the need for them has been... quite low. First time anyone mentioned them even. Things are done with labels, quite powerful and made all the guis here: http://forums.mudlet.org/viewtopic.php?f=5&t=1376

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

Re: mini windows GUI

Post by Omit »

hmm... I need some advice then...problem is how do I draw the room connectors on my map....

As I see it I have three options

A) use labels without text sized to appear as a line (would work for n,s,e,w but not for nw,ne,sw,se if they can be turned 45 degs problem solved)

B) use labels with a transparent background and text... -,\,/,| (this seems like it would be a bit quirky but might be the best option and I will have to figure out a way to deal with water exits(they are currently just really fat lines))

c) use loaded images (seems like alot of overhead to as they may be used 100+ times and would have to be copied to the correct location by anyone that wanted to use them, one of my goals is to make it as simple for others to use as myself, and they are unlikely to set anything up)

any advice anyone has on this would be greatly appreciated.

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

Re: mini windows GUI

Post by Heiko »

I've always planned to add user graphics widgets for custom drawing, but so far nobody has asked for them because everything could be done easier and nicer via clickable images i.e. labels. For your map viewer type of application drawing functions would be better. They'll be added in a future release when our mapper is done.

Until then I'd suggest you add support for our 3D mapper to your MUD as this will most likely be more interesting to your user base. Have a look here: forums.mudlet.org/viewtopic.php?f=5&t=1412&start=70#p5261

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

Re: mini windows GUI

Post by Omit »

Is really too bad, everything for mapping is already here except the ability to draw it..... I will play with the labels and custom graphics a little bit, if I can stack them and have them preserve transparencies, preload the image once to use the many times it's needed, and come up with a system to keep them all aligned to each other.... It just could work with the tools already in place.(assuming the 100's of labels don't impact the performance to badly)

The mud I play is NOT map friendly and is not likely to ever be supported from the server side, I have been able to write an auto mapper for it in mush (and it will be much better in mudlet). The 3d mapper looks cool but is too much for my taste. My goal has always been to build a map that will track your location with a minimal amount of setup or effort and display it graphically (which it does pretty well). It is not intended for scripting movement, is not clickable, ....

I will let you all know how it goes....

Thanks You
Omit

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

Re: mini windows GUI

Post by Vadi »

Definitely interested on that progress. I had a few ideas relating to it, I'll see if I can post them sometime.

Post Reply