User Tools

Site Tools


macros:example:firequickpalette

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
macros:example:firequickpalette [2025/04/24 13:23] – removed - external edit (Unknown date) 127.0.0.1macros:example:firequickpalette [2025/04/24 13:53] (current) icke_siegen
Line 1: Line 1:
 +Example
 +
 +====== Palette - Fire Quick Palettes and Show Active ======
 +
 +^ by: | Sebastian Beutel |
 +^ published: | April 2025 (stems from 2023) |
 +^ description: | fire some quick palettes and show active state |
 +^ remarks: | useful to see which active palette is currently fired |
 +
 +{{tag>quick palette active}}
 +
 +==== functions ====
 +  * [[:macros:function:ActionScript.SetProperty.Integer]]
 +  * [[:macros:function:Palette.ApplyQuickPalette]]
 +
 +==== control structures ====
 +  * [[macros:Variables]]
 +  * [[macros:active_binding|]]
 + 
 +===== Code =====
 +
 +File with macros for some more palettes in two segments here: {{ :macros:example:firequickpalettes.xml |}}
 +
 +<code xml FireQuickPalettes_example.xml>
 +<?xml version="1.0" encoding="utf-8"?>
 +<avolites.macros>
 +  
 +  <macro id="Wiki.Macros.Palettes.FireQuickPaletteInit" name="Init Palette Vars">
 +    <description>Initializes variables for other macros.</description>
 +    <variables>
 +      <integer id="PaletteRange100" value="100"/>
 +      <integer id="PaletteRange110" value="110"/>
 +    </variables>
 +  </macro> 
 +
 +  <macro id="Wiki.Macros.Palettes.FireQuickPalette101" name="Fire QuickPalette 101">
 +    <description>Fires QuickPalette 101 and shows as active.</description>
 +    <active binding="{propertyLink id='Wiki.Macros.Palettes.FireQuickPaletteInit.PaletteRange100' converter='Math.EqualityConverter' converterParameter='101'}"/>
 +    <sequence>
 +      <step>ActionScript.SetProperty.Integer("Wiki.Macros.Palettes.FireQuickPaletteInit.PaletteRange100", 101)</step>
 +      <step>Palette.ApplyQuickPalette(userNumber: 101, true)</step>
 +    </sequence>
 +  </macro> 
 +
 +</avolites.macros>
 +</code>
 +
 +
 +===== Explanation =====
 +
 +This explains the functional steps within the sequence. For all the other XML details please refer to [[:macros:formats_and_syntax#xml_format|Formats and syntax]]
 +
 +The first macro simply initialises the variables ''PaletteRange100'' and ''PaletteRange110'' which are then used to hold which variable is currently active (you need to make sure this follow some logic...).
 +
 +The second macro ''Fire QuickPalette 101'' does the work (you need to create some more such macros though):
 +  * ''<active binding=...'' checks whether this macro should show as active, based on the number in the corresponding variable
 +  * ''ActionScript.SetProperty.Integer()'' sets the variable to the number of this macro/palette
 +  * ''Palette.ApplyQuickPalette(userNumber: 101, true)'' fires the corresponding palette as quick palette
 +
 +
 +===== How to use it =====
 +
 +  - duplicate the second macro and adjust the numbers for the usernumbers you want to work with
 +  - [[:macros:deploying|make this macro available]]
 +  - adjust the usernumbers of the palettes you want to work with
 +  - instead of clickng the palette buttons now fire the macros
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki