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
miegorengman
Wanderer


Joined: 05 Sep 2008
Posts: 53

PostPosted: Fri Jun 24, 2022 12:35 pm   

Making Class Cycling Buttons
 
I have receive alot of help from the forum, thank you much. I have finally built something that I think will be helpful to others and thought I would share.

I have a short list of activities that I perform regularly, and working from a laptop with a mousepad, I thought it would be easier to make a single button that would switch through a lists of classes than use a dropdown list. The nice thing about this method is that if you want to add a class to the rotation, simply add the name of the class to the list variable and you can click away.

The button first closes all classes named in the list variable. Using a counter/variable it then adds 1 to move to the next row of the list, opening the class named on that row. whenever the counter exceeds the number of rows containing data, it resets to 1. The thing I think that is the nicest about this is that it is infinitely scalable. As I mentioned before if you want to add another class, just add it to the list variable and it is now included in the rotation.

Code:
<class name="classCycleButton" id="5563">
  <var name="className" type="StringList" id="5641">
    <value>exampleClassSparring|exampleClassMagic|exampleClassSailing|exampleClassPetTraining</value>
    <json>["exampleClassSparring","exampleClassMagic","exampleClassSailing","exampleClassPetTraining"]</json>
  </var>
  <var name="classNameRowNumber" type="String" id="5643">1</var>
  <button autosize="false" width="200" height="16" color="black" textcolor="lime" priority="34654" id="5645">
    <caption>%item(className,@classNameRowNumber)</caption>
    <value>#FORALL @className {#t- %i}
#var classNameRowNumber (@classNameRowNumber+1)
#if (@classNameRowNumber > %numitems(@className))
{#var classNameRowNumber {1};
#t+ %item(className,@classNameRowNumber)}
{#t+ %item(className,@classNameRowNumber)}</value>
  </button>
  <class name="exampleClassSparring" id="5646"/>
  <class name="exampleClassMagic" enabled="false" id="5647"/>
  <class name="exampleClassSailing" enabled="false" id="5648"/>
  <class name="exampleClassPetTraining" enabled="false" id="5649"/>
</class>
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