dinrogue
23-06-2007, 06:20 AM
For a mod, I'm trying to gather all ranks of a certain poison and add their counts together. Instead of creating anywhere from 2-7 name variables depending on the poison, I was wondering if I could create one and test this way. For instance:
RR_ITEM_CRIPPLING="Crippling Poison";
--Assume the code is looping through the bags, and this condition is checked every slot and name is the name of the item being checked.
if(name>=RR_ITEM_CRIPPLING) then
--Update count
end
I'm fairly sure this would detect all ranks of crippling poison because rank I would be equal to the variable and rank 2 would be greater than, same goes for all poisons. But I was thinking would it be possible that a certain item would turn up as greater than that because of it's alphabetical value. I'm not sure how Lua compares strings, but in Java some strings would return greater than if they use letters later in the alphabet. Sorry if this is confusing.
RR_ITEM_CRIPPLING="Crippling Poison";
--Assume the code is looping through the bags, and this condition is checked every slot and name is the name of the item being checked.
if(name>=RR_ITEM_CRIPPLING) then
--Update count
end
I'm fairly sure this would detect all ranks of crippling poison because rank I would be equal to the variable and rank 2 would be greater than, same goes for all poisons. But I was thinking would it be possible that a certain item would turn up as greater than that because of it's alphabetical value. I'm not sure how Lua compares strings, but in Java some strings would return greater than if they use letters later in the alphabet. Sorry if this is confusing.