Does letoscript implement perl's
nextand
last, or any analog to NWScript's
continueand
breakstatements?
In other words, if I have something like
%mod = 'C:\\Program Files (x86)\\games\\NeverwinterNights\\NWN\\modules\\MyMod.mod';
# creature skin/hide item
$BASE_ITEM_CREATUREITEM = 73;
# hunt through items
$founditem = False;
$numchecked = 0; # for debugging
for (%mod['*.uti']) {
$numchecked++;
($numchecked>5) and last;
$BaseItemType = /~/BaseItem;
if ($BaseItemType == $BASE_ITEM_CREATUREITEM) {
print "/~/LocalizedName is a creature skin\\n";
}
}In that code, the
($numchecked>$MAXCHECK) and last;line should be checking the count and exiting the loop after the first five items are done. But I am doing something wrong, because I am getting no errors, but the loop runs through every (custom) item in the mod.
(I should be clear that I know there are other ways to do just a certain number of iterations of the above loop. I want to know if letoscript has a way to break out of a loop, as there is in most languages.)
Modifié par MrZork, 03 octobre 2012 - 10:30 .





Retour en haut







