ID:1815270
 
(See the best response by Ter13.)
Code:
usr.dp += 1
Opponent.dp -= 1
world.SetScores("[usr.key]","DP"=usr.dp)
world.SetScores("[Opponent.key]","DP"=Opponent.dp)


Problem description:
I recently took over a game for a friend of mine. Trying to familiarize myself with everything and I'm adding a new function to the game that uses the hub scores.

We already have entries on the hub but I'm adding a new field for this feature.

I'm getting this error though and it's pointing to the 1st world.SetScores line.

runtime error: illegal use of list2args() or named parameters

Am I using the wrong syntax here?

I'm trying to increase the DP score on the hub for the User of the command and reduce the score of their opponent by 1.
Best response
Check out the reference: It's got a good example for you to follow:

http://www.byond.com/docs/ref/info.html#/world/proc/ SetScores

You need to create a paramstring using list2params.

Optionally, you could use the paramstring format by yourself:

Check out the reference on list2params:

http://www.byond.com/docs/ref/info.html#/proc/list2params

world.SetScores("[usr.key]","DP=[usr.dp]")
world.SetScores("[Opponent.key","DP=[Opponent.dp]")


Don't overlook the DM reference. It's where I learned about 3/4ths the stuff I know about DM. It really is your most useful resource. Any time something starts to go wrong with a function you are using, take a look at the reference and give it a good read/think. It'll give you a leg up on the problem the majority of the time.

Cheers!