Annotations in Script Engine

This is not a Support area! Discuss about the Server here. Non-Server related discussion goes in Off-Topic Discussion.
Forum rules
READ NOW: L2j Forums Rules of Conduct
powerful0guardian
Posts: 63
Joined: Tue Jun 26, 2012 11:16 am

Annotations in Script Engine

Post 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)}  
powerful0guardian
Posts: 63
Joined: Tue Jun 26, 2012 11:16 am

Re: Annotations in Script Engine

Post by powerful0guardian »

PS: I can do&share it if it's requested.
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Annotations in Script Engine

Post 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.
Last edited by jurchiks on Tue Aug 07, 2012 12:49 pm, edited 1 time in total.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
powerful0guardian
Posts: 63
Joined: Tue Jun 26, 2012 11:16 am

Re: Annotations in Script Engine

Post 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.
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Annotations in Script Engine

Post 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.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
powerful0guardian
Posts: 63
Joined: Tue Jun 26, 2012 11:16 am

Re: Annotations in Script Engine

Post 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. :)
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Annotations in Script Engine

Post by jurchiks »

I don't hate you and I'm not arguing (at least not IMO), I'm just stating my opinion.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
powerful0guardian
Posts: 63
Joined: Tue Jun 26, 2012 11:16 am

Re: Annotations in Script Engine

Post 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 :P )
User avatar
UnAfraid
L2j Veteran
L2j Veteran
Posts: 4199
Joined: Mon Jul 23, 2007 4:25 pm
Location: Bulgaria
Contact:

Re: Annotations in Script Engine

Post 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.
Image
powerful0guardian
Posts: 63
Joined: Tue Jun 26, 2012 11:16 am

Re: Annotations in Script Engine

Post 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.
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Annotations in Script Engine

Post by jurchiks »

Does it work for jython scripts?
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
powerful0guardian
Posts: 63
Joined: Tue Jun 26, 2012 11:16 am

Re: Annotations in Script Engine

Post 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
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Annotations in Script Engine

Post 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.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
powerful0guardian
Posts: 63
Joined: Tue Jun 26, 2012 11:16 am

Re: Annotations in Script Engine

Post 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.
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Annotations in Script Engine

Post 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 :D
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.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Post Reply