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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sun Sep 23, 2007 9:47 pm   

About Edit Button interface
 
After trying different button types, I have some remarks about Edit Button interface of Package Editor. I consider that as of now the way editor handle buttons is a bit inconsistent.

For ex., if I gonna add a new toggle button, I get root element in editor tree view and 1 sub-item for State 0. When I press the button for the first time, script from root element is executed. When I press it on second time, it execute script from State 0.
Now, let's say, I change my mind and decide to make this button multistate. Wow, now root element completely ignored and I must write scripts in State 0, State 1, State 2,... It is the odd thing!

My suggestion? Here is it: make State 0 obligatory for all button types and remove any script-related fields from the root element. And yes, I know it is annoying to hear from me again, but remove color settings to States too! Fore- and background colors must be state-dependent. This way it would be much easy to work with buttons:

Push buttons: State 0 only (other states ignored, if any)
Toggle buttons: States 0 and 1 (other states ignored, if any)
Multistate button: States 0, 1, 2,...
Root element: control variable, control expression, button position and size, button ID, button properties...

As you see, any button type have State 0 and at least, you must write some script for this state in order the button to work. You know that regardless of the button type and no matter what you will do with this button later, State 0 is the state you should start you scripting from. Again, now you must think where to put your script and will you change button type in the future... and think later why State 0 yields "Hello-2!" (see my script example) and why not "Hello-0!" or "Hello-1!"

This is sample button I played with while writing this post:
Code:

<button type="Multistate" autopos="false" top="30" transparent="false" color="#804040" priority="3170" id="317">
  <caption>Hello test</caption>
  <value>#SAY Hello-1!;</value>
  <state caption="Caption for St0" color="#004000">#SAY Hello-2!</state>
  <state caption="Caption for St1">#SAY Hello-3!</state>
</button>


why not use the following syntax instead:
Code:

<button type="Multistate" autopos="false" top="30" priority="3170" id="317">
  <state caption="Caption for St0" color="#804040" transparent="false">#SAY Hello-1!</state>
  <state caption="Caption for St1" color="#004000" transparent="false">#SAY Hello-2!</state>
  <state caption="Caption for St2">#SAY Hello-3!</state>
</button>


It is easy to understand, easy to debug... I think, it is even easy to implement for Zugg, because of less number of tags used.
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Sep 24, 2007 8:48 pm   
 
The problem with making these kind of big changes is maintaining compatibility with zMUD. Toggle buttons and Multistate buttons are completely different items, and making them work consistently within a single user interface is difficult. A Toggle button is nothing like a 2-state multistate button internally.

In a multistate button, the number of states corresponds to the number of menu items that you see when you click the button. The master button caption is only used for the button caption when none of these states are selected.

What I might be able to do is improve the XML syntax for these buttons to make them a bit easier to understand. However, that still won't address the fundamental problem. In your example of a Toggle button that has 2 states, then what does the Caption of the main button determine? It's not like a multistate button where you need a caption value when no state is selected...with toggle buttons there is *always* a state selected.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Tue Sep 25, 2007 11:02 pm   
 
First of all, I understand that this will take a lot of resources from you and there is many more important tasks waiting to solved\implemented. It was just my remark and a long-term wish. Very Happy

Buttons are different. Yes, this is your point of view as programmer. Internally they can be different (and they are), but main idea was to provide a standard interface for user. And here is another point of view. How script can control a button? Via control variable or expression, right? Every button type has them. So, from the point of view of my script, there are no differences what type of button it control. Just be aware of maximum possible button states and you'll be alright. Script does not bother with "how that button will be drawn on screen, as button or as menu?" question, only "how can I control it state and get information about it?". Sure, if all left as it is, there is significant difference between button types, with different scripting technique, but this is artificially created difference. It is up to programmer to change this and I can understand you when you do not want to make such changes while there are many other things to dealt with.

Ok, let's close this question for a while. Very Happy

P.S. Caption for main buttons may have only multistates. Gauges have it onw tab, why multistates can't have its own?. For other button types Caption property should be removed from main button properties. Not compatible with zMUD? Heh, you may introduce ButtonEx control type. Every problem may be solved. Wink
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Sep 26, 2007 5:03 pm   
 
I think maybe I wasn't clear in what I was saying...

A "toggle" button has two states: off and on (0 and 1), so therefore it has two captions. But a "multistate" button with 2 states actually has *three* captions: state 1, state 2, and the "unselected" state (state 0). That's why a multistate button is different from a toggle button.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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