Here's my testing on this:
When I use the iteminfo command on an item that has a use script defined in its itemdesc file I don't see one displayed from the "Item" section on the "Script" line. If, however, I assign a use script (item.UseScript := "some_use_script") and then use iteminfo I do see a script name in the item section. Equip scripts are readable. This only seems to be a problem with the "script" member of an item. This isn't just an issue with the iteminfo command. I tried printing the UseScript member from an item prior to assigning one and I get nothing. If I print the errortext I get the "object does not support members" error. I get the same error even if I "manually" assign a UseScript to the item but I can still read the UseScript that I assigned it.
I should note that the item to which I have assigned a different UseScript does in fact use the newly assigned script. I tested it on a viking sword which normally creates kindling when used on a tree. I changed its UseScript to :lumberjacking:lumberjack and it produced logs in my backpack rather than kindling.
As I said this seems rather peculiar. I'm thinking it's a bug.
Here is the test script that I used:
Code: Select all
use uo;
program usescript_test(who, textline)
var item := target(who, TGTOPT_NOCHECK_LOS);
// Try this with a blank textline first on an item.
// Then add a script as the textline to see the difference.
if (textline)
item.UseScript := textline;
endif
SendSysMessage (who, "The UseScript is " + item.UseScript, color := 88);
SendSysMessage (who, "The UseScript is " + item.UseScript.errortext, color := 88);
endprogram