Skip to content

Commit 99633cf

Browse files
committed
imbeggingu
1 parent b80f4c8 commit 99633cf

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

script.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ function populateServantDropdown(servantDataArray) {
7373
// Add each Servant to the dropdown
7474
servantDataArray.forEach(servant => {
7575
const option = document.createElement("option");
76-
option.value = servant.id; // Use Servant ID
77-
option.textContent = servant.name; // Set name to text content
78-
option.dataset.name = servant.name; // Store name in dataset
76+
// Extract a shortname; if you have a better key, replace servant.name here
77+
const shortName = servant.name.split(" ")[0]; // crude fallback: take first word like "Artoria"
78+
option.value = shortName; // store shortname for simulator matching
79+
option.textContent = servant.name; // full display name for user
80+
option.dataset.id = servant.id; // store numeric ID if needed later
7981
dropdown.appendChild(option); // <-- fix here
8082
});
8183
});
@@ -176,8 +178,9 @@ function saveParticipantsAndStartSimulation() {
176178
const selectedOption = servantDropdown.options[selectedIndex];
177179

178180
if (selectedOption) {
179-
servantId = selectedOption.value || "Unknown";
180-
servantName = selectedOption.textContent || "Unknown";
181+
servantId = selectedOption.dataset.id || "Unknown"; // numeric ID if needed
182+
servantName = selectedOption.value || "Unknown"; // shortname the simulator expects
183+
181184

182185
console.log(`Team ${index + 1} - Selected Servant: id=${servantId}, name=${servantName}`);
183186
} else {

0 commit comments

Comments
 (0)