Hi, so I made a custom function that is supposed to create an npc score for relationships and I am using the npclib library. Here is the code:
d = NewStringDictionary()
dictionary add (d, "nscore", nscore)
object.parent = npc
npc.parent = obj
set (npc, "score", 10)
set (npc, "maxscore", 20)
nscore = npc.score + "/" + npc.maxscore
The parameters are ser to npc, obj, object and nscore. but when I run it, I get this error:
Error running script: Too few parameters passed to NpcScore function - only 2 passed, but 4 expected
Can anyone help me fix this?
:)
How many threads are going on? I was confused for a second. :)
I just replied to that question in this thread: Error with custom function
Hello, yes those are the parameters, but when I put all of those parameters in, it raises this error:
Error running script: Too few parameters passed to NpcScore function - only 2 passed, but 4 expected
So I tried to fix it by removing parameters but it raised the other error
The main problem with this function is that it's hard to tell what the function is supposed to do.
I've looked at both the code for the function, and the code where you use the function, and I really can't understand what you want it to do.
The code you posted here can be reduced to:
object.parent = npc
npc.parent = obj
set (npc, "score", 10)
set (npc, "maxscore", 20)
(the other lines don't do anything)
So… this code looks at 3 objects:
npc
object
obj
It gives the object to the NPC, then moves the NPC into the room.
It also sets the NPC's score
to 10, and the NPC's maxscore
to 20.
If this is what the function is supposed to do, you need to work out which object is object
, and which room is obj
.
If this isn't what the function is supposed to do, can you try to explain what you want it to do? Then maybe we can help you to write that.