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
toade
Newbie


Joined: 30 Jun 2013
Posts: 7

PostPosted: Sun Sep 27, 2015 12:55 am   

Buttons by command line.
 
So, i currently have two large graphical buttons i'd like to use as gauges. Picture included for reference. What i'd like to do is tie creation of two buttons to my prompt, that would start at the top of each graphic, and adjust size as the player gains/loses hp. in essence, really snazzy hp/mp bars. the buttons would be black, of course, and just cover the existing button to give the impression of the gauge depleting. The problem isn't the math, or the idea of variables, most of that i understand and can figure out. What i'm stuck on is making buttons via the command line that'll suit the purpose. Was wondering if one of you guru's could help me out. for reference, the graphics (buttons) are currently the same size:450wx1020 tall. the button on the left hand side is on toolbar3 and aligned to right-bottom. the button on the right is assigned to toolbar 0 and right-bottom.
To summarize what i'm asking: I need the command line to create a button that'll align it'self to the top of each of the current buttons i have, fully covering it withwise, and need to know which part of the command line controls height.

Thank you in advance,
Toade

Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sun Sep 27, 2015 8:36 am   
 
Technically possible, but editing buttons from the command line is a chore, and not one I envy your trying to tackle...
I would instead rely on the fact that buttons stack in the order created (not priority).
So make your image buttons first, which you have already done.

On the options tab of the button there is the auto-size and auto-position that will likely need to be unchecked on these, and any other included buttons if you use this idea.

Make a series of buttons on each side that would obscure your graphic, and toggle them with #T+ and #T- accordingly.

Does the graphic not display in the foreground on gauges?
_________________
Discord: Shalimarwildcat
Reply with quote
toade
Newbie


Joined: 30 Jun 2013
Posts: 7

PostPosted: Sun Sep 27, 2015 9:05 am   
 
Indeed, the image shows on top, which is why i need to use the buttons to mask the image (unless there is a better way, of course). With the image showing on top when you make a gauge... well.

It's not so pretty. I've been playing around with buttons on the command line for a few hours, and had no luck figuring it out. Without guidance, your suggestion seems like the best one, though 100 triggers enabling 100buttons for each % (or disabling them) seems a bit insane. 200, since there's two gauges i suppose. the thought had been to trigger the resizing of one button convering my hp into a percentage then taking a percentage of the 1020 height and using it to 'recreate' a single button over each gauge. seemed more elegant... but without an example, your thought is at least a workaround :).

I had also thought to just put a second button overlapping it and make the button transparent and the depleted part of the gauge black, but apparently transparent isn't actually transparent, it just goes to the cmud theme colors :P
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sun Sep 27, 2015 1:20 pm   
 
Well...does the image only show in the 'full' portion of the gauge?
Or does it act more like a caption that shows either way?

As for the number of buttons, that could be diminished by using blocks larger than 1%.

Your initial option is viable, but that would take a lot more playing around with it, according to the help file (#HELP #BUTTON) height looks like the 11th parameter you pass it.
But they were designed to be made via the GUI.
Part of me suspects that redefining the button constantly would have a performance impact.
_________________
Discord: Shalimarwildcat
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sun Sep 27, 2015 1:27 pm   
 
I was just thinking... even if it could be made to grow.... it would be growing down from the anchor point, not up... but you might be able to fix that with the button alignment options.
_________________
Discord: Shalimarwildcat
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Sun Sep 27, 2015 11:42 pm   
 
If you don't mind using Lua instead of zScript, I find the Lua interface much easier to use for modifying settings. To change a button's height, you can use zs.getbutton("id").buth = x, where id is the id of your button, and x is the new height. If you also need to reposition it, you can also change the butl and butt properties to change the left and top positions of the button (full list of properties here).
Reply with quote
toade
Newbie


Joined: 30 Jun 2013
Posts: 7

PostPosted: Sun Sep 27, 2015 11:53 pm   
 
Got it working somewhat, however: your suspicion was correct. constantly redefining and deleting buttons had major issues. Even the other way, enabling and disabling, caused visual distortion.
I've since switched to trying to use simple two tone images, and make a transparent shape with a black background (so it looks like the shape is filling and shrinking) with an actual gauge.
... believe it or not, this too, seems to have strange problems! Since I already have your attention (and it seems you are the resident wizard judging by the forum posts i've scrolled thru trying to figure this out),
I thought you might be able to assist me in figuring this out. At this point i'm attempting an actual gauge with a simple two tone image on it, a tribal dragon atm. At first, i forgot that bitmaps didn't support transparency.
so now that i've overcome that, i've noticed however that cmud renders one of my two colors transparent. which is great! yet, no matter what i do, (invert colors, change colors, etc) it seems to render the space around the part i want transparent, instead of vice versa.
I read a post saying something about zmapper using the bottom left pixel to establish transparency, and attempted that, but that doesn't seem to work either. Is there a way to change which part of the image cmud determines is transparent?
Basically, what i'm attempting to do is make the area outside the dragon black at all times, and the interior show the gauge.
Pictures attached for means of explanation.
Reply with quote
toade
Newbie


Joined: 30 Jun 2013
Posts: 7

PostPosted: Mon Sep 28, 2015 1:29 am   
 
Solved. Transparency is determined by the pixel in the upper left. this leaves a line on the left side of the button that is transparent and moves with the gauge. button aligned with the left side of the screen doesn't show it, buttona ligned with the right does. changing it to toolbar/inset seems to have hidden it giving a seamless feel. Though i'll be doing more image editing, this part is solved as best as it can be. :)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Mon Sep 28, 2015 8:03 am   
 
Mind tossing up the XML for others?
Oh... you had to gimp it up, I guess I should learn how to edit images at some point....
_________________
Discord: Shalimarwildcat
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