PDA

View Full Version : Lua Parser


KLS
06-26-2013, 04:26 PM
Lua Parser has been the works for a while now.

We're getting close to release of it but it's still a couple days away while we clean up last minute build issues and such.

https://github.com/EQEmu/Server/tree/lua

Documentation:
https://github.com/EQEmu/Server/wiki/Lua-Parser

Right now it is turned OFF by default but eventually we want to get to the point where we turn it ON by default and perl OFF by default.

Also we've worked hard to reduce incompatible changes with the Perl parser but there are a few:

* templates quest folder has been renamed global.

* The items and spells quest folders need to be moved to the global folder.

* Item quests have been consolidated into a single type instead of the three types based on event_type.
Now instead of three potential quests per item there is just one loaded as follows:
-if scriptfileid != 0 -> load script_<scriptfileid>.ext (eg: script_1000.pl)
-else if charmfile != "" -> load <charmfile>.ext (eg: CHRMTest.pl)
-else load <item_id>.ext (eg: 10001.pl)

* EVENT_PROXIMITY_SAY no longer occurs automatically.
You need to call quest::enable_proximity_say() in perl
or call eq.enable_proximity_say() in lua at least once
for the quest_manager to begin looking to process proximity events.

* quest::handleturnin has been removed

* quest::completehandin has been removed

* quest::resethandin has been removed

* quest::clearhandin has been removed

* Cazic Touch (982) is no longer hard coded to shout the target's name on cast.
This can easily be scripted in now and we're looking to hard code as few things as possible.

* Spell quests that previously blocked effects no longer function as they did in perl due to a limitation of the perl parser.

* event_death no longer triggers after a death has occurred but before.

For the item quests it's very likely people wont have to modify a thing. Before we had 3 types of item quests based on the items charm, script and item_id that varied based on event type. This is now all in one quest according to that priority. If you have an item quest right now that has more than one script for the same item then you'll need to make some changes but odds are you do not. Eg: none of the PEQ quests afaik follow this pattern.

For the handin stuff things we wrote a plugin that duplicates the functionality of multiquesting for perl. Though if you make heavy use of the functions it might take a while to update.

The spell stuff is more tricky due to how we changed the underlying system and a limitation in our perl parser we simply cannot override the effects on perl. It's suggested that if you need scripted spells that have completely overridable effects and can't use lua to make the spells be basically blank.

For the event_death, the way to get the old functionality (which is required in a few circumstances) is to instead use the event: event_death_complete.

wolfwalkereci
06-26-2013, 07:42 PM
That is some good stuff. I like how you guys/girls laid out the wiki.

KLS
07-01-2013, 05:20 PM
Has been running on PEQ for nearly a week now so we're confident about merging it into master.

It's a bit disruptive but not too bad to upgrade. Overall it should take about 10 minutes of changes unless you have some really heavy use of some of the impacted features.


Also as an aside: I realize we keep changing back end systems with questionable immediate benefit for people to upgrade. I think soon I will add something more tangible and nifty (not that lua isn't tangible and nifty but some people are happy with perl as is sooo).

Kingly_Krab
07-01-2013, 05:24 PM
Will this release of Lua cause the death of Perl support or will we have the availability of both? I'd hate to have to learn an entirely new language just to script a few NPCs, just a concern, hopefully there is a separate branch for Lua and one for Perl.

KLS
07-01-2013, 06:10 PM
Perl and Lua are able to be used at the same time and can even talk to each other via signals/timers.

It can only load one per type and will prefer lua to perl quests though. Eg: if you had fippy_darkpaw.pl and fippy_darkpaw.lua then fippy_darkpaw001 on event_spawn would load fippy_darkpaw.lua.

The idea is perl is becoming more and more difficult to support (just take a look at the issues getting it to run on windows for any modern version). So we needed a viable replacement in the long run but at the same time there are thousands of perl quests so it needs to run alongside because those wont get rewritten overnight (or ever maybe for some people).

Kingly_Krab
07-01-2013, 06:47 PM
All right, so if you don't have a .lua for that NPC it will just load the .pl, correct? For example I have a custom NPC, suppose his name is CustomNPC, and all I had for him was a .pl, it wouldn't attempt to load a .lua if he didn't have one so custom quest wouldn't be interfered with?

KLS
07-01-2013, 07:13 PM
It would attempt to load .lua, see that it's not there then attempt to load the .pl.

Kingly_Krab
07-01-2013, 07:16 PM
Thank you, doesn't seem that bad after all, I could keep Perl and learn Lua if I wanted to. Thanks for the quick responses.

Secrets
07-01-2013, 07:38 PM
Nicely done, KLS, I'll be messing around with this during the week.

Boost is now required by the way if you are using LUA, I'd like to see that become a requirement for all builds and used more.

Furniture
07-02-2013, 12:09 PM
Ive updated my quests folder via svn today, and it changed all my event_death portion on my npcs to event_death_COMPLETE , and now my event_death scripts are not working

What do I have to download here to get everything working again? I dont know anything about lua

Furniture
07-02-2013, 12:25 PM
Yeah i dont understand, lua is not supposed to be enabled by default, yet now every one of my npcs have the event_death_complete instead of event_death in the .pl scripts, breaking every single one of them, what can I do?

Robregen
07-02-2013, 01:49 PM
you need to recompile the latest git as it now includes the code for event_death_complete. And make sure you build it with perl.

KLS
07-02-2013, 01:58 PM
1) Make sure they're EVENT_DEATH_COMPLETE and not event_death_complete(case sensitive).
2) Make sure you're using current master code.

Lua enabled or not, perl still sees the new events.

Furniture
07-02-2013, 03:52 PM
ahh ok, i didnt realize git was updated yesterday to include this, sorry about that