Alright, I'm ironing out the last/latest kinks in a quest-related script (which quest should be obvious), but one part of the code is not working as I expect. Here's the snippet:
Here's the problem:
When fighting a Desktop Globe, the guardians() function returns an item which item_to_string() identifies as NG. However, the if() statement evaluates to false (I verified this by running the script with a print("NG"); after the if(), showing that execution never got into that section.) and so does not change TowerNeed to $item[lowercase n], as it should (since I have none in inventory, but have 5 original Gs).
I suspect either I have screwed something up subtly, or there is a problem somewhere else (just like everyone else whose code fails) ;D Any thoughts?
Code:
<snip 384 lines>
goal TowerItem;
TowerItem.type = "IA";
item TowerNeed;
<snip map definitions>
if(contains_text(OpenLog,"The Final Ultimate Epic Final Conflict")) {
if(!contains_text(OpenLog, "You have defeated the Naughty Sorceress and freed the King!")) {
<snip entryway>
<snip hedge maze>
<snip Nagamar paranioa>
TowerNeed = guardians();
--Begin problem segment
> if(TowerNeed == $item[NG]) {
> if(item_amount($item[lowercase n]) == 0) {
> TowerNeed = $item[lowercase n];
> } else {
> TowerNeed = $item[original G];
> }
> }
--End Problem segment
if(TowerNeed == $item[barbed-wire fence]) {
TowerNeed = $item[white picket fence];
print("Substituting white picket fence. Obtain DoD wand");
wait(5);
}
if(TowerNeed != $item[none]) {
TowerItem.ItemList[TowerNeed] = 1;
TowerItem.area = TowerMap[TowerNeed];
if(TowerItem.area == $location[Guano Junction]) {
if(stench_resistance() < .001) {
TowerItem.BuffList[$effect[Elemental Saucesphere]] = 1;
}
}
return TowerItem;
}
print("Complete Chamber and Defeat Sorceress");
result.type = "X";
return result;
}
}
<snip 600 lines>
Here's the problem:
When fighting a Desktop Globe, the guardians() function returns an item which item_to_string() identifies as NG. However, the if() statement evaluates to false (I verified this by running the script with a print("NG"); after the if(), showing that execution never got into that section.) and so does not change TowerNeed to $item[lowercase n], as it should (since I have none in inventory, but have 5 original Gs).
I suspect either I have screwed something up subtly, or there is a problem somewhere else (just like everyone else whose code fails) ;D Any thoughts?