Can't remove MMOItem variable

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
AiryKai
Posts: 14
Joined: 01 Apr 2015, 08:02

Can't remove MMOItem variable

Post by AiryKai »

Hello!

I'm trying to completely remove a variable from an MMOItem on the server side.

In the documentation, I see this:

Removing Variables: in order to remove one or more existing variables you will need to set those variables to NULL, using the SFSUserVariable.setNull() method;


When I try to do this, the variable becomes null, but the key is not completely removed from the MMOItem.

What should I do to completely remove the variable key from MMOItem?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Can't remove MMOItem variable

Post by Lapo »

Hello,
this is not supported, neither for BuddyVars or ItemVars (it is in UserVars and RoomVars).
Typically these vars are not dynamic (or, at least this is how they were conceived), in the sense that Items on map have a fixed number of properties that are updated during gameplay but they normally don't get removed. Like a database record, where fields get updated but not removed.

Isn't setting the ItemVar to an empty/null value not enough for your use case?

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
AiryKai
Posts: 14
Joined: 01 Apr 2015, 08:02

Re: Can't remove MMOItem variable

Post by AiryKai »

Lapo wrote:Isn't setting the ItemVar to an empty/null value not enough for your use case?


That's what I'm doing now to solve this issue.

It's a bit odd that I can add a new variable at any time, but can't delete it.

Thank you. Now I understand how it works.
Post Reply