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

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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-08-2004, 02:26 PM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default New Perl Command System

Well the new perl command system is in CVS. This lets you add new '#command' style in game commands written in perl. All old commands still work, this just allows you to extend it withouth coding in c++.

The commands go into a file named commands.pl in the same dir as the exe's.

things in features.h:
EMBPERL_COMMANDS - enable perl commands
EMBPERL_XS & EMBPERL_XS_CLASSES - not required, but theres not a lot you can do without them.
COMMANDS_PERL_OVERRIDE - allow perl commands to override C++ commands with the same name.

the only required sub in commands.pl is commands_init...
which should basically consist of a bunch of calls to command_add(command name, description, access_level).

Example commands.pl file displaying some example perl commands, as well as some of the stuff you can do with XS classes:
Code:
sub commands_init {
        command_add("bank", "- spawn a temporary banker", 200);
        command_add("giveitem", " (itemid) [charges] - give an item to a mob", 200);
}

sub bank {
        #spawn Banker_Javen
        quest::spawn(45054, 0, 0, $client->GetX()+10, $client->GetY(), $client->GetZ());
}

sub giveitem {
        my $item = shift;
        my $charges = 0;
        if(defined($_[0])) {
                $charges = shift;
        }
        my $target = $client->GetTarget();
        if(!$target) {
                $client->Message(13, "Error: You need a target!");
                return;
        } elsif(!$target->IsNPC()) {
                $client->Message(13, "Error: your target must be an NPC!");
                return;
        }
        my $n = $target->CastToNPC();
        $client->Message(0, "Giving item $item to ".$n->GetName());
        $n->AddItem($item, $charges);
}
Reply With Quote
 

Thread Tools
Display Modes

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:16 PM.


 

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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3