View Single Post
  #4  
Old 11-29-2003, 01:18 PM
Eglin
Hill Giant
 
Join Date: Nov 2003
Posts: 168
Default

Quote:
Originally Posted by Trumpcard
Could you go into a little more detail in this thread regarding subdirectories, extensions, etc..
Of course. Please feel free to ask specific questions, too.

Perl quests work almost exactly like native quests. I modeled them after the description here, and made changes where I happened to notice that Wes did (ala $itemcount or timer). At any rate, the same directory structure is used, but filenames should end in ".pl". So, if you download the quests linked above, then you should unzip them such that your dir structure looks like ($eqemu_base)/quests/($zonename)/[npcid].qst (all lowercase!!!), then paste the convert script above into ($eqemu_base)/quests/convert.pl, then run ./convert.pl. You should then have a .pl file for each .qst file. I don't think the quest converter works perfectly yet, but I don't think it should be hard to fix it (works for me, but I had differently formatted input quests & I don't remember where I downloaded them). Offering a quest package already in pl format would be cool, espescially since installing perl quests requires a level of trust in the author (security reasons), but I didn't feel comfortable doing so since I do not know who to credit for the original package (which all modern quest distributions obviously derive from). Nonetheless, I am considering making/maintaining a quest/plugin package/repository at some point.

Plugins may either be stuffed into ($eqemu_base)/plugin.pl or placed in any file with a .pl extention in ($eqemu_base)/plugins/ When zone starts up, it will compile all the code in plugin.pl and each file in the plugins dir whose filename ends in .pl (IIRC). Any code outside of a subroutine will be discarded (IIRC). All code is compiled into package plugin by default. For some plugin examples, see this thread. Plugins and the #peval command are really really really cool and useful. If you use perl, you should learn them. The key to using them effectively is to learn how embperl stuffs things into packages (plugins are in package plugin, quests are in qst[qst id] (ie qst1234) or qstdefault). Don't worry if you don't understand that last bit - you can still benefit from using perl.

hrm... what else should I share? Oh... the vars $1, $1-, etc aren't be used in Perl quests. Instead, look for $text to hold the entire string. So, if ($1- =~= "Hail") becomes if($text=~/Hail/). I _think_ that the convert script will handle this for you, but you should still probably know what's up.

Since I can't think of anything else to share without trying to teach Perl, I'll stop. Feel free to ask specific questions, though (in this thread or others). I want to see some cool quests/features, so if you do something neat, need help doing something neat, or just have a tight setup, please post somewhere and tell us about it!
Reply With Quote