Repository navigation
Expand file tree
/
Copy pathexamples.html
More file actions
226 lines (207 loc) · 14.2 KB
/
Copy pathexamples.html
File metadata and controls
226 lines (207 loc) · 14.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="robots" content="noindex,nofollow">
<title>Examples & Cookbook - CDAL & BSX Hub</title>
<link rel="stylesheet" href="site.css?v=8bf2d178dd">
</head>
<body>
<div class="shell">
<header class="topbar">
<a class="brand" href="index.html">
<span class="brand-mark mark-light"><svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" role="img" aria-labelledby="title">
<title id="title">CDAL: mark</title>
<rect x="4" y="4" width="56" height="56" rx="5.00" fill="#0D1015"/><path fill="#FFFFFF" d="M19.91 41.66Q17.97 41.66 16.52 40.8Q15.07 39.94 14.29 38.36Q13.52 36.78 13.52 34.62Q13.52 32.39 14.32 30.79Q15.11 29.19 16.57 28.3Q18.03 27.42 20.02 27.42Q21.81 27.42 23.13 28.15Q24.44 28.88 25.21 30.21Q25.97 31.54 26.04 33.35H22.87Q22.59 32.02 21.85 31.29Q21.11 30.56 20 30.56Q18.56 30.56 17.74 31.62Q16.92 32.68 16.92 34.62Q16.92 36.47 17.72 37.49Q18.51 38.52 19.91 38.52Q20.89 38.52 21.58 37.91Q22.26 37.3 22.59 36.19H25.77Q25.64 37.87 24.87 39.1Q24.1 40.33 22.82 40.99Q21.54 41.66 19.91 41.66ZM33.34 41.59Q31.73 41.59 30.53 40.73Q29.33 39.87 28.67 38.29Q28.02 36.71 28.02 34.55Q28.02 32.37 28.67 30.79Q29.33 29.21 30.53 28.35Q31.73 27.49 33.34 27.49Q34.32 27.49 35.13 27.91Q35.94 28.34 36.33 29.1H37.14V22.75H40.67V41.25H37.14V39.98H36.33Q35.94 40.72 35.13 41.16Q34.32 41.59 33.34 41.59ZM34.39 38.45Q35.81 38.45 36.59 37.42Q37.38 36.38 37.38 34.53Q37.38 32.68 36.59 31.65Q35.81 30.63 34.39 30.63Q32.99 30.63 32.21 31.66Q31.42 32.7 31.42 34.55Q31.42 36.4 32.21 37.43Q32.99 38.45 34.39 38.45Z"/><rect x="43.94" y="22.75" width="6.54" height="18.49" fill="#D7263D"/>
</svg></span>
<span class="brand-mark mark-dark"><svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" role="img" aria-labelledby="title">
<title id="title">CDAL: mark</title>
<rect x="4" y="4" width="56" height="56" rx="5.00" fill="#F1F2F4"/><path fill="#0D1015" d="M19.91 41.66Q17.97 41.66 16.52 40.8Q15.07 39.94 14.29 38.36Q13.52 36.78 13.52 34.62Q13.52 32.39 14.32 30.79Q15.11 29.19 16.57 28.3Q18.03 27.42 20.02 27.42Q21.81 27.42 23.13 28.15Q24.44 28.88 25.21 30.21Q25.97 31.54 26.04 33.35H22.87Q22.59 32.02 21.85 31.29Q21.11 30.56 20 30.56Q18.56 30.56 17.74 31.62Q16.92 32.68 16.92 34.62Q16.92 36.47 17.72 37.49Q18.51 38.52 19.91 38.52Q20.89 38.52 21.58 37.91Q22.26 37.3 22.59 36.19H25.77Q25.64 37.87 24.87 39.1Q24.1 40.33 22.82 40.99Q21.54 41.66 19.91 41.66ZM33.34 41.59Q31.73 41.59 30.53 40.73Q29.33 39.87 28.67 38.29Q28.02 36.71 28.02 34.55Q28.02 32.37 28.67 30.79Q29.33 29.21 30.53 28.35Q31.73 27.49 33.34 27.49Q34.32 27.49 35.13 27.91Q35.94 28.34 36.33 29.1H37.14V22.75H40.67V41.25H37.14V39.98H36.33Q35.94 40.72 35.13 41.16Q34.32 41.59 33.34 41.59ZM34.39 38.45Q35.81 38.45 36.59 37.42Q37.38 36.38 37.38 34.53Q37.38 32.68 36.59 31.65Q35.81 30.63 34.39 30.63Q32.99 30.63 32.21 31.66Q31.42 32.7 31.42 34.55Q31.42 36.4 32.21 37.43Q32.99 38.45 34.39 38.45Z"/><rect x="43.94" y="22.75" width="6.54" height="18.49" fill="#F04B60"/>
</svg></span>
<span>
<div class="brand-title">CDAL · BSX · BSX Lua</div>
<div class="brand-sub">Runnable recipes and repository examples across BSX Lua, tweaks.json, and C/C++</div>
</span>
</a>
<div class="top-actions">
<span class="pill-stat num">Game <b>2.06.01</b> (<code>1.0.0.3850</code>)</span>
<span class="pill-stat num">CDAL IDs <b>4,799 / 4,799</b></span>
<span class="pill-stat num">Lua API <b>427</b> fn · <b>48</b> ev</span>
<button type="button" id="theme-toggle">Theme</button>
</div>
</header>
<nav class="tabs" aria-label="Primary navigation">
<a href="index.html">Overview</a><a href="docs.html">Docs</a><a href="lua-api.html">Lua API</a><a href="examples.html" aria-current="page">Examples & Cookbook</a><a href="game-builds.html">Game Builds & IDs</a><a href="mods.html">Enrolled Mods</a><span class="spacer"></span><a class="ext-link" href="https://github.com/cdal-dev/CDAL" target="_blank" rel="noopener">GitHub</a><a class="ext-link" href="https://ko-fi.com/ratrider" target="_blank" rel="noopener"><span class="heart">♥</span>Support on Ko-fi</a>
</nav>
<main>
<div class="notice">
<div><strong>Cookbook & Examples:</strong> <strong>37 Cookbook recipes</strong> and <strong>88 repository examples</strong>. Searchable source across Lua, <code>tweaks.json</code>, INI, C, and C++23.</div>
<span class="badge accent">125 Total Entries</span>
</div>
<section class="grid-4">
<div class="card"><div class="kpi-label">Cookbook Recipes</div><div class="kpi-val">37</div><div class="kpi-sub">Multi-file starter scripts to adapt</div></div>
<div class="card"><div class="kpi-label">Safe & Data-Only Lua</div><div class="kpi-val" style="color:var(--ok)">75</div><div class="kpi-sub">3 data-only <code>tweaks.json</code> packs</div></div>
<div class="card"><div class="kpi-label">Changes-Tier Lua</div><div class="kpi-val" style="color:var(--warn)">41</div><div class="kpi-sub">World, camera, toolkit & studio mods</div></div>
<div class="card"><div class="kpi-label">Native C / C++ Plugins</div><div class="kpi-val">9</div><div class="kpi-sub">CDAL ASIs & BSX ABI plugins</div></div>
</section>
<div class="toolbar">
<input type="search" id="ex-search" class="grow" placeholder="Search recipes & examples by name, topic, API call, or code (e.g. mcm, items.search, Hook)...">
<select id="ex-cat" aria-label="Category">
<option value="">All categories (10)</option>
<option value="Cookbook Recipes">Cookbook Recipes</option><option value="Camera, Movement & Flight">Camera, Movement & Flight</option><option value="Items & Inventory">Items & Inventory</option><option value="UI & Overlays">UI & Overlays</option><option value="World, Time & Exploration">World, Time & Exploration</option><option value="Appearance & Outfits">Appearance & Outfits</option><option value="Combat & Stats">Combat & Stats</option><option value="BSX Core & Diagnostics">BSX Core & Diagnostics</option><option value="Data-Only Packs">Data-Only Packs</option><option value="Native C / C++">Native C / C++</option>
</select>
<div class="pill-row">
<button type="button" class="tab-pill" data-exf="all" aria-pressed="true">All (125)</button>
<button type="button" class="tab-pill" data-exf="recipes" aria-pressed="false">Recipes (37)</button>
<button type="button" class="tab-pill" data-exf="safe" aria-pressed="false">Safe Lua</button>
<button type="button" class="tab-pill" data-exf="changes" aria-pressed="false">Changes Lua</button>
<button type="button" class="tab-pill" data-exf="data_only" aria-pressed="false">Data-Only</button>
<button type="button" class="tab-pill" data-exf="native" aria-pressed="false">C / C++</button>
</div>
</div>
<div class="ex-layout">
<aside class="ex-list" id="ex-list" aria-label="Examples list"></aside>
<section class="ex-viewer" id="ex-viewer" aria-live="polite"></section>
</div>
</main>
<footer class="footer">
<div>CDAL 0.8.1 · BSX 0.4.0 · Crimson Desert Address Library & Script Extender · Data updated <time datetime="2026-12-02">2026-12-02</time></div>
<div class="footer-links">
<a href="docs.html">Docs</a>
<a href="https://github.com/cdal-dev/CDAL" target="_blank" rel="noopener">GitHub</a>
<a href="https://github.com/cdal-dev/CDAL/releases" target="_blank" rel="noopener">Releases</a>
<a href="https://discord.gg/Ucyp39ayUX" target="_blank" rel="noopener">Discord</a>
<a href="mods.html">Enroll a mod</a>
</div>
</footer>
</div>
<script src="common.js?v=4680047ca0"></script>
<script src="examples.js?v=23faa7d022"></script>
<script>
(function () {
var LIST = window.CDAL_EXAMPLES || [];
var listEl = document.getElementById("ex-list");
var viewEl = document.getElementById("ex-viewer");
var searchEl = document.getElementById("ex-search");
var catEl = document.getElementById("ex-cat");
var filter = "all", activeId = "", activeFileIdx = 0;
function esc(s) {
return String(s || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
}
function tierBadge(e) {
if (e.tier === "safe") return '<span class="badge ok">Safe Lua</span>';
if (e.tier === "data_only") return '<span class="badge ok">Data-Only</span>';
if (e.tier === "changes") return '<span class="badge warn">Changes</span>';
return '<span class="badge accent">C / C++</span>';
}
function filtered() {
var q = (searchEl.value || "").trim().toLowerCase();
var cat = catEl.value;
return LIST.filter(function (e) {
if (cat && e.category !== cat) return false;
if (filter === "recipes" && !e.featured) return false;
if (filter === "safe" && e.tier !== "safe") return false;
if (filter === "changes" && e.tier !== "changes") return false;
if (filter === "data_only" && e.tier !== "data_only") return false;
if (filter === "native" && e.kind !== "native_cpp") return false;
if (!q) return true;
return e.id.toLowerCase().indexOf(q) !== -1 ||
e.title.toLowerCase().indexOf(q) !== -1 ||
e.category.toLowerCase().indexOf(q) !== -1 ||
e.description.toLowerCase().indexOf(q) !== -1 ||
(e.uses || []).join(" ").toLowerCase().indexOf(q) !== -1 ||
e.files.some(function (f) { return f.code.toLowerCase().indexOf(q) !== -1; });
});
}
function renderViewer(item) {
if (!item) {
viewEl.innerHTML = '<div style="color:var(--muted)">No recipe or example matches your filter.</div>';
return;
}
if (activeFileIdx >= item.files.length) activeFileIdx = 0;
var f = item.files[activeFileIdx] || { name: "(empty)", lang: "txt", code: "" };
var usesHtml = (item.uses || []).map(function (u) { return '<span class="badge">uses: <code>' + esc(u) + '</code></span>'; }).join(" ");
var apiBadge = item.lua_api ? '<span class="badge">Lua API ' + item.lua_api + '</span>' : '<span class="badge">Native ABI</span>';
var recBadge = item.featured ? '<span class="badge accent">Cookbook Recipe</span>' : '';
var fTabs = item.files.map(function (file, i) {
return '<button type="button" class="tab-pill ex-ftab" data-fidx="' + i + '" aria-pressed="' +
(i === activeFileIdx ? "true" : "false") + '">' + esc(file.name) + '</button>';
}).join("");
var hlCode = window.cdalHighlight(f.code, f.lang);
viewEl.innerHTML =
'<div style="display:flex;justify-content:space-between;align-items:flex-start;gap:10px;flex-wrap:wrap">' +
'<div><h2 style="margin:0 0 3px">' + esc(item.title) + '</h2>' +
'<div style="font-size:12px;color:var(--muted)">' + esc(item.category) + ' · <code>' + esc(item.path) + '</code></div></div>' +
'<div style="display:flex;gap:5px;flex-wrap:wrap">' + recBadge + tierBadge(item) + apiBadge + '</div>' +
'</div>' +
'<p style="margin:10px 0 8px;color:var(--muted)">' + esc(item.description) + '</p>' +
(usesHtml ? '<div style="display:flex;gap:5px;flex-wrap:wrap;margin-bottom:8px">' + usesHtml + '</div>' : '') +
'<div class="ex-files">' + fTabs + '</div>' +
'<div class="code-box">' +
'<div class="code-top"><div class="code-top-left"><span class="lang-pill">' + esc(f.lang.toUpperCase()) + '</span><span>' + esc(f.name) + '</span></div>' +
'<button type="button" id="ex-copy">Copy File</button></div>' +
'<pre>' + hlCode + '</pre>' +
'</div>';
viewEl.querySelectorAll(".ex-ftab").forEach(function (b) {
b.addEventListener("click", function () {
activeFileIdx = Number(b.getAttribute("data-fidx")) || 0;
renderViewer(item);
});
});
var copyBtn = document.getElementById("ex-copy");
if (copyBtn) copyBtn.addEventListener("click", function () { window.cdalCopyText(copyBtn, f.code); });
}
function render() {
var rows = filtered();
var current = null;
for (var i = 0; i < rows.length; i++) if (rows[i].id === activeId) { current = rows[i]; break; }
if (!current && rows.length) { current = rows[0]; activeId = current.id; activeFileIdx = 0; }
var html = [];
var lastCat = null;
rows.forEach(function (e) {
if (e.category !== lastCat) {
lastCat = e.category;
html.push('<div class="ex-cat-hdr">' + esc(lastCat) + '</div>');
}
var sub = (e.lua_api ? "API " + e.lua_api : "Native") + " · " + e.files.length + " file" + (e.files.length === 1 ? "" : "s");
html.push('<button type="button" class="ex-item" data-eid="' + esc(e.id) + '" aria-current="' +
(current && current.id === e.id ? "true" : "false") + '">' +
'<div class="ex-item-title"><span>' + esc(e.title) + '</span>' + tierBadge(e) + '</div>' +
'<div class="ex-item-meta">' + sub + ' · ' + esc(e.id) + '</div></button>');
});
listEl.innerHTML = html.join("") || '<div style="padding:10px;color:var(--muted);font-size:12.5px">No matches</div>';
listEl.querySelectorAll(".ex-item").forEach(function (btn) {
btn.addEventListener("click", function () {
activeId = btn.getAttribute("data-eid");
activeFileIdx = 0;
if (history.replaceState) history.replaceState(null, "", "#" + activeId);
render();
});
});
renderViewer(current);
}
function applyHash() {
var h = (window.location.hash || "").replace(/^#/, "");
if (!h) return;
for (var i = 0; i < LIST.length; i++) {
if (LIST[i].id === h) { activeId = h; activeFileIdx = 0; break; }
}
}
document.querySelectorAll("[data-exf]").forEach(function (b) {
b.addEventListener("click", function () {
filter = b.getAttribute("data-exf");
document.querySelectorAll("[data-exf]").forEach(function (o) { o.setAttribute("aria-pressed", o === b ? "true" : "false"); });
render();
});
});
catEl.addEventListener("change", render);
searchEl.addEventListener("input", render);
window.addEventListener("hashchange", function () { applyHash(); render(); });
applyHash();
if (!activeId && LIST.length) activeId = LIST[0].id;
render();
})();
</script>
</body>
</html>