Outils pour utilisateurs

Outils du site


en:yaml:imagemaps

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
en:yaml:imagemaps [2026/05/18 21:59] – Ajout documentation image maps v4.11 cyrilfiestaen:yaml:imagemaps [2026/07/15 01:41] (Version actuelle) – maj 4.13 : modes d'interface + corrections cyrilfiesta
Ligne 59: Ligne 59:
   * ''hover-event:'' : id of a local event triggered on hover.   * ''hover-event:'' : id of a local event triggered on hover.
   * ''highlight: true'' : highlights the zone on hover.   * ''highlight: true'' : highlights the zone on hover.
 +  * ''display-color:'' : color used for the highlight or permanent paint.
 +  * ''display-mode:'' : ''fill'' or ''outline''.
 +  * ''state:'' : ''visible'', ''disabled'' or ''invisible''.
  
 ===== Related events ===== ===== Related events =====
Ligne 80: Ligne 83:
 </code> </code>
  
-Usual fields remain available: ''if:'', ''visible-if:'', ''disabled-if:'', ''do:'', ''to:''''text:''''failure-text:'' and ''once:''. Zones respect conditions carried by the referenced event.+Related events keep their usual fields: ''if:'', ''do:'', ''to:'', ''text:'', ''failure-text:'' and ''once:''. The ''visible-if:'' and ''disabled-if:'' keys apply to the whole map. To condition a specific zone, use ''state:'' and its ''if:'' layers.
  
-===== once: zone =====+===== Zone state =====
  
-''oncezone'' is useful when the same mask color contains several separated zones. Each component can then trigger once per room visit.+The state is checked both when the map is displayed and when a click is received. 
 + 
 +^ Value ^ Effect ^ 
 +''visible'' | Default state. Click, hover and tooltip work normally. | 
 +| ''disabled'' | Click and hover highlight are disabled. The tooltip remains available. If ''display-color:'' is set, the zone stays painted. | 
 +| ''invisible'' | Click, hover and tooltip are disabled. | 
 + 
 +A zone may contain several ''if:'' layers. They are evaluated in order and only replace the keys they declare. 
 + 
 +<code yaml> 
 +zones: 
 +  scene: 
 +    colors: 
 +      - color: "#F21010" 
 +        click: find_key 
 +        highlight: true 
 +        if: 
 +          - if: "v_keyfound_v.=.1" 
 +            state: disabled 
 +            display-color: "#777777" 
 +            display-mode: fill 
 +</code> 
 + 
 +A decorative zone may use ''state:'' and ''display-color:'' without a ''click:''. A ''disabled'' or ''invisible'' zone cannot be triggered by a forged click sent to the server. 
 + 
 +===== once: zone / once: zone-room ===== 
 + 
 +When the same mask color contains several separated zones, each component can be triggered individually: 
 + 
 +  * ''once: zone'': each component triggers only once **per game**; 
 +  * ''once: zone-room'': components re-arm every time the player returns to the room.
  
 <code yaml> <code yaml>
 events: events:
   - id: touch_bottle   - id: touch_bottle
-    once: zone+    once: zone-room
     text: "You inspect an empty bottle."     text: "You inspect an empty bottle."
     do: "bottles.+.1"     do: "bottles.+.1"
 </code> </code>
 +
 +===== once: color / once: color-room =====
 +
 +These values group every separate mask area that uses the same color:
 +
 +  * ''once: color'': the first click consumes the whole color for the rest of the game;
 +  * ''once: color-room'': the first click consumes the whole color until the next room visit.
 +
 +<code yaml>
 +events:
 +  - id: touch_bottles
 +    once: color
 +    text: "Every bottle bears the same symbol."
 +</code>
 +
 +Use ''once: zone'' to handle several same-colored objects separately. Use ''once: color'' when one click should disable them together.
 +
 +===== after-click: - marking consumed zones =====
 +
 +On a zone whose click event uses one of the ''zone'' or ''color'' modes, the ''after-click:'' key picks how it is rendered once the interaction is consumed:
 +
 +^ Value ^ Effect ^
 +| ''hide'' | No more hover highlight, inert zone. |
 +| ''fixed'' | Highlight shown permanently (already clicked). |
 +| ''"#RRGGBB"'' | Permanent highlight in that color. |
 +
 +The optional ''after-mode:'' key (''fill'' or ''outline'') changes the highlight type of the mark - for instance outline on hover, but a full fill once the element is found. Ideal for seek-and-find scenes:
 +
 +<code yaml>
 +zones:
 +  scene:
 +    colors:
 +      - color: "#00FFF3"
 +        click: touch_bottle
 +        highlight: true
 +        outline: true
 +        after-click: "#000000"
 +        after-mode: fill
 +</code>
 +
 +With the ''zone'' and ''color'' variants, marks persist when returning to the room. The ''zone-room'' and ''color-room'' variants reset on each visit.
  
 ===== Inside a HUD ===== ===== Inside a HUD =====
Ligne 111: Ligne 185:
   * Use a PNG mask with clean flat colors, no lossy compression.   * Use a PNG mask with clean flat colors, no lossy compression.
   * Avoid colors that are too close to each other in the mask.   * Avoid colors that are too close to each other in the mask.
-  * Keep one zone per color when possible; use ''once: zone'' if one color represents several identical elements.+  * Keep one zone per color when possible; use ''once: zone'' or ''once: zone-room'' if one color represents several identical elements.
   * Keep a classic choice as fallback if navigation depends entirely on point & click.   * Keep a classic choice as fallback if navigation depends entirely on point & click.
  
 See also: [[en:yaml:tooltips|Interactive tooltips]], [[en:yaml:clickable-elements|Clickable elements]], [[en:yaml:hud|HUD panels]]. See also: [[en:yaml:tooltips|Interactive tooltips]], [[en:yaml:clickable-elements|Clickable elements]], [[en:yaml:hud|HUD panels]].
  
en/yaml/imagemaps.1779134393.txt.gz · Dernière modification : de cyrilfiesta