所以我在执行此过程时遇到了问题。它通过删除材料并创建一个新项目“HBlade”来正常运行,但最后,它没有将argOutMessage设置为“已成功完成。已经伪造了HBlade”。相反,outmessage写作“Aborted:Need 1 Cblade”,这是该命令开始时的测试之一。
有关为何可能发生这种情况的任何想法?我在某处遗漏了一些语法吗?令我感到困惑的是 - 我希望成功完成以正确的OutMessage结束,并且在完成时不要重新启动命令。
提前致谢。
WHEN 'HBLADE' THEN
BEGIN
SELECT `Amount` INTO prAC FROM `funds` WHERE `CharacterID` = argCharID;
IF prAC < 20
THEN
BEGIN
set argOutMessage = 'Aborted: not enough AC.';
leave main_block;
END;
END IF;
SELECT `Contribution` INTO prContribution FROM `character` WHERE `CharacterID` = argCharID;
IF prContribution < 50
THEN
BEGIN
set argOutMessage = 'Aborted: not enough contribution.';
leave main_block;
END;
END IF;
IF ((SELECT COUNT(*) FROM `item` WHERE `CharID` = argCharID AND `Name` = 'CBlade') != 1) THEN
BEGIN
SET argOutMessage = "Aborted: need 1 CBlade";
leave main_block;
END;
END IF;
IF ((SELECT COUNT(*)
FROM `item`
WHERE `CharID` = argCharID AND `Name` IN ('LBlade', 'DExe')
) <> 1)
THEN
SET argOutMessage = 'Aborted: need 1 LBlade or DExe';
leave main_block;
END IF;
UPDATE `funds`
SET `Amount` = `Amount` - 20
WHERE `CharacterID` = argCharID;
UPDATE `character`
SET `Contribution` = `Contribution` - 50
WHERE `CharacterID` = argCharID;
DELETE FROM `item` WHERE `CharID` = argCharID AND `Name` IN ('CBlade', 'LBlade', 'DExe');
SET prID1 = FLOOR(-30000+60000*RAND());
SET prID2 = FLOOR(-30000+60000*RAND());
SET prID3 = FLOOR(-30000+60000*RAND());
INSERT INTO `item`(`CharID`, `Name`, `ItemID`, `Count`, `Type`, `ID1`, `ID2`, `ID3`, `Color`, `Effect1`, `Effect2`, `Effect3`, `LifeSpan`, `Attribute`, `Equip`, `X`, `Y`)
VALUES (argCharID, 'HBlade', 1419, 1, 2, prID1, prID2, prID3, 9, 0, 0, 0, 15000, 0, 0, 0, 0);
SET argOutMessage = "Completed successfully. HBlade has been forged.";
leave main_block;
END;