Sign In Register

How can we help you today?

Start a new topic
Answered

RTScript and scriptData

I saw i can do a LogEventRequest in RT Script. The problem is that, i need to retrieve a specific value from the response but i don't know how i can do this. 


In my scenario i take from Server the damage of a specific skill. I need this for avoid cheating (that's why i don't store on client side). 


For example:

  1. Player1 sends skill collision
  2. Server checks that Player1 is telling the truth
  3. Server goes on DB and retrieve the skill damage
  4. Server sends packet to all for apply damage to Player2



RTSession.newRequest().createLogEventRequest()

        .setEventKey("GET_ACTIVE_SKILLS")

        .setScriptData({ "playerID" : player1ID })

        .send(function(response){

            var resp = response.scriptData;

          //How can i get for example resp.GetInt("skill1")?

 });


Best Answer

Hi Francesco,


The response returned to your rt script is a simple js object, so you should be able to obtain any required fields and sub-fields using dot notation. For example:


var skill = response.scriptData.skill1;


Regards,

Vinnie

1 Comment

Answer

Hi Francesco,


The response returned to your rt script is a simple js object, so you should be able to obtain any required fields and sub-fields using dot notation. For example:


var skill = response.scriptData.skill1;


Regards,

Vinnie

Login to post a comment