Jump to content

Template:Concept: Difference between revisions

From example
Create Concept template for lorebook demo
 
改进模板渲染,添加美观的可视化布局和图标
Line 10: Line 10:
{{#if:{{{placement|}}}|[[Placement::{{{placement}}}]]|}}
{{#if:{{{placement|}}}|[[Placement::{{{placement}}}]]|}}
{{#if:{{{nonrecursable|}}}|[[Non-recursable::{{{nonrecursable}}}]]|}}
{{#if:{{{nonrecursable|}}}|[[Non-recursable::{{{nonrecursable}}}]]|}}
<div class="lorebook-concept" style="border: 1px solid #a2a9b1; border-radius: 4px; padding: 15px; margin: 10px 0; background: #f8f9fa;">
<!-- Header -->
<div style="font-size: 1.2em; font-weight: bold; margin-bottom: 10px; color: #202122; border-bottom: 2px solid #0645ad; padding-bottom: 5px;">
📚 Concept: {{PAGENAME}}
</div>
<!-- World & Parent Info -->
<div style="margin-bottom: 12px; padding: 8px; background: white; border-left: 3px solid #0645ad;">
<strong>🌍 World:</strong> [[{{{world|}}}]]{{#if:{{{parent|}}}| &nbsp;→&nbsp; <strong>Parent:</strong> [[{{{parent}}}]]|}}
</div>
<!-- Trigger Settings -->
<div style="display: inline-block; margin-bottom: 12px; padding: 6px 10px; background: #eaecf0; border-radius: 3px; font-size: 0.9em;">
<strong>⚙️ Trigger:</strong>
<span style="background: {{#switch:{{{mode|conditional}}}|constant=#90EE90|conditional=#87CEEB|disabled=#FFB6C6|#87CEEB}}; padding: 2px 6px; border-radius: 3px; color: #000;">{{#if:{{{mode|}}}|{{{mode}}}|conditional}}</span>
&nbsp;|&nbsp;
<strong>Logic:</strong> <code>{{#if:{{{logic|}}}|{{{logic}}}|ANY}}</code>
{{#if:{{{placement|}}}|&nbsp;|&nbsp; <strong>Placement:</strong> <code>{{{placement}}}</code>|}}
{{#if:{{{nonrecursable|}}}|&nbsp;|&nbsp; <strong>Non-recursable:</strong> {{{nonrecursable}}}|}}
</div>
<!-- Keys Section -->
{{#if:{{{primary|}}}|
<div style="margin-bottom: 10px; padding: 8px; background: #fff3cd; border-left: 3px solid #ffc107;">
<strong>🔑 Primary Keys:</strong> <code style="background: white; padding: 2px 4px; border-radius: 2px;">{{{primary}}}</code>
</div>
|}}
{{#if:{{{secondary|}}}|
<div style="margin-bottom: 10px; padding: 8px; background: #d1ecf1; border-left: 3px solid #17a2b8;">
<strong>🔑 Secondary Keys:</strong> <code style="background: white; padding: 2px 4px; border-radius: 2px;">{{{secondary}}}</code>
</div>
|}}
<!-- PList Content -->
{{#if:{{{plist|}}}|
<div style="margin-bottom: 12px; padding: 10px; background: #e7f3ff; border-left: 4px solid #0645ad; border-radius: 2px;">
<div style="font-weight: bold; margin-bottom: 5px; color: #0645ad;">📝 PList Description:</div>
<div style="font-family: 'Courier New', monospace; background: white; padding: 8px; border-radius: 3px; white-space: pre-wrap;">{{{plist}}}</div>
</div>
|}}
<!-- AliChat Content -->
{{#if:{{{alichat|}}}|
<div style="margin-bottom: 10px; padding: 10px; background: #f0f0ff; border-left: 4px solid #6c63ff; border-radius: 2px;">
<div style="font-weight: bold; margin-bottom: 5px; color: #6c63ff;">💬 Ali:Chat Dialogue:</div>
<div style="font-family: 'Courier New', monospace; background: white; padding: 8px; border-radius: 3px; white-space: pre-wrap; font-size: 0.95em;">{{{alichat}}}</div>
</div>
|}}
</div>
</includeonly><noinclude>
</includeonly><noinclude>
== Concept template ==
== Concept template ==

Revision as of 17:59, 17 October 2025

Concept template

This template stores a lore or environment concept using Semantic MediaWiki properties.

Core parameters

world
Name of the parent world page (required for categorisation).
parent
Optional parent concept (enables recursive triggering).
plist
PList-style description content.
alichat
Optional Ali:Chat style reaction text.
primary / secondary
Comma-separated key lists. Combine with logic to reproduce Lorebook conditions.
logic
ANY (default), AND, or NOT.
mode
constant, conditional (default), or disabled.
placement / nonrecursable
Additional hints controlling injection order and recursion.

Example

{{Concept
 |world=Farlandia
 |parent=Farlandia:Monsters
 |plist=[slime: enemy, slimeball, made of gelatin, bounces to move, annoyance]
 |alichat={{user}}: Slime?
{{char}}: "Oh... Those things." She blushes, remembering their first battle.
 |primary=slime,slimes
 |logic=ANY
 |mode=conditional
 |placement=depth:5
}}