Page 1 of 2
Annotations in Script Engine
Posted: Tue Aug 07, 2012 12:39 pm
by powerful0guardian
Hello guys! I want to know your opinion about a small script engine rework using annotations for stuffs like addTalkId, addAttackId, addFirstTalkId, etc...
Code: Select all
@TalkerNpcs(npcIds = {12345,12346,13457})@FirstTalkerNpcs(npcIds = {12345,12346,13457})@NpcsToAttack(npcIds = {92353, 45353, 34253})public final class Q12345_ExampleApple { public Q12345_ExampleApple() { super(12345, Q12345_ExampleApple.class.getSimpleName(), "quests"); } etc... etc... (methods)}
Re: Annotations in Script Engine
Posted: Tue Aug 07, 2012 12:42 pm
by powerful0guardian
PS: I can do&share it if it's requested.
Re: Annotations in Script Engine
Posted: Tue Aug 07, 2012 12:42 pm
by jurchiks
You think it's worth it? What will it improve? It's not even shorter code, and requires writing a new @interface every time you want to add a new event, instead of just writing a method in Quest class.
IMHO the event listeners made by TheOne are quite enough, l2j just needs to start using them.
Re: Annotations in Script Engine
Posted: Tue Aug 07, 2012 12:48 pm
by powerful0guardian
jurchiks wrote:You think it's worth it? What will it improve? It's not even shorter code, and requires writing a new @interface every time you want to add a new event, instead of just writing a method in Quest class.
looks better and more comfortable - but just my opinion, if not liked/requested I won't make it.
Re: Annotations in Script Engine
Posted: Tue Aug 07, 2012 12:50 pm
by jurchiks
That's obviously a matter of opinion. To me, the looks doesn't really matter in this case, but the fact that it requires more code is a dealbreaker.
But I guess we'll see what others say.
Re: Annotations in Script Engine
Posted: Tue Aug 07, 2012 12:53 pm
by powerful0guardian
jurchiks wrote:That's obviously a matter of opinion. To me, the looks doesn't really matter in this case, but the fact that it requires more code is a dealbreaker.
But I guess we'll see what others say.
well, first of all. Styles and opinions

That's why I posted it here in discussions, to discuss it. Everyone has his own opinion, but well, I won't going to share anything till Unafraid or Zoey or Melerix says it's needed, because don't want to work for nothing. In past we had intresting discussions jurchiks (I hope you don't hate me soo much:P) I do not wanted to argue, just wanted to tell my opinion.

Re: Annotations in Script Engine
Posted: Tue Aug 07, 2012 12:55 pm
by jurchiks
I don't hate you and I'm not arguing (at least not IMO), I'm just stating my opinion.
Re: Annotations in Script Engine
Posted: Tue Aug 07, 2012 12:57 pm
by powerful0guardian
jurchiks wrote:I don't hate you and I'm not arguing (at least not IMO), I'm just stating my opinion.
okey than, we're in same state

(I thought you totally hate me, good to know not true

)
Re: Annotations in Script Engine
Posted: Wed Aug 08, 2012 2:28 pm
by UnAfraid
@powerful0guardian i really like the idea of using annotations, but really i don't think that's the best place for it.
It will cause massive scripts rework which is hell of a work i can say..
And we gain nothing in performance direction neither as comfortable IMO.
I would use it for handlers for example for these which we need to load only if some config is set as true and remove completely MasterHandler/EffectMasterHandler classes.
Re: Annotations in Script Engine
Posted: Thu Aug 09, 2012 11:11 am
by powerful0guardian
UnAfraid wrote:@powerful0guardian i really like the idea of using annotations, but really i don't think that's the best place for it.
It will cause massive scripts rework which is hell of a work i can say..
And we gain nothing in performance direction neither as comfortable IMO.
I would use it for handlers for example for these which we need to load only if some config is set as true and remove completely MasterHandler/EffectMasterHandler classes.
well... in my script engine I don't use scripts.cfg just simply load the directories instead of files + I take a main() method to all scripts (with parser) so I would prefer that if you want a rework... but if you still wanna keep scripts.cfg that would be good only for handlers instead of MasterHandler... a simple recrusive script load for a directory containing scripts, thats all

If you need the parser I can send.
Re: Annotations in Script Engine
Posted: Thu Aug 09, 2012 11:57 am
by jurchiks
Does it work for jython scripts?
Re: Annotations in Script Engine
Posted: Thu Aug 09, 2012 12:41 pm
by powerful0guardian
jurchiks wrote:Does it work for jython scripts?
the directory load would work... if you mean that. but I would not care longer about jython
Re: Annotations in Script Engine
Posted: Thu Aug 09, 2012 1:05 pm
by jurchiks
But l2j does, because most quests are still written in jython, and some people actually prefer it over java. Thus if you want l2j to implement it, you'll have to make it work for jython as well.
Re: Annotations in Script Engine
Posted: Thu Aug 09, 2012 1:29 pm
by powerful0guardian
jurchiks wrote:But l2j does, because most quests are still written in jython, and some people actually prefer it over java. Thus if you want l2j to implement it, you'll have to make it work for jython as well.
well, as I said it should work for PY too, cause it calls recrusive same function what using scripts.cfg so must work. But well, I don't think so "PY quests" are works (properly) or as they should, I think all of them are outdated and nothing more than junks. But well, they're good for keeping them for a skretch for the further PY->java translate.
Re: Annotations in Script Engine
Posted: Thu Aug 09, 2012 2:31 pm
by jurchiks
it calls recrusive same function what using scripts.cfg so must work
I see, then it should be fine.
nothing more than junks.
Rin4a would strongly disagree with you

He's the guy who made the python scheme buffer and has made better ones aswell (not publicly available though), all in python.
They certainly are outdated, but the "junk" part depends entirely on the author.
they're good for keeping them for a skretch for the further PY->java translate
And this is where I would disagree with you. They are outdated and badly written, thus they make a very bad base to port. The Freya AI is out there and it is a MUCH MUCH better base. Obviously you need to understand it, but if you don't, you probably won't be able to write the quest script in Java as good as a person who does.