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-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
  #2  
Old 11-08-2004, 02:28 PM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

This is a nifty idea...will #reloadquest refresh this file as well?
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
Reply With Quote
  #3  
Old 11-08-2004, 02:33 PM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

Quote:
Originally Posted by Cisyouc
This is a nifty idea...will #reloadquest refresh this file as well?
Yes.
Reply With Quote
  #4  
Old 11-08-2004, 03:10 PM
Rogean's Avatar
Rogean
Administrator
 
Join Date: Jul 2003
Location: Massachusetts
Posts: 708
Default

Very good job FNW.
__________________
EQEmulator Developer / Administrator
Reply With Quote
  #5  
Old 11-08-2004, 03:21 PM
RangerDown
Demi-God
 
Join Date: Mar 2004
Posts: 1,066
Default

Wow! Nice work!
__________________
<idleRPG> Rogean ate a plate of discounted, day-old sushi. This terrible calamity has slowed them 0 days, 15:13:51 from level 48.
Reply With Quote
  #6  
Old 11-08-2004, 04:01 PM
einsteinrs
Fire Beetle
 
Join Date: Aug 2004
Location: Germany
Posts: 8
Default

Cool
Keep up your great work FNW.

For me it s easier to code in perl than C++. It seems to me
that the new system has fixed also some broken quest commands.

Sorry for my bad english. I m german.
Reply With Quote
  #7  
Old 11-08-2004, 07:46 PM
Kroeg's Avatar
Kroeg
Hill Giant
 
Join Date: Oct 2003
Posts: 241
Default

Damn, you're the man... this is very exciting. I shall put this to great use in the near future!
Reply With Quote
  #8  
Old 11-09-2004, 06:34 AM
hypershadow66
Banned
 
Join Date: Nov 2003
Posts: 335
Default

question on
command_add("bank", "- spawn a temporary banker", 200);
command_add("giveitem", " (itemid) [charges] - give an item to a mob", 200);

what is the , 200 for at the end?

and do we compile with perl like normal for this to compile?
Reply With Quote
  #9  
Old 11-09-2004, 07:56 AM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

Its the same syntax as command.cpp but without the function name at the end..

So the integer would be the default minimum status.
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
Reply With Quote
  #10  
Old 11-09-2004, 08:07 AM
hypershadow66
Banned
 
Join Date: Nov 2003
Posts: 335
Default

thanks cis, but i cant get the latest CVS to compile, it says im missing Common_profile.h you know where i can get this?
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 03:07 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