question

Dmitrii Osipov avatar image
Dmitrii Osipov asked

CloudScript level entity api and limits

1) is there a way to use Entity api via cloud script?

2) Is it righ that "Total title level entity files" limit means summ of all entity file sizes including Title Entity File, all Group Entity Files, all Player Entity Files, all Master Player Entity Files, all Character Entity Files?

Thanx

CloudScriptlimits
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
pfnathan avatar image
pfnathan answered

1. Yes, there's an entity.x (e.g entity.AddMember) variable available that exposes entity APIs in CloudScript

2. Can you provide with more context around this please, I'm not quite understnad the question.

6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dmitrii Osipov avatar image Dmitrii Osipov commented ·

thans, about file limits, i mean that 1gb limits is a limit for all entity files across entire title, incuding groups and players. i think that's it.

0 Likes 0 ·
brendan avatar image brendan Dmitrii Osipov commented ·

That's correct - it's an aggregate limit for the title as a whole. If you need a higher limit for your title, we can work with you on pricing for that, as part of a Pro or Enterprise tier contract.

0 Likes 0 ·
Dmitrii Osipov avatar image Dmitrii Osipov brendan commented ·

so okay, i've tried to get/set objects of characters but get errors that this is not allowed with policy. Where can i get documentation about policies or how can i allow cloudscript to do anything with any character entities (e.g. profile, master and character)?

0 Likes 0 ·
Show more comments
Dmitrii Osipov avatar image Dmitrii Osipov commented ·

Title id is 9EC4.

0 Likes 0 ·
pfnathan avatar image pfnathan ♦ Dmitrii Osipov commented ·

On the Title 9EC4, we have found the 2 major issues:

1: You are using "entity" as an argument name, but "entity" is reserved as our code's way of referencing the Entity APIs. Our engineer had changed all the argument names to "e" for those.

2. You were attempting to log in as (impersonate) each entity via._getEntity This is not allowed and is also not needed. Any setup on our side that is required will be done when you do entity.GetObjects or entity.SetObjects for the first time against that entity. We have changed _getEntity to just generate a valid entity key object.

Please take a look at the code we have changed in ClouScript. we have edited CloudScript so that "entity" parts to work.

function _getEntity(id,type){
    return {Id:id,Type:type};        
}
function _getObject(e,name){
    var objs=entity.GetObjects({Entity:e}).Objects;
    if(objs.hasOwnProperty(name))return objs[name];
    return null;
}
function _setObject(e,name,obj){
    return entity.SetObjects({Entity:e,Objects:[{ObjectName:name,DataObject:obj}]})
}
function _ensureObject(e,name,def){
    var o=_getObject(e,name);
    if(o!=null)return o;
    _setObject(e,name,def);
    return def;
}
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.