Tillmen
09-17-2010, 03:00 PM
The GameObj class has been updated. To play with it, update to Lich 4.1.63, and download gameobj-data.xml from the repository. And probably do ;updater add gameobj-data.xml
You can now try to find an object with:
obj = GameObj[search_string]
for example
cloak = GameObj['cloak']
echo cloak.contents
If the search string is a number (as a string), it'll try to find a matching object with that id. If it's a one word string, it'll try to find an object with a matching noun. If it's more than one word, it'll first try to find an object with an exactly matching name, and then try to find a match by screwing around with some regex. For example, if you have a "large ugly cloak", but you can't manipulate the item with using "open large ugly cloak" or "open ugly cloak", but only "open large cloak", you probably have a setting saved as "large cloak". The regex match will make the ugly part optional, and still find the cloak.
.type and .sellable methods have been added to GameObj objects. Help fill in the blanks in the GameObj database by doing something like this:
;e (GameObj.inv.to_a + GameObj.loot.to_a).each { |obj| respond "#{obj.name.ljust(40)} #{obj.type.rjust(10)} #{obj.sellable.rjust(10)}"; obj.contents.each { |o| respond "#{o.name.ljust(40)} #{o.type.rjust(10)} #{o.sellable.rjust(10)}" } }
Post any missing or wrong type/sellable info you find.
If gameobj-data.xml has already been loaded and you download an update, or edit it yourself, you can do
;e GameObj.load_data
to force it to reload.
You can now try to find an object with:
obj = GameObj[search_string]
for example
cloak = GameObj['cloak']
echo cloak.contents
If the search string is a number (as a string), it'll try to find a matching object with that id. If it's a one word string, it'll try to find an object with a matching noun. If it's more than one word, it'll first try to find an object with an exactly matching name, and then try to find a match by screwing around with some regex. For example, if you have a "large ugly cloak", but you can't manipulate the item with using "open large ugly cloak" or "open ugly cloak", but only "open large cloak", you probably have a setting saved as "large cloak". The regex match will make the ugly part optional, and still find the cloak.
.type and .sellable methods have been added to GameObj objects. Help fill in the blanks in the GameObj database by doing something like this:
;e (GameObj.inv.to_a + GameObj.loot.to_a).each { |obj| respond "#{obj.name.ljust(40)} #{obj.type.rjust(10)} #{obj.sellable.rjust(10)}"; obj.contents.each { |o| respond "#{o.name.ljust(40)} #{o.type.rjust(10)} #{o.sellable.rjust(10)}" } }
Post any missing or wrong type/sellable info you find.
If gameobj-data.xml has already been loaded and you download an update, or edit it yourself, you can do
;e GameObj.load_data
to force it to reload.