Thread Rating:
  • 6 Votes - 3.83 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Official API Interface for 3rd party scripts/simulate tools
Author Message
rhiordd Offline
Producer
*******

Posts: 2,997
Joined: Dec 2011
Post: #1
Official API Interface for 3rd party scripts/simulate tools
Commanders,

We really appreciate the engagement of our users in creating scripts and tools for our games and want to support you guys further. We know there were often issues with simulator scripts after we deployed updates to our servers and we therefor prepared a special API code for you, to use for simulation tools.
We provide you with this code to exactly show you, what to use and what we want you to use as basis for simulation scripts. Please note that we won’t support scripts using other interfaces/code.

The Interface can get called once in 10 seconds (calculated p. player). That’s usually more than enough then it’s hard to imagine a combat is done after already 10 seconds, but not enough to support an "optimizer" tool. In addition does it keep the server load in a reasonable frame.

The code is:
Quote:var ownCity = ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentOwnCity();
var city = ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentCity();
ownCity.get_CityArmyFormationsManager().set_CurrentTargetBaseId(city.get_Id());
ClientLib.Data.MainData.GetInstance().get_Combat().Clear();
city.SimulateBattle();
ClientLib.Data.MainData.GetInstance().get_Combat().set_Id(city.get_Id());
var app = qx.core.Init.getApplication();
app.getPlayArea().setView(webfrontend.gui.PlayArea.PlayArea.modes.EMode_CombatAt​tacker, city.get_Id(), 0, 0);

UPDATE 08/16/2012

We adjusted the API for the Combat Simulator according to community requests to help resolve some of its issues:
  • Desync messages
  • Being able to simulate
    - Without enough command points for the attack
    - While defender is in “Post Combat Block”
    - While attacker is already attacking
    - While attacker is in recovery
The changes have been deployed to the closed beta worlds and to World 36. Their roll-out to all other worlds is scheduled for Tuesday 21st.
These changes will only become effective once the tool has been adjusted to the following new API.
Code:
var city = ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentCity();
var ownCity = ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentOwnCity();
ownCity.get_CityArmyFormationsManager().set_CurrentTargetBaseId(city.get_Id());
ClientLib.Vis.VisMain.GetInstance().get_Battleground().SimulateBattle();
var app = qx.core.Init.getApplication();
app.getPlayArea().setView(webfrontend.gui.PlayArea.PlayArea.modes.EMode_CombatRe​play, city.get_Id(), 0, 0);
Thanks,
Rhiordd

01-08-2012 11:27 AM
 Search   Quote 
Petrecristi Offline
Junior Member
**

Posts: 18
Joined: May 2012
Post: #2
RE: Official API Interface for 3rd party scripts/simulate tools
Why you give us theat if you stop it next day?
Give us new data.
01-08-2012 06:16 PM
 Search   Quote 
PEEU Offline
Junior Member
**

Posts: 35
Joined: Feb 2012
Post: #3
RE: Official API Interface for 3rd party scripts/simulate tools
Hi!
My scripts does not load now. What did happen?
How can I enable scripts now?
MrHIDEn

Edit1: OK, I have found out.
Loader needs to be updated.
But some code has been again obfuscated.

Edit2: This was not about Simulator obfuscation. It was about other 3rd parity tools.
(This post was last modified: 22-08-2012 12:48 AM by PEEU.)
01-08-2012 08:05 PM
 Search   Quote 
Petrecristi Offline
Junior Member
**

Posts: 18
Joined: May 2012
Post: #4
[split] Performance Hotfix on selected Worlds today!
edit
(This post was last modified: 06-08-2012 03:28 PM by rhiordd.)
03-08-2012 04:46 PM
 Search   Quote 
MLM-NL Offline
C&C:TA Community Moderator (EN, NL)
*****

Posts: 799
Joined: Feb 2012
Post: #5
RE: Performance Hotfix on selected Worlds today!
FYI, there is a new API just for CombatSim. Developers wouldn't have added that if they wanted to bring it down, I think.

Next time, please do some research before you make these kinds of posts. Closing thread.
03-08-2012 05:57 PM
 Search   Quote 
zimpatou Offline
Junior Member
**

Posts: 8
Joined: Jan 2012
Post: #6
RE: Official API Interface for 3rd party scripts/simulate tools
(01-08-2012 11:27 AM)rhiordd Wrote:  The code is:
Quote:var ownCity = ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentOwnCity();
var city = ClientLib.Data.MainData.GetInstance().get_Cities().get_CurrentCity();
ownCity.get_CityArmyFormationsManager().set_CurrentTargetBaseId(city.get_Id());
ClientLib.Data.MainData.GetInstance().get_Combat().Clear();
city.SimulateBattle();
ClientLib.Data.MainData.GetInstance().get_Combat().set_Id(city.get_Id());
var app = qx.core.Init.getApplication();
app.getPlayArea().setView(webfrontend.gui.PlayArea.PlayArea.modes.EMode_CombatAt​tacker, city.get_Id(), 0, 0);

I've integrated this piece of code into my toolik and it generates a "DSYNC" on a very often basis
04-08-2012 04:53 PM
 Search   Quote 
FRISH Offline
Posting Freak
*****

Posts: 2,415
Joined: Feb 2012
Post: #7
RE: Official API Interface for 3rd party scripts/simulate tools
It's nice to see you guys supporting it.

[Image: utEo2eW.jpg]
05-08-2012 09:03 AM
 Search   Quote 
NgXAlex Offline
Junior Member
**

Posts: 30
Joined: Apr 2012
Post: #8
RE: Official API Interface for 3rd party scripts/simulate tools
Hi, why you removed the stats box ? Can you give the api code for the stats box ? And the 2x, 4x speed of simulation too.

Thanks.

Wink

World 4 [GLOBAL RESISTANCE] ALLIANCE RANK: 1

[Image: quv2gu1f0pogj12jp3hw-ge.jpg]
(This post was last modified: 07-08-2012 12:47 AM by NgXAlex.)
07-08-2012 12:47 AM
 Search   Quote 
VortexNavigator Offline
Junior Member
**

Posts: 29
Joined: Dec 2011
Post: #9
RE: Official API Interface for 3rd party scripts/simulate tools
That DSYNC occurs all too often . . . and after it does appear, the only way to get rid of it is to log off the server and log back in.

This is very irritating.
07-08-2012 06:23 AM
 Search   Quote 
delulytric Offline
is awesome
***

Posts: 162
Joined: Jun 2012
Post: #10
RE: Official API Interface for 3rd party scripts/simulate tools
Please make it illegal again, so that we as illegal players can use it illegally and have the full simulator function. Seriously, making it legal and disabling most functions will kill us all. At least, the simulator should be accurate and have the Speed Up button, that's all I ask for.
07-08-2012 11:03 AM
 Search   Quote 


Forum Jump:


User(s) browsing this thread: