View Full Version : Perl scripting
mollymillions
12-03-2003, 03:18 AM
Has anyone had any luck using the Perl scripting?
Kroeg
12-03-2003, 03:21 AM
I have had tons of luck (and fun) using the perl scripting for quests. I'll admit it was a bit confusing at first (if you're not used to using C developer environments) but once you get the hang of it, it becomes pretty clear.
mollymillions
12-03-2003, 03:39 AM
Which EQEmu version are you using?
Rogean
12-03-2003, 06:45 AM
Perl Scripting = teh pwn =)
Kroeg
12-03-2003, 07:58 AM
I use 0.5.2 DR1 (with embperl.cpp/h and embparser.cpp/h included and EMBPERL,EMBPERL_PLUGIN defined).
rockocool
12-03-2003, 02:37 PM
Hi, Kroeg, where did you get the 0.5.2-DR1 source code? I am looking in sourceforge but could only find 0.5.1.
mollymillions
12-03-2003, 07:41 PM
I am unworthy of access to the 5.2 source but i have compiled 5.1 DR2 (with embperl.cpp/h and embparser.cpp/h included and EMBPERL,EMBPERL_PLUGIN defined, and the pearl\lib\CORE directory added to the Include and Library directories, using VS6), but have had no luck with perl scripts (in the Quests\Zonename folder with a .pl extension) or the #peval command.
Can anyone confirm that embedded Perl is functional in 5.1 DR2 dev release (or any version that is publicly available), or alternately, can anyone give me a heads up on what i may be doing incorrectly?
Thanks for the feedback Rogean, but can anyone translate Rogean's comment into Australian for me (i am obviously a dork, i have been coding for 25 years but have no idea what this comment means, I will assume it
Eglin
12-03-2003, 08:26 PM
[quote=mollymillions]I am unworthy of access to the 5.2 source but i have compiled 5.1 DR2 (with embperl.cpp/h and embparser.cpp/h included and EMBPERL,EMBPERL_PLUGIN defined, and the pearl\lib\CORE directory added to the Include and Library directories, using VS6), but have had no luck with perl scripts (in the Quests\Zonename folder with a .pl extension) or the #peval command.
Can anyone confirm that embedded Perl is functional in 5.1 DR2 dev release (or any version that is publicly available), or alternately, can anyone give me a heads up on what i may be doing incorrectly?
Thanks for the feedback Rogean, but can anyone translate Rogean's comment into Australian for me (i am obviously a dork, i have been coding for 25 years but have no idea what this comment means, I will assume it
mollymillions
12-03-2003, 08:57 PM
Thanks Eglin, i just really wanted confirmation that it doesn't require any code tweaking as i have no c++ skills. If you say it will work out of the box with 5.1 DR2 that's good enough for me. I will work it out. Thanks.
Eglin
12-03-2003, 09:04 PM
Thanks Eglin, i just really wanted confirmation that it doesn't require any code tweaking as i have no c++ skills. If you say it will work out of the box with 5.1 DR2 that's good enough for me. I will work it out. Thanks.Sorry, but I can't really make that promise. In fact, I don't think that there will ever be an "out of the box" version that supports perl scripting. Too many variables, like the fact that you don't really want to require that everyone use the same perl distribution (down to the same version).
Again, if you want to tell us the details of your problems, maybe we can get you fixed up.
mollymillions
12-05-2003, 03:14 AM
This isn't a bug report, just info. I hit a problem associated with defining EMBPERL_PLUGIN that causes zones to crash on startup. This occurs with 0.5.1-DR2 and 0.5.2-DR1 (ActivePerl 5.8.1.807). Without defining EMBPERL_PLUGIN quests work well.
Trumpcard
12-05-2003, 03:20 AM
Try this Molly...
Kroeg
12-05-2003, 07:24 AM
I had to do this same thing, as I was getting a lot of error output in world and crashing all the time. If you have a problem when trying to Install IO:Scalar , then try truncating the directory name to your path of nmake.exe (if using MSVC++) , such as \visual~1\nmake.exe when executing the perl -MACPAN -e shell command.
Eglin
12-05-2003, 08:53 AM
I had to do this same thing, as I was getting a lot of error output in world and crashing all the time. If you have a problem when trying to Install IO:Scalar , then try truncating the directory name to your path of nmake.exe (if using MSVC++) , such as \visual~1\nmake.exe when executing the perl -MACPAN -e shell command.
That is an excellent tip, Kroeg! Thank you for pointing that out.
As a general rule, Activestate users should use ppm3 instead of cpan, but for some reason Activestate doesn't have a IO::Scalar ppm. I'm sure it is included with some other mods, but I can't remember which. Had I realized that it wasn't installed with the perl base, I probably would've avoided its use. The way that the perl interpreter crashes out instead of properly reporting the error is a source of concern to me, also. I'm wondering if I the dependency should just be removed. Plugins would have to be changed to stop using the PLUGIN filehandle for I/O, though.
At any rate, good pickup on the error, guys.
mollymillions
12-05-2003, 02:24 PM
I had to do this same thing, as I was getting a lot of error output in world and crashing all the time. If you have a problem when trying to Install IO:Scalar , then try truncating the directory name to your path of nmake.exe (if using MSVC++) , such as \visual~1\nmake.exe when executing the perl -MACPAN -e shell command.
-or encase long file names with quotes.
Rebocide
12-06-2003, 05:45 PM
I been thinking bout using perl or just something besides vb but i dont wanna commit to something i won't really get into.. Is there a site with some good information and a break down of perl i can check out? Like i said i dont wanna commit and get into it if i think it just dont work for me.
Eglin
12-06-2003, 09:24 PM
I been thinking bout using perl or just something besides vb but i dont wanna commit to something i won't really get into.. Is there a site with some good information and a break down of perl i can check out? Like i said i dont wanna commit and get into it if i think it just dont work for me.
google: Searched the web for perl tutorial. Results 1 - 10 of about 1,050,000. Search took 0.09 seconds.
All Perl dists come with core language references. The Activestate bundled docs have a fair amount of info. about using Windows specifics (using Perl in IIS, doing COM, WSH, etc), which would probably be useful to a person trying to move from vb. Any module more than 5 lines contains embedded docs that can be read using the perldoc function. These are very terse, though, and probably won't be very useful until you get to know the language a bit.
If you had more specific questions, like, "where can I look for x" or "what is a good book for x", then I think I could help a little bit more, but as it is, I don't really know what to recommend. Some people can just look at the included language reference and be good to go (or worse yet, the bnf grammar!). Others need a library of books that hold your hand and walk you through several example programs. How did you learn VB?
I can say that I, personally, think that the camel and llama books are a bit overrated, since I believe that the bundled docs provide equally useful (and oft times more current) referential material. The book that I used to recommend most often (back when I still recommended learning Perl!) was "Teach yourself Perl in 21 Hours" or something like that. I'm 99% sure it was "hours" and not "days," which also exists, I think. The book was designed to guide your progress through the language with a number of chapters each small enough to be digested within an hour. The author (sorry, I can't remember who) broke the language down exceptionally well, choosing good points of division and good order of introduction. Each chapter culminated in one or more examples that used the technologies discussed so far. There might've even been exercises/questions for further study at the end of each chapter (can't remember... sorry).
mollymillions
12-07-2003, 05:09 AM
Some info regarding writing quests in Perl script (alot of which would be obvious to some). Refer to Eglin's posts for the low-down on embedded Pearl.
I have been using 5.2 DR1. Some of my observations may be incorrect, I welcome corrections.
-Perl script quest files must have a .pl extension.
-Any character can be used in the string for a Say command, although commas will cause concatenation problems (I would ignore this issue at present, as it would be fair to assume that this problem will be resolved in future releases).
-There must be only one occurrence of any particular event in a quest file (the length of code used in an event does not seem to be limited).
-$itemcount, and other commands, use a hash lookup and must use brackets {} instead of parenthesis () to contain the argument/s.
-A file can be parsed with perl.exe to locate errors, although this will not identify all possible problems with quest file.
-To reload a zone's quests, you need stop and restart the zone, using #reloadqst, zoning and re-entering the zone, or camping and re-entering the zone will not necessarily reload modified quest files.
-Working example:
sub EVENT_SAY {
if($text=~/Hail/i) {
quest::say("Greetings. I am Puab Closk. Master of the Ashen Order. Our home is your home, friend. Feel free to stay as long as you like. Learn our ways as many have done in the past. To fight like the tiger and strike like the cobra are your goals. ");
}
if($text=~/What are treant fist/i) {
quest::say("I have these items, and will gift them to any [monk of great skill]");
}
if($text=~/I am a monk of great skill/i) {
quest::say("Then you shall aid our family. My former pupil [Clawfist] has been banished by his people. You will go to him and hand him this token as proof of your origin. He shall be expecting you.");
quest::summonitem("12369");
}
if($text=~/Who is Clawfist/i) {
quest::say("Clawfist is a Kerran, a catman. He braved the dangers of Norrath to reach the Ashen Order. He sought knowledge of our disciples. He learned well.");
}
if($text=~/Where is Clawfist/i) {
quest::say("Clawfist has been banished by the Kerrans of Odus. Where they have sent him I am unsure"); }
}
sub EVENT_ITEM {
if ($itemcount{28055} == 1 ) {
quest::say("You have performed a great service to one who is your brother. Your loyalty shines brightly, as does your skill. Take the Treant fists. They are yours now.");
quest::summonitem("12344");
quest::exp("100"); }
}
#END of FILE Zone:freportw ID:4008 -- Puab_Closk
Kroeg
12-08-2003, 02:20 AM
The above example contains commas within statements.. this will not work, and will smoosh your text together in one line. Simply removing commas (with something like "Inforapid fast text replacer" you can do this quickly)
mollymillions
12-08-2003, 01:59 PM
-Any character can be used in the string for a Say command, although commas will cause concatenation problems (I would ignore this issue at present, as it would be fair to assume that this problem will be resolved in future releases).
Kroeg
12-09-2003, 01:14 AM
I know, i'm just used to it by now to notice that instantly :)
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.