Hello,
(using DBP, forgot to put it in the title)
I am trying to write a function that lets me pass the name of an array of user-defined objects, but I can't figure out how to pass the name of the array to the function properly. Here is the code, followed by the error message:
`print the elements of each object in the array
function PrintInv(sTemp$, nCount)
for n = 0 to nCount
Print sTemp$(n).sName$ + " ";
Print Str$(plOneInv(n).nWeight) + " ";
if sTemp$(n).nType = 1 then Print "Weapon ";
if sTemp$(n).nType = 2 then Print "Armor ";
if sTemp$(n).nType = 3 then Print "Potion ";
if sTemp$(n).nType = 4 then Print "Hat ";
if sTemp$(n).nType = 5 then Print "Shield ";
if sTemp$(n).nType = 6 then Print "Wand ";
Print Str$(sTemp$(n).nDamage) + " ";
Print Str$(sTemp$(n).fRange#) + " ";
Print Str$(sTemp$(n).nStackable) + " ";
Print Str$(sTemp$(n).nStackSz) + " ";
Print Str$(sTemp$(n).nValue) + " ";
Print sTemp$(n).sEffect$
next n
sync
endfunction
and here is the error message:
Error at line 87:
Print sTemp$(n).sName$ + " ";
PARSER ERROR
------------
Variable '&sTemp$' does not exist at line 87.
PROGRAM TRACE
-------------
sTemp$(n).sName$ + " ";
Print Str$(plOneInv(n).nWeight) + "
ERROR TRACE
-----------
Failed to 'Calculate DataOffsetAndTypeFromFieldString'
PARSER ERROR
------------
Could not determine parameter type of 'sTemp$(n).sName$' at line 87.
PROGRAM TRACE
-------------
sTemp$(n).sName$ + " ";
Print Str$(plOneInv(n).nWeight) + "
ERROR TRACE
-----------
Failed to 'DoExpressionList::DoExpressionListString'
Failed to 'DoInstruction::Do ExpressionList'
Failed to 'DoStatement(TokenID)'
Failed to 'pLoopBlock->DoBlock()'
Failed to 'DoStatement(TokenID)'
Failed to 'DoUserFunction::DoBlock'
Failed to 'DoStatement(TokenID)'
Failed to 'DoBlock(0)'
Failed to 'MakeStatements'
Failed to Parse Program (MakeDBM->MakeProgram)'
Thanks in advance for any help!
-Matt