Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| en:help:v2:maps:on-demand-create [2025/06/24 18:24] – new function as of 2.4.0 psyberia | en:help:v2:maps:on-demand-create [2025/11/07 14:31] (current) – [User input parameters] psyberia |
|---|
| ===== Advanced features ===== | ===== Advanced features ===== |
| |
| ==== Custom variables ==== | ==== Custom expressions ==== |
| \\ | \\ |
| In addition to the variables provided by default, you can create your own variables defined by mathematical expressions: | In addition to the variables provided by default, you can create your own variables defined by mathematical expressions: |
| <code xml> | <code xml> |
| <source id="MAP_UID"> | <source id="MAP_UID"> |
| <name>Custom Variables Map Example</name> | <name>Custom Expressions Map Example</name> |
| <zoom-levels z="1-17"> | <zoom-levels z="1-17"> |
| <expression set="my_variable" type="int">iif( z>10, x*y, x+y )</expression> | <expression set="my_variable" type="int">iif( z>10, x*y, x+y )</expression> |
| |
| [[en:help:v2:maps:on-demand-create#inline_expressions|See here for more details on available operators and functions.]] | [[en:help:v2:maps:on-demand-create#inline_expressions|See here for more details on available operators and functions.]] |
| | |
| | \\ |
| | |
| | ==== User input parameters ==== |
| | \\ |
| | |
| | You can request some parameters input to the user. When the map is displayed, the user has the ability to set all th parameters available according to his needs. |
| | |
| | To request a single choice parameter, use this tag: |
| | |
| | <code xml> |
| | <variable set="param1" type="single" values="red,green" choices="Red color,Green color" default="red" display="Choose a color" /> |
| | </code> |
| | |
| | The ''"**set**"'' attribute defines the name of the variable that can be then used in custom expressions. The ''"**values**"'' attribute lists all the possible values the variable can have. The optional ''"**choices**"'' attribute lists the same values but for user display. The ''"**default**"'' attribute gives the default value to the variable (for example used to generate the map preview). The optional ''"**display**"'' attribute gives the title of this input to the user. |
| | |
| | To request a multiple choices parameter, use this tag: |
| | <code xml> |
| | <variable set="param2" type="multi" values="caves,mines" choices="Show caves,Show mines" default="caves,mines" join="," none="none" display="What to display" /> |
| | </code> |
| | |
| | The ''"**join**"'' attribute defines what to use to join the multiple choices into the variable. The optional ''"**none**"'' attribute defines what to set to the variable when no choices are selected. |
| |
| \\ | \\ |