setting _os_skin from smartfoxserver for an NPC

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

HilarioGo
Posts: 7
Joined: 11 May 2012, 16:53

setting _os_skin from smartfoxserver for an NPC

Postby HilarioGo » 05 Jul 2012, 21:07

I have been trying to set the _os_skin user variable as a JSON object decoded to a string from my custom openSpace extension but I've had having no luck getting it to work, is there an example anywhere of what the decoded JSON string should look like I haven't been able to locate anything online.

Thanks for any help!
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: setting _os_skin from smartfoxserver for an NPC

Postby Bax » 10 Jul 2012, 08:13

With OpenSpace for SFS Pro that user variable is a simple JSON string built using this method:

Code: Select all

JSON.encode(skin)

where skin is a plain object, for example:

Code: Select all

var skin:Object = {}
skin.sex = isMale ? "m" : "f"
skin.hair = "hair1"
Paolo Bax
The SmartFoxServer Team
HilarioGo
Posts: 7
Joined: 11 May 2012, 16:53

Re: setting _os_skin from smartfoxserver for an NPC

Postby HilarioGo » 11 Jul 2012, 18:09

Thanks for the reply Bax, I realized that I had been looking at the wrong documentation when trying to pass the skin in as JSON ( the SFS Pro documentation instead of the SFS 2X documentaiton ), I changed the _os_skin from a JSON string to a SFSObject in my server code and it worked!

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 16 guests