Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 11-09-2013, 07:40 PM
rencro
Hill Giant
 
Join Date: Sep 2008
Location: So. California
Posts: 219
Default Which is a better script format?

I am trying to convert to lua but finding that I always go back to what "works" with perl. I have a custom check in my global_player that checks if a character has a certain list of items when zoning, and removes them if true.

Which of these would be more efficient, assuming that the list will be much larger in size?

Perl
Code:
sub EVENT_ENTERZONE
{
	my @meats1 = qw(1001 1002 1003);
	for ($j = 0; $j < 3; $j++) {
		if(plugin::check_hasitem($client, $meats1[$j])) {
			quest::collectitems($meats1[$j], 1);	
		}
	}
}
Lua
Code:
function event_enter_zone(e)
	local meats1 = {1001, 1002, 1003}; -- temp using cloth items to test with
	for j, name in ipairs(meats1) do
		if(e.self:HasItem(name) == true) then
			eq.collect_items(name, true);
		end			
  	end
end
The reason I ask is that if Lua is much more efficient I will try to focus on lua, but there seems to be more things I can do with perl, but most likely is my experience with lua, or lack of.

Also, are those two methods the best way to iterate through the lists?
Reply With Quote
  #2  
Old 11-09-2013, 09:05 PM
Davood
Discordant
 
Join Date: Jan 2005
Posts: 488
Default

i haven't touched LUA yet - but from what i understand, LUA lets you do some server / game mechanics changes (memory and multithreading) that perl can't "Easily" touch, whereas you have to giveup the RDMS (relational database management system) in order to use LUA.

personally i am a db guy,. i like to have my database nicely structured, even if it is slower and "clunky" compared to LUA (as far as others have told me).

as a language, perl is "slow" compared to LUA so if you plan on having massive scripts (like the 300kb+ inneficient perl-hemoths on my server) and dont really mind re-learning data ideology and reverting back to "flat files" then LUA would be a better option.
__________________
----------
Demon Overlord of Alakamin
skype @ davoodinator
Reply With Quote
  #3  
Old 11-09-2013, 09:08 PM
Davood
Discordant
 
Join Date: Jan 2005
Posts: 488
Default

addendum:

if someone hand holds me and shows me how to use mysql with lua - i would consider switching teams.

also

you CAN do memory hacking and multi threading in perl

i have done it for web spidering (multi threading) it just isn't as "good" as LUA (from what i'm told, i have 0 experience)
__________________
----------
Demon Overlord of Alakamin
skype @ davoodinator

Last edited by Davood; 11-09-2013 at 09:09 PM.. Reason: more details added
Reply With Quote
  #4  
Old 11-10-2013, 12:08 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Last I heard, perl will not be getting any makeovers, unless it's to fix an issue.

New features will only be added to lua.


If I am wrong, or if things have changed, please speak up
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #5  
Old 11-10-2013, 01:27 PM
rencro
Hill Giant
 
Join Date: Sep 2008
Location: So. California
Posts: 219
Default

Thanks both of you for the feedback...
Reply With Quote
  #6  
Old 11-10-2013, 05:30 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Yes, Perl is officially deprecated in EQEmu. It will not be broken, but developers are not required to port new features to it.

Lua I feel for our needs is vastly superior for scripting. It's lighter and quicker, and KLS has already ported cool features to it that Perl does not have - like the ability to send custom packets.

Now, I am not dissing Perl. I use it for virtually all of my external scripting, minus the occasional bash script. It's my goto language for that. But let's be honest here, Perl is a tank.

For MySQL work, my opinion is that you are better off keeping that in the C++ server code. Its quicker, and far more secure. If you are familiar enough with the Perl syntax, picking up C++ at least in this case is a breeze.
Reply With Quote
  #7  
Old 11-10-2013, 08:18 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

If you use luajit there are some nice easy to use FFI bindings for MySQL. There are some for regular lua too but they're harder to use since you have to compile them.
Reply With Quote
  #8  
Old 11-11-2013, 01:44 AM
Davood
Discordant
 
Join Date: Jan 2005
Posts: 488
Default

I see. Thank you for the response.

Yeah, i'm quite comfortable with c++ so if i go with LUA i will redo my db calls and then access my data via the script.

OK final thread hijacking question!

I think this was answered, but to confirm:

Perl and LUA can work together ? or are they mututally exclusive.. i dont remember choosing something in cmake that indicated which was to be used?

this is still going to be a huge deterrent for me as i dont know how effectively i will be able to port my morbidly obese perl scripts into LUA without alot of complaining.

id rather just convert the mega beasts (still some functionality i want to add to them kekeke) and leave the rest in perl.
__________________
----------
Demon Overlord of Alakamin
skype @ davoodinator
Reply With Quote
  #9  
Old 11-11-2013, 01:55 AM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

An entity (NPC, Item, Spell) can only have one script on it at a time. If two exist, it will use the Lua and ignore Perl. However, the server can use Perl and Lua at the same time - just make sure you say yes to both in cmake. The current PEQ quests for example are still mostly Perl with a growing number of Lua scripts being written. They all work fine.
Reply With Quote
  #10  
Old 11-11-2013, 02:01 AM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,165
Default

LUA and Perl can be enabled at the same time. I'm not sure if there will be problems if there is a Perl and lua script for the same NPC though.

LUA also has the benefit of being designed with our use case in mind (well embedding into C) so its much easier to maintain. I know there arent really any current Dev that really knows the Perl embedding very well, I know KLS has fixed things, but with great mental agony :P
Reply With Quote
  #11  
Old 11-11-2013, 02:04 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Lua and Perl even can interact via timers and signals.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:41 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3