DICE PACKS BUNDLE
Page 1 of 3 123 Last
  1. #1

    is it possible to change sortby to descending?

    I'm doing a very half-assed job of trying to modify goldendase's Fall of Delta Green extension into something I can use for Mutant City Blues 2E. One of the issues is that the addition of Mutant abilities, some general and some investigative adds a bunch a more skills that you don't necessarily want to scroll through. One thing I am try to do is break out the mutations to another tab which I have sort of halfway done. The other is to try to sort the list of abilities by rating (points invested) rather than label (name).

    This line seems to sort the abilities as they display.

    <sortby><control>rating</control></sortby>

    However it sorts it Ascending meaning that abilities with ratings in them sort to the bottom of the list not the top as I would like. Is there a way to change it to descending?

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Have a look at the definition of sortyby in the windowlist control API: https://www.fantasygrounds.com/refdoc/windowlist.xcp You'll see that you can add a "desc" parameter.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    At the risk of sounding dense, in the case of the given parameters <sortby desc="..." case="..." > would that be "<sortby desc="1" or "True"?

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Search in most of the FG rulesets for desc="true" for examples.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #5
    I only found one example in searching and it was to do with rolled dice results.

    <sortby>
    <control desc="true">rolled</control>
    <control>total</control>
    </sortby>

    I tried various iterations of...
    <sortby>
    <control desc="true">rating</control>
    <control>rating</control>
    </sortby>

    But still sorts ascending. I can't make heads or tails of it. Time to walk away for awhile.

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    That example is using two controls - rolled and total. rolled is descending, then total would be ascending.

    The XML you've posted would first do "rating" as descending and then "rating" as ascending - so you're overriding the descending with the ascending.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  7. #7
    <sortby>
    <control desc="true">rating</control>
    </sortby>

    Still sorts "rating" ascending.

  8. #8
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    What kind of list is this? Is it a windowlist control within XML or is it a grouped list (built in list functionality in CoreRPG based rulesets that are accessed via buttons from the campaign data list)?

    Please post some XML to show where you're doing this and give context to the issue.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  9. #9
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Additionally? Is rating the name of the control or the field in the database?

    Based off the API documentation, you could also try something like this:
    Code:
     <sortby desc="true">
    	<control>rating</control>
     </sortby>
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  10. #10
    Quote Originally Posted by Trenloe View Post
    Additionally? Is rating the name of the control or the field in the database?
    Short answer is I don't know. I am altering something already functional.

    There is a list of abilities/skills.
    In this case from the skills_manager.lua
    Code:
    local minvestigation_skills = {
    	["Analytic Taste"] = { rating = 0, pool = 0, id = "analytic_taste" },
    	["Environmental Awareness"] = { rating = 0, pool = 0, id = "environmental_awareness" },
    	["Hearing"] = { rating = 0, pool = 0, id = "hearing" },
    	["Microvision"] = { rating = 0, pool = 0, id = "microvision" },
    	["Observe Dreams"] = { rating = 0, pool = 0, id = "observe_dreams" },
    	["Olfactory Center"] = { rating = 0, pool = 0, id = "olfactory_center" },
    	["Plant Communication"] = { rating = 0, pool = 0, id = "plant_communication" },
    	["Read Minds"] = { rating = 0, pool = 0, id = "read_minds" },
    	["Spatial Awareness"] = { rating = 0, pool = 0, id = "spatial_awareness" },
    	["Technopathy"] = { rating = 0, pool = 0, id = "technopathy" },
    	["Thermal Vision"] = { rating = 0, pool = 0, id = "thermal_vision" },
    	["Touch"] = { rating = 0, pool = 0, id = "touch" },
    	["Translation"] = { rating = 0, pool = 0, id = "translation" },
    	["X-Ray Vision"] = { rating = 0, pool = 0, id = "x_ray_vision" },
    }
    I want to sort on the rating number rather than the label (which seems to be name) so that the abilities with ratings float to the top.

    I am trying to make a separate tab with the Mutation "skills" but running into trouble there...anyway the xml for that tab is this...
    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    
    <!-- 
      Please see the license.html file included with this distribution for 
      attribution and copyright information.
    -->
    
    <root>
    	<windowclass name="charsheet_skills_mutations">
    		<sheetdata>
    			<label name="mgeneral_lbl">
                    <bounds>20,0,475,20</bounds>
    				<default>General Mutant Abilities</default>
    			</label>
                <frame_char name="mgeneral_skillframe">
    				<anchored to="mgeneral_skills_lbl" position="below" height="380"/>
    			</frame_char>
    
                <windowlist name="mgeneral_skills">
                    <anchored to="mgeneral_skillframe">
    					<top offset="20" />
    					<left offset="15" />
    					<right offset="-20" />
    					<bottom offset="-20" />
                    </anchored>
    				<child></child>
    				<child><backcolor>1A40301E</backcolor></child>
    				<allowcreate/>
    				<allowdelete/>
    				<datasource>.mgeneral_skills</datasource>
    				<class>char_skill</class>
    				<sortby>
    				<control desc="true">rating</control>
    				</sortby>
    				<columns width="220" filldown="true" />
    			</windowlist>
    			<scrollbar>
    				<anchored to="mgeneral_skills" />
    				<target>mgeneral_skills</target>
    			</scrollbar>
    
                <label name="minvestigation_label">
    				<!-- <bounds>20,190,475,20</bounds> -->
    				<bounds>20,380,475,20</bounds>
    				<default>Investigative Mutant Abilities</default>
    			</label>
    
                <frame_char name="minvestigation_skillframe">
    				<anchored to="minvestigation_label" position="below" height="175" offset="0,5" />
    			</frame_char>
                <windowlist name="minvestigation_skills">
                    <anchored to="minvestigation_skillframe">
    					<top offset="20" />
    					<left offset="15" />
    					<right offset="-20" />
    					<bottom offset="-10" />
                    </anchored>
    				<child></child>
    				<child><backcolor>1A40301E</backcolor></child>
    				<allowcreate/>
    				<allowdelete/>
    				<datasource>.minvestigation_skills</datasource>
    				<class>char_skill</class>
    				<sortby><control>rating</control></sortby>
    				<columns width="220" filldown="true" />
    			</windowlist>
    			<scrollbar>
    				<anchored to="mgeneral_skills" />
    				<target>minvestigation_skills</target>
    			</scrollbar>
    
               <!--  <label name="tech_label">
    				<bounds>20,370,475,20</bounds>
    				<default>Technical Abilities</default>
    			</label> -->
    
                <!-- <frame_char name="tech_skillframe">
    				<anchored to="tech_label" position="below" height="185" offset="0,5" />
    			</frame_char>
                <windowlist name="tech_skills">
                    <anchored to="tech_skillframe">
    					<top offset="20" />
    					<left offset="15" />
    					<right offset="-20" />
    					<bottom offset="-20" />
                    </anchored>
    				<child></child>
    				<child><backcolor>1A40301E</backcolor></child>
    				<allowcreate/>
    				<allowdelete/>
    				<datasource>.technical_skills</datasource>
    				<class>char_skill</class>
    				<sortby><control>label</control></sortby>
    				<columns width="220" filldown="true" />
    			</windowlist>
    			<scrollbar>
    				<anchored to="mgeneral_skills" />
    				<target>interp_skills</target>
    			</scrollbar> -->
    
                <subwindow name="spend_win">
    				<bounds>15,-100,450,90</bounds>
    				<class>spend_window</class>
    				<datasource>.meta</datasource>
    				<activate />
    			</subwindow>
            </sheetdata>
        </windowclass>
    </root>
    MCB2E.png

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
STAR TREK 2d20

Log in

Log in