Page 1 of 1

micromacro properties

Posted: Fri Jan 18, 2013 11:57 pm
by rock5
Is there any way I can get the dimensions of the MM window via the commandline? Is there any command for this?

Re: micromacro properties

Posted: Sat Jan 19, 2013 12:21 am
by lisa
if you know the process for the specific MM you can use

Code: Select all

local windowList = findWindowList("MicroMacro");
local wx, wy, ww, wh = windowRect(windowList [1]);
you get the idea anyway, not sure if there is a specific function just for getting the current MM window.
If there was one it would be in /src/luaglue.cpp

--=== Added ===--
you can also use this aswell

Code: Select all

findWindowList("*","ConsoleWindowClass")

Re: micromacro properties

Posted: Sat Jan 19, 2013 12:52 am
by lisa
might seem a little crude but you could do this.

Change window name on the MM using setWindowName and then check for that window name using

Code: Select all

setWindowName(getHwnd(), "name you set")
local mmwindow = findWindowList("*","ConsoleWindowClass")
for i = 1,#findWindowList do
if getWindowName(windowList[i]) == "name you set" then
mymm = mmwindow[i]
return
end
end
hmm mind you the getHwnd() might be all you need to find the MM window process

Re: micromacro properties

Posted: Sat Jan 19, 2013 1:05 am
by rock5
I suspect your example returns the window dimensions. I didn't make myself clear. I was after the character dimensions. For a laugh I'm trying to make a better image displayer and wanted to know if the image would fit.

BTW, if you don't need the window list then you can just use "findWindow()". Simplifies it a bit.

Code: Select all

local window = findWindow("MicroMacro");
local wx, wy, ww, wh = windowRect(window);
Now I have another problem. The character I was going to use, a half block, has a line down the side which ruins the result.
logo.jpg
Is it possible to change the character so it's a full half block? I suspect not but it doesn't hurt to ask.

Re: micromacro properties

Posted: Sat Jan 19, 2013 1:06 am
by lisa
yup

Code: Select all

local wx, wy, ww, wh = windowRect(getHwnd())
printf("Current MM Height is :%d , Width is :%d\n",ww,wh)
prints this

Code: Select all

Current MM Height is :640 , Width is :540

Re: micromacro properties

Posted: Sat Jan 19, 2013 1:09 am
by lisa
rock5 wrote:I suspect your example returns the window dimensions. I didn't make myself clear. I was after the character dimensions. For a laugh I'm trying to make a better image displayer and wanted to know if the image would fit.
divide by 8

Code: Select all

local wx, wy, ww, wh = windowRect(getHwnd())
numcharacters = ww/8
it is on my screen anyway ;)

Re: micromacro properties

Posted: Sat Jan 19, 2013 1:15 am
by rock5
lisa wrote:divide by 8

it is on my screen anyway ;)
I thought about that but the fonts width can be changed.

Re: micromacro properties

Posted: Sat Jan 19, 2013 1:29 am
by lisa
i used CE on the MM window and couldn't even find an address for font width, ohh well.

Re: micromacro properties

Posted: Sat Jan 19, 2013 1:38 am
by rock5
LoL. Me too.

Re: micromacro properties

Posted: Sat Jan 19, 2013 5:04 am
by lisa
this might be off topic but it got me thinking why don't we change the name of the RoM window, for example to character name, would make it easier to know which window is doing what.

It is as simple as this

Code: Select all

setWindowName(getWin(), player.Name)
Could also set it for the WP file name or even account name.

Re: micromacro properties

Posted: Sat Jan 19, 2013 5:48 am
by rock5
Already done in RC3. :)

Re: micromacro properties

Posted: Sat Jan 19, 2013 12:43 pm
by Administrator
I've added a function to return a bunch of information about the console: window width/height (in characters), buffer width/height (in characters), and cursor X/Y. That should probably do.


Also, it's easier/more reliable to just use getHwnd() instead of querying the window name/class for a handle to the window.

Re: micromacro properties

Posted: Sat Jan 19, 2013 12:58 pm
by rock5
Administrator wrote:I've added a function to return a bunch of information about the console: window width/height (in characters), buffer width/height (in characters), and cursor X/Y. That should probably do.
Cool, thanks.
Administrator wrote:Also, it's easier/more reliable to just use getHwnd() instead of querying the window name/class for a handle to the window.
I knew there was a function like that because I noticed it in passing once. But for some reason I couldn't find it before. Now I found it.

How about the fonts? Is it possible to make the half blocks go all the way from left to right? By half blocks I mean

Code: Select all

print(string.char(0xDF,0xDC))
They print right when using the Raster fonts but not when using the other 2.

Re: micromacro properties

Posted: Sat Jan 19, 2013 1:07 pm
by Administrator
rock5 wrote: How about the fonts? Is it possible to make the half blocks go all the way from left to right? By half blocks I mean

Code: Select all

print(string.char(0xDF,0xDC))
They print right when using the Raster fonts but not when using the other 2.
I don't know about that. I think there will be a lot of issues with different fonts. Have you tried 0xFE?
Maybe the extended ASCII table will help: http://www.asciitable.com/

Re: micromacro properties

Posted: Sat Jan 19, 2013 1:43 pm
by rock5
Aren't 0xDF and 0xDC part of the extended character set? 0xFE is a block in the middle. I can't use that.

I even checked those 2 with the Character Map utility using the 'Terminal' font, which seems to match the MM character set. It prints them with no lines between them.

Hold on a sec. Print doesn't cause lines between them, neither does printf. Only cprintf causes lines between them. Or maybe it depends on the color. It seems that only in lightgray does it print properly.

Re: micromacro properties

Posted: Sat Jan 19, 2013 3:46 pm
by Administrator
That's really strange. I have no idea why that would be. The text color shouldn't affect that.

Re: micromacro properties

Posted: Sun Jan 20, 2013 11:24 am
by lisa
rock5 wrote:
lisa wrote:divide by 8

it is on my screen anyway ;)
I thought about that but the fonts width can be changed.

Code: Select all

local wx, wy, ww, wh = windowRect(getHwnd())
for i = 7,12 do
if math.fmod(ww,i) == 0 then
numchars = ww/i
return
end
end
math.fmod returns the remainder of the division of the 2 numbers, so if there is no remainder (0) then pretty good chance the font size is the value of i.
Of course this could be wrong if the width is a multiple of 2 of the numbers, 7 & 8. so 56,112,168,224,280...

Re: micromacro properties

Posted: Sun Jan 20, 2013 11:38 am
by rock5
Interesting idea but of course there are a lot of other widths and therefore lots of overlaps.

Anyway Administrator said he added a function for getting info so I would eventually be able to use that but I've abandoned this project because I can't get those blocks to print properly.