Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Tue Oct 05, 2010 10:12 pm   

Cmud window size [Resolved]
 
Is there any way to determine the dimensions of a Cmud window, either in pixels or rows and columns, using the scripting language?


Last edited by DraxDrax on Mon Feb 21, 2011 7:49 am; edited 2 times in total
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue Oct 05, 2010 10:28 pm   
 
Not sure if there is, but I know Zugg will be out of town for the week and if anyone would know for 100% it would be him. Still, most of the Gurus would be able to answer. Would be neat if it's something that could be imped in a later version of the v3 release though, if it doesn't exist.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Oct 06, 2010 1:23 am   
 
I don't think there is, though if there was something like that it'd probably be part of the COM server (I kind of think it's not exposed there, either, however).

One of the longer-range (ie, no idea when he'll get around to it) plans is to incorporate zApp objects into CMud so that not only can we have more powerful stuff but that also we can customize them much like working with packages.
_________________
EDIT: I didn't like my old signature
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Wed Oct 06, 2010 5:56 am   
 
I didn't think there was, but it never hurts to ask.
Thanks for the info, chemenas and Matt!
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Wed Oct 06, 2010 9:41 pm   
 
Another question for you folks, and again I suspect the answer is no...

Is there any way to control the size and position of buttons from within the scripting language?
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Oct 07, 2010 12:28 am   
 
Yes... you do that with the #BUTTON command.
_________________
Asati di tempari!
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Thu Oct 07, 2010 10:34 am   
 
So it is! I read 'Here is description of each argument used in the full button creation command (used in Export and Import)' from the help file and thought those options could only be passed that way. Silly me.

Thanks Tech
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Oct 10, 2010 11:32 pm   
 
Also it is generally better to adjust the properties of a button from within the Lua interface. You can control a few more options, and it is quite a bit easier.

I don't know of any specific way within CMud to fetch the dimension for its display window. However you can create a window with explicit pixel sizes using the MXP window tags or the #MAKEWINDOW command. You might also check in the Lua interface to see what details are included with the module data.

Lua interface
The data fectched from there is a key=value paring table, and you should just test different things to see if it exposes the fields you want information on.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Tue Oct 12, 2010 7:17 pm   
 
Any time I've fiddled with buttons, I've done so through Cmud's settings menu. That's always been sufficient for me, and is also why I didn't realize the #BUTTON command accepted so many arguments; I'd never had cause to use it.

What I'm fiddling with at the moment is the possibility of generating interface elements dynamically, according to the dimensions of the window, and whether or not that's a good idea, or for that matter, even possible.

There are several benefits to this for me, with the most obvious being the possibility of generating tables of data output to the user that make optimal use of their display area, rather than only using a portion of it, or outputting data which is linewrapped.

Vijilante wrote:
You might also check in the Lua interface to see what details are included with the module data.

Lua interface
The data fectched from there is a key=value paring table, and you should just test different things to see if it exposes the fields you want information on.


Is there an easier way to search through this than: print (zs.sys.<string>) where string is me taking wild guesses at what the data I want might be referenced as? I run in to the same problem with #VAR Cmud %comcreate("Zmud.Application");#VAR data %comget(Cmud, <string>);#SAY @data.

Taking blind guesses is proving futile.
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Wed Oct 27, 2010 10:30 pm   
 
The more that I fiddle around with the script I'm working on now, the more things I think of that would work a whole lot better if only I had some way to determine the height and width of the user's Cmud windows, whether it's the main session window or child windows. With that in mind, I'm bumping this topic in hopes Zugg will respond and be able to offer his unique insight.

If there is not currently a way to determine this information, I'd really like for it to be added to the next version!

Also, I've been learning more LUA and using it extensively for an ever increasing number of things since you recommended it, Vijilante. Thanks for the great suggestion!
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Oct 28, 2010 2:25 am   
 
The last time this came up, I believe Zugg said that Cmud can't get that information. And even if it could, knowing the height and width would not be enough because font size can vary.
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Thu Oct 28, 2010 2:38 am   
 
Code:
#SAY <font face="lucida handwriting" size="12">But what if you get clever with font tags and force the use of the one you wan so that the height and width are known?</font>


It's also useful for sizing buttons and gauges and... lots of other things!

It would be unfortunate if that information is completely unavailable.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Oct 28, 2010 10:52 pm   
 
Sorry, as I said there isn't any way to return that information and I'm not adding any more new features till the 4.x versions. So your request is on the wish-list for the future.
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Fri Oct 29, 2010 2:05 am   
 
If nothing else, I've got a definitive answer. Appreciate the response, Zugg, even if it's not the one I'd hoped for.
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Mon Feb 21, 2011 7:39 am   
 
It turns out, you'd already included functions that do precisely what I wanted when I asked about this, Zugg. Very Happy

#SAY The size of this Cmud window is %pref(WindowWidth) by %pref(WindowHeight) pixels
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Tue Feb 22, 2011 1:51 am   
 
Pretty cool, you learn something new every day.

With the massive number of lines of code in the program and the multitude of commands and functions it's not surprising in the least that the creator of the program forgets a thing or two.

Good find.
_________________
Taz :)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Feb 22, 2011 6:26 pm   
 
Wow, I don't even remember those options myself. I'm not sure those options are going to change dynamically as you resize the window. They might just be computed when the preferences are saved.

Keep in mind that the %pref function is a very low-level internal function and I can't guarantee that they will always have the same name. Then again, I've never changed an internal name in the past, so it's unlikely I'll change something like that in the future. But there *are* some %pref options left over from old times that are no longer used within CMUD, so sometimes an old option gets replaced with a newer option. An example would be the "MapFile" option which used to give the name of the map database, but was replaced by the Map Database object within the user settings.

In any case, gratz on coming up with a solution to this!
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Tue Feb 22, 2011 7:33 pm   
 
Yeah, I'm really pleased to have found that you included it, Zugg! All the ideas I had about dynamically generated output and interface elements that were shelved a few months ago are back on the table now.

%pref(WindowWidth) and %pref(WindowHeight) do appear to update appropriately whenever the window is resized, which is excellent. You can alter the values of the variables, but this has no effect and I imagine it's a bad idea to mess with them that way. I haven't had too close a look at the other values exposed by %pref() but I plan on going through them more thoroughly.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net