#RPG Shop.....

1 messages · Page 1 of 1 (latest)

sly stump
#

Shop not getting slider value?

#
if (selection === 0) {
const form = new ModalFormData();
form.title("diamond_block");
form.slider("Slider", 0, 64, 1, 0);

form.show(player).then(res => {
if (res.canceled || res.formValues.length === 0) return;

const sliderValue = Number(res.formValues[0]);
if (isNaN(sliderValue)) return;

console.log("Slider number: " + sliderValue);  // デバッグ用

// 計算処理
let scoreChange = Math.floor(sliderValue * 500);
if (sliderValue <= 1 || scoreChange <= 0) {
player.runCommand(`scoreboard players add @s eme -500`);
player.runCommand(`give @s iron_block ${sliderValue}`);
} else {
player.runCommand(`scoreboard players add @s eme ${scoreChange}`);
player.runCommand(`give @s iron_block ${sliderValue}`);
}

player.runCommand(`tellraw @s ${JSON.stringify({ "rawtext": [{ "text": "§l" }, { "text": "<shop> 。。。。。" }] })}`);
});
}
#

What the...? An error...?

runic ice
sly stump
#

yes

runic ice
#

It’s a question

sly stump
#

1 item x 500g [1x]

32 items x 500g [32x]

64 items x 500g [64x]

Items = Money....

runic ice
#

that's not what i asked