Sign In Register

How can we help you today?

Start a new topic

RT Session requests

Hello. I'm trying to instantiate a character in my RT Script and i wanna to get data about character (hp, speed etc.) from meta Collection which calls "Characters" 

But we can't get access to collections through RT. Though we can send event Request using 

RTSession.newRequest () but there is no "setAttribute" like in Unity api for example. So i try to put scriptData like so:


  

var charDataRequest = RTSession.newRequest().createLogEventRequest()
    .setEventKey("GET_CHARACTER_DATA")
    .setScriptData({"CHAR_TYPE" : _type})

 


In my event script i want to get this data and find character datas like so :

 

var eventData = Spark.getData().scriptData;

var charData = Spark.metaCollection('Characters').findOne({"name" : eventData.CHAR_TYPE});

Spark.setScriptData("SPEED", charData.speed);
Spark.setScriptData("HEALTH", charData.health);
Spark.setScriptData("ATTACK", charData.attack);

 

but Spark.getData().scriptData returns undefine

charDataRequest.send(function(response)
    {
        var sData = response.scriptData; 
        
        RTSession.getLogger().info("char health " + response.scriptData.HEALTH);      
    })

 


in the result in the response i have also undefine;


The question is - what's my problem?)) And how i can put evetAttribute through RTScript ?


Thanks


Login to post a comment