Closed vodcms closed 8 years ago
Here is some old code that can get you going: https://gist.github.com/spheenik/3766744d47c170f25cf5
i run is error Entity is have't m_vecOrigin property pls help me
It’s hard for me to understand what your problem is. What’s your native language?
Sounds like the entity does not have „m_vecOrigin“? Then it probably is no hero entity?
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import skadistats.clarity.model.Entity;
import skadistats.clarity.processor.runner.Context;
import skadistats.clarity.processor.runner.SimpleRunner;
import skadistats.clarity.processor.tempentities.OnTempEntity;
import skadistats.clarity.source.MappedFileSource;
public class Main {
private final Logger log = LoggerFactory.getLogger("da");
@OnTempEntity
public void onTempEntity(Context ctx, Entity e) {
Object v = e.getProperty("m_vecOrigin")
System.out.println(v);
}
public void run(String[] args) throws Exception {
long tStart = System.currentTimeMillis();
new SimpleRunner(new MappedFileSource("/Users/guest/Downloads/1667995496_replay.dem")).runWith(this);
long tMatch = System.currentTimeMillis() - tStart;
log.info("total time taken: {}s", (tMatch) / 1000.0);
}
public static void main(String[] args) throws Exception {
new Main().run(args);
}
}
TempEntites are not real Entities!
They are used for showing effects like blood, muzzle flash etc.
Take a look at the MatchEnd example on how to get a real entity.
There's also @OnEntityCreated
and @OnEntityUpdated
, you can play around with that :)
I didn't know there was an @OnEntityCreated!
Might be a little faster than trying to check for new wards every second :)
Be careful, they might reuse an entity spot, and you'd only get one call. But I could hack together an @OnEntityEnters for that case pretty quickly. If you want that for the 2.1 release, could you write a small request for it on the main project?
thank @spheenik
Sure @vodcms, np :) Btw: You can just do e.toString() on an entity to get a nice dump of all it's properties.
hi @spheenik .where have about replay explian docuemnt? i do not understand properties
hehe, there simply is none... But if you can read code, here is the parser of YASP, that uses clarity in a lot of ways: https://github.com/yasp-dota/yasp/blob/master/parser/src/main/java/yasp/Main.java
I try to process my replay with this function, but there are nothing printed, it's strange :'(. My parameters are good?
@OnEntityUpdated
public void onEntityUpdated(Context ctx, Entity e,int[] a, int b) {
System.out.println( b);
}
which version of clarity are you using?
The last version, snapshot 2.1.
Then it was because of me, since exactly that one event was disabled in 2.1 until now, since it's signature was going to change. I just pushed a new snapshot that should have the event again. It's signature changed, however:
@OnEntityUpdated
public void onEntityUpdated(Context ctx, Entity e, FieldPath[] changedPaths, int numChangedPaths) {
// the first numChangedPaths entries in fieldPaths show exactly what properties have changed.
// do *not* keep a reference to changedPaths, since it's reused by clarity!
}
Thanks, it works like a charm !
you're welcome!
pls how to pring hero postion?