sorry for this - I did not use newer cores and did not read the core-changes.txt, at least not in detail.
Now I have a problem in a lot of scripts:
Old method to find out if an item was renamed (by a GM) in game:
Code: Select all
if (item.name)
print("Item renamed = "+item.name);
else
print("Item uses default = "+item.desc);
endif
09-18-2013 Tomi:
Changed: Item.name now returns itemdesc.Desc without singluar/plural formatting if no name is set and name from tiledata if no itemdesc entry found
Now all my scripts which use the check do no longer work. Great...
Now I am forced to look it up in itemdesc.cfg every time (even in scripts which do not need to access itemdesc.cfg!), by comparison
Code: Select all
var idesc := ReadConfigFile("itemdesc");
if (item.name == idesc[item.objtype].desc)
print("item uses default = "+item.name);
else
print("Item renamed = "+item.name);
endif
Or is there a better way now? In several places an situations I need to know if an item was renamed or not, since renamed items have a special status in the game (quest items, specail items, and so on). Why was this done anyway???
OWHorus
EDIT:
It is even worse...
We have items which use the default name from tiledata.mul, then we have items, which we renamed in itemdesc.cfg (using Desc Entry), and we have manually renamed items, which names where set in game.
An item, which uses its tiledata.mul name has no Desc entry in itemdesc.cfg. So the simple check, which worked in all POL releases since at least 0.92 or so (see first code sample) must now be coded so:
Code: Select all
var idesc := ReadConfigFile("itemdesc");
var tdesc := ReadConfigFile("tiles");
var iname := idesc[item.objtype].desc;
if (iname)
if (item.name == iname)
print("Uses default = "+item.name);
else
print("Name changed = "+item.name);
endif
else
if (item.name == tdesc[item.objtype].desc)
print("Uses default = "+item.name);
else
print("Name chnaged = "+item.name);
endif
endif
I really hope there is a better way, but at the moment I am at a loss...
OWH