Looking thru some HJ_ref scripts and functions I found a few, that when used in our game, did not quite work. I am trying to find out why using println() functions.
Here is the code from HJ_ref, server side script name - playerutils (no class for script)
"thisPlayer" is a noderef, it has no class How can it be compared to _PlayerCharacter ?
giving the value of assoc.target does not give it the class
untrusted function receiveRequestForVisibleCharacter(rci as Class RemoteCallClientIn)
var playerName = rci.args["name"]
var playerAssociations = QueryAssociation(me, "AccountCharacterAssociation", 0)
thisPlayer as NodeRef
vc as NodeRef of Class _characterAppearance
foreach assoc in playerAssociations
thisPlayer = assoc.target
if thisPlayer <> None
where thisPlayer is kindof _PlayerCharacter
if thisPlayer.name == playerName
vc = getMyVisibleCharacter(thisPlayer)
break
.
.
.
.
if vc != None
data as List of String
add back "CharacterSelection" to data
add back playerName to data
if $NPC._IsValidCharacterSpecification( vc._characterSpecification )
fqn as String = $REPOSITORY._GetCharacterSpecificationPath( vc._characterSpecification ) + vc._characterSpecification + ".dat"
add back fqn to data
where thisPlayer is kindof HJcharacter_class
add back thisPlayer.portraitFQN to data
.
SendCharacterOutfitToPlayer(me, vc, data)
else
refuseCharacterOutfitRequest(me, playerName)
.
.
.
I changed a few things to make it simpler (did that mess it up?)
I tried to print out any classes that might be put on thisPlayer from giving it the value of assoc.target - none show
I commented out the portrait part, not having added it yet.
This is the error I get when it runs, the node ID is "thisPlayer". It errors when trying to get any classes, commenting out this check, It stops when checking to "is kind of _PlayerCharacter", and exits.
[hsl_error] 1,1: [Character Selection] SCRIPT ERROR: In function GetClassesOnNode: GOM::describeNode (11112): requested node ID (9223372112935021695) not found
untrusted function receiveRequestForVisibleCharacter(name as String)
println("got call for "+name)
var playerName = name
var playerAssociations = QueryAssociation(me, "AccountCharacterAssociation", 0)
thisPlayer as NodeRef
vc as NodeRef of Class _characterAppearance
foreach assoc in playerAssociations
thisPlayer = assoc.target
println("thisPlayer "+thisPlayer+" account "+account) // show some info
class_list as List of String = GetClassesOnNode(thisPlayer)
foreach val in class_list
println("class found "+val)
.
if thisPlayer <> None
where thisPlayer is kindof _PlayerCharacter
println("thisPlayer name "+thisPlayer.name+" name "+playerName)
if thisPlayer.name == playerName
vc = thisPlayer.GetMyVisibleCharacter()
println("got vc "+vc)
break
.
.
.
.
if vc != None
println("starting to add data "+vc)
data as List of String
add back "CharacterSelection" to data
add back playerName to data
if $NPC._IsValidCharacterSpecification( vc._characterSpecification )
fqn as String = $REPOSITORY._GetCharacterSpecificationPath( vc._characterSpecification ) + vc._characterSpecification + ".dat"
add back fqn to data
// where thisPlayer is kindof E_playerCharacter
// add back thisPlayer.portraitFQN to data
// .
SendCharacterOutfitToPlayer(account, vc, data)
else
println("not good oufit for "+playerName)
// refuseCharacterOutfitRequest(me, playerName)
.
.
.
How it works in HJ_ref, I don't know, when it looks like it should not.