GArrow,
The GetStat() and GetStatAttr() functions (@lines: 902 & 908) in your impcharsheet.gcs are flawed. Since object handling in VBScript is something of a bolt on, you can't easily return multiple types from a function, since Objects require the special
set LVALUE = RVALUE syntax, while everything else uses the standard assignment
LVALUE = RVALUE syntax. This is a problem when you have a return type that can be either a standard Variant or an Object and you don't know in advance what that type will be, so you can chose the appropriate assignment syntax. Essentially, it's a chicken and the egg problem. The way they are coded in the copy of the sheet that I retrieved from the repository, they fail fatally under normal usage.
Since you only call GetStat() from GetStatAttr(), my advice would be to modify them both as follows. I've included two functionally equivalent variations, both of which require no other changes to the sheet, for your perusal.
Version A: GetStatByRef as a Subroutine
Code:
sub GetStatByRef (byref stat, name)
dim index : index = char.ItemPositionByNameAndExt(name, Stats)
if index > 0 then set stat = char.Items(index)
end sub
function GetStatAttr (name, attr)
GetStatAttr = ""
dim stat : GetStatByRef stat, name
if IsObject(stat) then GetStatAttr = stat.TagItem(attr)
end function
Version B:GetStatByRef as a Function
Code:
function GetStatByRef (byref stat, name)
GetStatByRef = false
dim index : index = char.ItemPositionByNameAndExt(name, Stats)
if index > 0 then
set stat = char.Items(index)
GetStatByRef = true
end if
end function
function GetStatAttr (name, attr)
GetStatAttr = ""
dim stat
if GetStatByRef(stat, name) then GetStatAttr = stat.TagItem(attr)
end function
Cheers!