Storing map, inventory and library in database

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

Moderators: Lapo, Bax

User avatar
zoomandenhance
Posts: 13
Joined: 11 May 2010, 01:59

Storing map, inventory and library in database

Postby zoomandenhance » 18 Jun 2010, 05:26

Hi,

I'm attempting to do as above, my workflow is as below (based on CustomOSExtension example):

1. Check if user has map data already (stored in database)
2. If not, load map data from .map template created in editor
3. Load inventory and library data from .inv and .lib templates
4. Save map, inventory and library data to database
5. Create room and set _os_mapId room variable
6. sendAvatarToMap

The issue I am having occurs at point 6. I have overridden the relevant methods of the OS Java extension, i.e. loadMapData, saveMapData, isMapUpToDate, loadInventoryData, isInventoryUpToDate, loadLibraryData, isLibraryUpToDate.

A java exception is being thrown -- LoadMapException -- as a library id cannot be retrieved for my map.

Is there some additional room variable I need to set to have OS recognise a library (and inventory) id?

I've read through documentation and searched forum posts but cannot find any reference as yet.

Any help would be appreciated.

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

Postby Bax » 18 Jun 2010, 07:16

Can you please report the full stack trace of the error?
Paolo Bax
The SmartFoxServer Team
User avatar
zoomandenhance
Posts: 13
Joined: 11 May 2010, 01:59

Postby zoomandenhance » 18 Jun 2010, 07:22

Sure, here it is here -- note, I have taken the trace from one line before the exception was thrown up until the point I stopped the server:

Code: Select all

17:46:11.865 - [ INFO ] > [OpenSpace] Room 'park_100000219290349' [2] joined; no
w loading associated map '100000219290349
CustomOSExtension: the following exception occurred:
com.smartfoxserver.openspace.exceptions.LoadMapException: Unable to retrieve lib
rary id for map '100000219290349'
        at com.smartfoxserver.openspace.commands.LoadMapCommand.loadMap(LoadMapC
ommand.java:140)
        at com.smartfoxserver.openspace.commands.LoadMapCommand.execute(LoadMapC
ommand.java:104)
        at com.smartfoxserver.openspace.OpenSpaceExtension.sendAvatarToMap(OpenS
paceExtension.java:368)
        at com.parklifegame.ParkLifeOpenSpaceExtension.sendToHome(ParkLifeOpenSp
aceExtension.java:280)
        at com.parklifegame.ParkLifeOpenSpaceExtension._handleRequest(ParkLifeOp
enSpaceExtension.java:100)
        at com.smartfoxserver.openspace.OpenSpaceExtension.handleRequest(OpenSpa
ceExtension.java:202)
        at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.processEve
nt(ExtensionHandler.java:500)
        at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.run(Extens
ionHandler.java:344)
        at java.lang.Thread.run(Thread.java:619)
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 18 Jun 2010, 07:26

The problem is that the map id doesn't contain the library id as a prefix. The id of the map should be something like this: myProjectId#100000219290349
Paolo Bax
The SmartFoxServer Team
User avatar
zoomandenhance
Posts: 13
Joined: 11 May 2010, 01:59

Postby zoomandenhance » 18 Jun 2010, 07:35

Ah, I see...

So, that prefix value will be passed to the loadInventoryData and loadLibraryData methods as the id parameter?
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 18 Jun 2010, 09:20

Exactly.
Paolo Bax
The SmartFoxServer Team
PeredereevBoris
Posts: 16
Joined: 09 Aug 2010, 13:49

Map name must be less then 20 characters

Postby PeredereevBoris » 10 Dec 2010, 08:57

I have also problem with this mechanic and want to say that name of map can't be more then 20 symbols, if it more the Smart Fox truncate it.
Last edited by PeredereevBoris on 10 Dec 2010, 08:59, edited 1 time in total.
PeredereevBoris
Posts: 16
Joined: 09 Aug 2010, 13:49

Postby PeredereevBoris » 10 Dec 2010, 08:58

Zone name should be short
PeredereevBoris
Posts: 16
Joined: 09 Aug 2010, 13:49

Postby PeredereevBoris » 10 Dec 2010, 13:24

FInd unsver the length of zone name could be fixed by using <MaxRoomNamesLen> inside Zone definition. It works :)

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 11 guests