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 02-12-2013, 02:27 PM
Figback65
Discordant
 
Join Date: Aug 2009
Location: 2131231231
Posts: 255
Default Buff Bot re-creation NPC getclass() Help

There is a post on here for an awsome buff bot

http://www.eqemulator.org/forums/showthread.php?t=29401

I am trying to take this a step further but my still growing limit script knowledge is leaving me in the dust.

I have a spawngroup cycle that spawns my buff bot. Sometimes it spawns as different classes, so when It spawns I want it to be able to only cast spells from the class it spawned as and with a player(not npc) level check so a level 1 player cannot get clarity 2 because he is too low lvl. I am posting what I have done so far and hoping im on the right track lol.

Code:
#Credit goes to Sylaei for the original creation of this buff bot! Thank you Sylaei 08-31-2009
#Edited by Fig to suit VCR server needs. 02-02-2013

sub EVENT_SPAWN {
my $Ench = ($npc->GetClass() == 'Enchanter');
my $Necro = ($npc->GetClass() == 'Necromancer');

if ($npc->GetClass() == 'Enchanter') {
@SpellList = ("Bind Affinity","Breeze","Clarity","Clarity II","Alacrity","Augment","Aanya's Quickening","Rune I");
@SpellCost = ("10","25","50","200","10","30","100","5");
@SpellID =   ("35","697","174","1693","170","1729","1708","481");

}

else ($npc->GetClass == 'Necromancer') {
@SpellList = ("Dead Men Floating");
@SpellCost = ("10");
@SpellID =   ("1391");
}

}


sub EVENT_SAY {
my $buffs = quest::saylink("buffs", 1);
my $NPCName = $npc->GetCleanName();
if ($text =~/Hail/i) {
$client->Message(315, "Chip Chip $name, Do you need some $buffs?'");
}

#Counts each row for the While
my $count = 1;
#Counts each element in the Array for the While
my $n = 0;

if ($text !~ /Hail/i) && $Ench {
	while ($SpellList[$n]) {
	#This searches the list to find possible matches. The lc() command makes all text lowercase.
	#It is easier to make all text lower case for comparison, if the user types uppercase it will still match.
		if ((lc($SpellList[$n]) =~ lc($text) && lc($SpellList[$n]) ne lc($text)) || ($text =~ /^buffs$/i)) {
		my $SpellList = quest::saylink($SpellList[$n]);
		$client->Message(315, "These are your choices, $SpellList");
		}
 		#This is the command that is executed when a the user enters a spell.
			if (lc($SpellList[$n]) eq lc($text) && $text !~ /^buffs$/i) {
			#Creates a global variable.  You must set the qgolbal field in the npc_types table to 1 for each npc you wish to handle global variables.
			#buff is the name, $text is what the varible should be eq too, 0 only this npc, char, and zone apply to the variable, M5 is 5 minutes.
			quest::setglobal("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
		}
	}


elsif ($text !~ /Hail/i) && $Necro {
	while ($SpellList[$n]) {
	#This searches the list to find possible matches. The lc() command makes all text lowercase.
	#It is easier to make all text lower case for comparison, if the user types uppercase it will still match.
		if ((lc($SpellList[$n]) =~ lc($text) && lc($SpellList[$n]) ne lc($text)) || ($text =~ /^buffs$/i)) {
		my $SpellList = quest::saylink($SpellList[$n]);
		$client->Message(315, "These are your choices, $SpellList");
		}
 		#This is the command that is executed when a the user enters a spell.
			if (lc($SpellList[$n]) eq lc($text) && $text !~ /^buffs$/i) {
			#Creates a global variable.  You must set the qgolbal field in the npc_types table to 1 for each npc you wish to handle global variables.
			#buff is the name, $text is what the varible should be eq too, 0 only this npc, char, and zone apply to the variable, M5 is 5 minutes.
			quest::setglobal("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
		}
	}
}

I do not have the level checks placed anywhere because honestly i have no clue where to put the check lol.
As always any and all feedback and suggestions appreciated

Edit: Its having a problem calling the correct spell list. I am pretty sure I cannot call
Code:
my $Ench = ($npc->GetClass() == 'Enchanter');
from sub EVENT_SPAWN to sub EVENT_SAY. Also I think my IF statement under EVENT_SAY could be changed to something like if
Code:
If ($npc->GetClass() == 'Enchanter') || ($npc->GetClass() == 'Enchanter')
brain hurts
__________________

Last edited by Figback65; 02-12-2013 at 03:16 PM.. Reason: notes
Reply With Quote
  #2  
Old 02-12-2013, 04:21 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

Why'd you do this?: Shouldn't it be elsif? Just try using the syntax checker, errors below. I pasted exactly what you posted and got those errors, nothing extra, nothing less.
Code:
else ($npc->GetClass == 'Necromancer') {
@SpellList = ("Dead Men Floating");
@SpellCost = ("10");
@SpellID =   ("1391");
}
Code:
syntax error at Test.pl line 12, near "else ("
syntax error at Test.pl line 18, near "}"
syntax error at Test.pl line 33, near ") &&"
syntax error at Test.pl line 40, near "}"
syntax error at Test.pl line 47, near "}"
syntax error at Test.pl line 50, near "}"
syntax error at Test.pl line 61, near "}"
syntax error at Test.pl line 68, near "}"
syntax error at Test.pl line 71, near "}"
If you want to keep using else, I think this will work, haven't tested.
Code:
else
{
@SpellList = ("Dead Men Floating");
@SpellCost = ("10");
@SpellID =   ("1391");
}
Reply With Quote
  #3  
Old 02-12-2013, 04:56 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

No syntax error with this, haven't tested it in the game, but here you go:

Code:
sub EVENT_SPAWN {
my $Ench = ($npc->GetClass() == 'Enchanter');
my $Necro = ($npc->GetClass() == 'Necromancer');

if ($npc->GetClass() == 'Enchanter') {
@SpellList = ("Bind Affinity","Breeze","Clarity","Clarity II","Alacrity","Augment","Aanya's Quickening","Rune I");
@SpellCost = ("10","25","50","200","10","30","100","5");
@SpellID =   ("35","697","174","1693","170","1729","1708","481");

}

else {
@SpellList = ("Dead Men Floating");
@SpellCost = ("10");
@SpellID =   ("1391");
}

}


sub EVENT_SAY {
my $buffs = quest::saylink("buffs", 1);
my $NPCName = $npc->GetCleanName();
if ($text =~/Hail/i) {
$client->Message(315, "Chip Chip $name, Do you need some $buffs?'");
}

my $count = 1;
my $n = 0;

if (($text=~/Hail/i)&& ($Ench)) {
	while ($SpellList[$n]) {
		if ((lc($SpellList[$n]) =~ lc($text) && lc($SpellList[$n]) ne lc($text)) || ($text =~ /^buffs$/i)) {
		my $SpellList = quest::saylink($SpellList[$n]);
		$client->Message(315, "These are your choices, $SpellList");
		}
			if (lc($SpellList[$n]) eq lc($text) && $text !~ /^buffs$/i) {
			quest::setglobal("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
		}
	}


elsif (($text=~/Hail/i) && ($Necro)) {
	while ($SpellList[$n]) {
		if ((lc($SpellList[$n]) =~ lc($text) && lc($SpellList[$n]) ne lc($text)) || ($text =~ /^buffs$/i)) {
		my $SpellList = quest::saylink($SpellList[$n]);
		$client->Message(315, "These are your choices, $SpellList");
		}
			if (lc($SpellList[$n]) eq lc($text) && $text !~ /^buffs$/i) {
			quest::setglobal("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
		}
	}
}
Reply With Quote
  #4  
Old 02-12-2013, 05:58 PM
Figback65
Discordant
 
Join Date: Aug 2009
Location: 2131231231
Posts: 255
Default

[QUOTE=Zamthos;218075]Why'd you do this?: Shouldn't it be elsif? Just try using the syntax checker, errors below. I pasted exactly what you posted and got those errors, nothing extra, nothing less.
Code:
else ($npc->GetClass == 'Necromancer') {
@SpellList = ("Dead Men Floating");
@SpellCost = ("10");
@SpellID =   ("1391");
}
I can use elsif, I am still learning. I will be adding more classes than enchanter and necro, but this was just a starting point.

I tested it with elsif and if neither worked, the NPC doesnt talk so I think im missing a link calling the proper list somewhere down in sub EVENT_SAY but im still tryen to find it lol
Here is with 3 class options for more clarification.

Code:
sub EVENT_SPAWN {
my $Ench = ($npc->GetClass() == 'Enchanter');
my $Necro = ($npc->GetClass() == 'Necromancer');
my $Cleric = ($npc->GetClass() == 'Cleric');

if ($npc->GetClass() == 'Enchanter') {
@SpellList = ("Bind Affinity","Breeze","Clarity","Clarity II","Alacrity","Augment","Aanya's Quickening","Rune I");
@SpellCost = ("10","25","50","200","10","30","100","5");
@SpellID =   ("35","697","174","1693","170","1729","1708","481");
}

if ($npc->GetClass == 'Necromancer') {
@SpellList = ("Dead Men Floating");
@SpellCost = ("10");
@SpellID =   ("1391");
}

if ($npc->GetClass == 'Cleric') {
@SpellList = ("Daring");
@SpellCost = ("5");
@SpellID =   ("89");
}

}
__________________
Reply With Quote
  #5  
Old 02-12-2013, 09:10 PM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

Hiya Fig,

Related post about dealing with class types: http://www.eqemulator.org/forums/showthread.php?t=35970
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
Reply With Quote
  #6  
Old 02-12-2013, 10:23 PM
Figback65
Discordant
 
Join Date: Aug 2009
Location: 2131231231
Posts: 255
Default

Quote:
Originally Posted by Drajor View Post
Hiya Fig,

Related post about dealing with class types: http://www.eqemulator.org/forums/showthread.php?t=35970
Thank you for the post.

My problem currently is Having the EVENT_SAY check what class the buffnpc spawned as, then selecting the correct spelllist based on the class. Then all in all, the correct syntax so it works. I am reading your post thoroughly to see if I typed something wrong on calling the classes.

TY!!!
__________________
Reply With Quote
  #7  
Old 02-14-2013, 12:35 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

Code:
use 5.012;
use warnings;

package NPC;

sub new {
    my ( $class, %param ) = ( shift, @_ );
    $param{_class} = 14;
    return bless \%param, $class;
}

sub GetClass {
    shift->{_class};
}

package main;

my $npc = NPC->new();

# array of playable class long names
use constant CLASS_L => qw(
  Unknown Warrior Cleric Paladin Ranger Shadowknight Druid Monk Bard Rogue
  Shaman Necromancer Wizard Magician Enchanter Beastlord Berserker
);

# hashref containing buffs offered depening on the class of the npc
my $buff = {
    Enchanter => [
        [ "Bind Affinity",      35,   10 ],
        [ "Breeze",             697,  25 ],
        [ "Clarity",            174,  50 ],
        [ "Clarity II",         1693, 200 ],
        [ "Alacrity",           170,  10 ],
        [ "Augment",            1729, 30 ],
        [ "Aanya's Quickening", 1708, 100 ],
        [ "Rune I",             481,  5 ],
    ],
    Necromancer => [ [ "Dead Men Floating", 1391, 10 ], ],
};

# this is what the client said (used to search available buffs)
my $text = "la";

# this is how we find out long name of the class the npc is
my $mclass = (CLASS_L)[ $npc->GetClass() ];

# this searches the array of available buffs and returns only those that match
foreach my $spell ( grep { ${$_}[0] =~ /$text/i } @{ $buff->{$mclass} } ) {
    my ( $spellName, $spellID, $spellCost ) = @{$spell};
    say "I can cast $spellName [$spellID] on you for $spellCost platinum.";
}
results:

Code:
I can cast Clarity [174] on you for 50 platinum.
I can cast Clarity II [1693] on you for 200 platinum.
I can cast Alacrity [170] on you for 10 platinum.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #8  
Old 02-14-2013, 01:32 PM
Figback65
Discordant
 
Join Date: Aug 2009
Location: 2131231231
Posts: 255
Default

Awsome c0ncrete!!! I am going to test that out right now! Here is the script me and Ghanja was working on as well. I got the npcs to respond to hail's with the proper class response but calling the correct spell list was not working... lol. Here is that script of a mess.

Code:
use strict;
no strict 'vars';
use warnings;


sub EVENT_SAY {
my $Necro = {
            @spelllist	=>	["Bind Affinity","Dead Men Floating"],
            @spellcost	=>	[10,10],
			@spellid	=>	[35,1391],
        },
my $Ench = {
            @spelllist	=>	["Bind Affinity","Breeze","Clarity","Clarity II","Alacrity","Augment","Aanya's Quickening","Rune I"],
            @spellcost	=>	[10,25,50,200,10,30,100,5],
			@spellid	=>	[35,697,174,1693,170,1729,1708,481],
        },
my $Magi = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Wiz = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Rog = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Ranger = {
            @spelllist	=>	["Bind Affinity",],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Druid = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Shaman = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Cleric = {
            @spelllist	=>	["Bind Affinity","Daring"],
            @spellcost	=>	[10,5],
			@spellid	=>	[35,89],
        },
my $SK = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Paladin = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Ber = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Bst = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $War = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
my $Bard = {
            @spelllist	=>	["Bind Affinity"],
            @spellcost	=>	[10],
			@spellid	=>	[35],
        },
	
my $cleanclass = $npc->GetClass();
 
 
if ($text=~/hail/i) {
my $buffs = quest::saylink("buffs", 1);
my $NPCName = $npc->GetCleanName();
my $count = 1;
my $n = 0;

	if($cleanclass eq 11) {
	$client->Message(315, "Souls and $buffs.'");
	while ($Necro[$n]) {
		if ((lc($Spelllist[$n]) =~ lc($text) && lc($Spelllist[$n]) ne lc($text)) || ($text =~ /^buffs$/i)) {
		my $Spelllist = quest::saylink($Spelllist[$n]);
		$client->Message(315, "These are your choices, $buffs");
		}
 			if (lc($Spelllist[$n]) eq lc($text) && $text !~ /^buffs$/i) {
			quest::setglobal("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
			}
	}

	elsif ($cleanclass eq 14) {
	quest::say("I have the $buffs for your mind.");
	while ($Ench[$n]) {
	if ((lc($Ench[$n]) =~ lc($text) && lc($Ench[$n]) ne lc($text)) || ($text =~ /^buffs$/i)) {
		my $Ench = quest::saylink($Ench[$n]);
		$client->Message(315, "These are your choices, $Ench");
		}
			if (lc($Ench[$n]) eq lc($text) && $text !~ /^buffs$/i) {
			quest::setglobal("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
			}
	
	
	}

	elsif ($cleanclass eq 13) {
	quest::say("I will summon you no $buffs.");
	}

	elsif ($cleanclass eq 12) {
	quest::say("Wizard $buffs? Hah! Where do you need to go?");
	}

	elsif ($cleanclass eq 9) {
	quest::say("shhhhhhhhhhhhhhhh!");
	}

	elsif ($cleanclass eq 4) {
	quest::say("What can I do for you naturewalker? Do you require some $buffs?");
	}

	elsif ($cleanclass eq 6) {
	quest::say("I $buffs you to protect my animals!");
	}

	elsif ($cleanclass eq 10) {
	quest::say("All the best $buffs bring the best money.");
	}

	elsif ($cleanclass eq 2) {
	quest::say("Heals? $buffs?");
	while ($Cleric[$n]) {
		if ((lc($Cleric[$n]) =~ lc($text) && lc($Cleric[$n]) ne lc($text)) || ($text =~ /^buffs$/i)) {
		my $Cleric = quest::saylink($Cleric[$n]);
		$client->Message(315, "These are your choices, $SpellList");
		}
			if (lc($Cleric[$n]) eq lc($text) && $text !~ /^buffs$/i) {
			quest::setglobal("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
			}
	}

	elsif ($cleanclass eq 5) {
	quest::say("No $buffs here, only death!");
	}

	elsif ($cleanclass eq 3) {
	quest::say("Do you need protection my child or some $buffs?");
	}

	elsif ($cleanclass eq 16) {
	quest::say(".......");
	}

	elsif ($cleanclass eq 15) {
	quest::say("Paragon, Feral, $buffs");
	}

	elsif ($cleanclass eq 1) {
	quest::say("Kidding, right?");
	}

	elsif ($cleanclass eq 8) {
	quest::say("La Ti Da Ti");
	}


}



}
__________________
Reply With Quote
  #9  
Old 02-14-2013, 02:28 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

No no, ghanja wasn't working on that one bud.

Code:
my $buffs = {
        enchanter => {
            spelllist	=>	["Bind Affinity","Breeze","Clarity","Clarity II","Alacrity","Augment","Aanya's Quickening","Rune I"],
            spellcost	=>	[10,25,50,200,10,30,100,5],
			spellid		=>	[35,697,174,1693,170,1729,1708,481]
        },
        necromancer => {
            spelllist	=>	["Dead Men Floating"],
            spellcost	=>	[10],
			spellid		=>	[1391]
        },
    };
Should be in the last one we were working on. However, the use of grep you may be better off with.

Now using the above and the references I pointed out the other night, tie it all together.
Reply With Quote
  #10  
Old 02-14-2013, 03:25 PM
Figback65
Discordant
 
Join Date: Aug 2009
Location: 2131231231
Posts: 255
Default

Cool, thanks very much guys, ill work on it for a few days and then update!
__________________
Reply With Quote
  #11  
Old 02-14-2013, 03:31 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

Code:
use 5.012;
no strict 'vars';
use warnings;

### IGNORE EVERYTHING BELOW HERE ###

package NPC;

sub new {
    my ( $class, %param ) = ( shift, @_ );
    $param{_class} = 14;
    return bless \%param, $class;
}

sub GetClass {
    shift->{_class};
}

package main;

my $npc = NPC->new();

sub quest::saylink {
    shift;
}

sub quest::say {
    say shift;
}

# this is what the client said (used to search available buffs)
my $text = "Clarity II";

### IGNORE EVERYTHING ABOVE HERE ###

# array of playable class long names
use constant CLASS_L => qw(
  Unknown Warrior Cleric Paladin Ranger Shadowknight Druid Monk Bard Rogue
  Shaman Necromancer Wizard Magician Enchanter Beastlord Berserker
);

# saylink
my $buffs = quest::saylink( "buffs", 1 );

# hashref containing buffs offered depening on the class of the npc
my $data = {
    Enchanter => {
        greet => "I have the $buffs for your mind.",
        buffs => [
            [ "Bind Affinity",      35,   10 ],
            [ "Breeze",             697,  25 ],
            [ "Clarity",            174,  50 ],
            [ "Clarity II",         1693, 200 ],
            [ "Alacrity",           170,  10 ],
            [ "Augment",            1729, 30 ],
            [ "Aanya's Quickening", 1708, 100 ],
            [ "Rune I",             481,  5 ],
        ],
    },
    Necromancer => {
        greet => "Souls and $buffs.",
        buffs => [
            [ "Bind Affinity", 35, 10 ],
            [ "Dead Men Floating", 1391, 10 ],
        ],
    },
};

# get class-specific stuff for this npc
my $npcClass = (CLASS_L)[ $npc->GetClass() ];
my $greeting = $data->{$npcClass}->{greet};
my $buffList = $data->{$npcClass}->{buffs};

sub EVENT_SAY {
    if ( $text =~ /hail/i ) {
        quest::say($greeting);
        return;
    }
    given ( [ grep { ${$_}[0] =~ /$text/i } @{$buffList} ] ) {

        # one exact match (probably clicked on saylink in list)
        when ( @{$_} == 1 && $text eq ${$_}[0][0] ) {
            say "That will be ${$_}[0][2]pp for ${$_}[0][0].";
        }

        # client typed targeted text that did not match hail and
        # more than one available spell name matched recieved text
        # TODO: create saylinks
        when ( @{$_} > 1 ) {
            foreach my $spell ( @{$_} ) {
                my ( $spellName, $spellID, $spellCost ) = @{$spell};
                say "I can cast $spellName on you for ${spellCost}pp.";
            }
        }
    }
}

### IGNORE EVERYTHING BELOW HERE ###

EVENT_SAY();
you can change the value of $text in this and run it outside of the emulator to see the results.
change $param{_class} to whatever class you want the npc to be.

nyquil is kicking in. you're on your own for a bit...
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #12  
Old 02-14-2013, 04:32 PM
Figback65
Discordant
 
Join Date: Aug 2009
Location: 2131231231
Posts: 255
Default

Quote:
Originally Posted by c0ncrete View Post

change $param{_class} to whatever class you want the npc to be.

The NPC is in a spawngroup of multiple classes. So when it dies or respawns, the script will determine which class it spawned as and set the spell list for that class....
$param{_class} = $npc->GetClass(); ?

Now by your comment, are you suggesting that I need to change it manually in the script to force a spell list, by the way you have coded it.

This is the 1st time I have seen packages and some syntax you are using, I am googling and researching all I can to understand what you have given. Going to need some time to learn all of this lol.

Edit: And hash tables
__________________

Last edited by Figback65; 02-14-2013 at 04:34 PM.. Reason: Hash
Reply With Quote
  #13  
Old 02-14-2013, 04:54 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

there is a reason i put the comments about ignoring what was above and below a certain point....

the code within those areas was just put there to emulate the behavior of the script being run via the server. if you were to run this script as it is written from a command prompt, you will see a near identical example of how it would work from inside the game. i was letting you know the things you would need to change if you were running it outside of the game so you could see the different results, depending upon a given scenario (client said / npc class is).

to get it to work in the game, you'd remove the lines that are inside the areas designated for you to ignore and change the remaining say lines to quest::say(), $client->Message(), or whatever other message delivery function you would want to use.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #14  
Old 02-14-2013, 06:03 PM
Figback65
Discordant
 
Join Date: Aug 2009
Location: 2131231231
Posts: 255
Default

Thank you for explaining, i understand. I have not done any perl outside of eqemu rofl
__________________
Reply With Quote
  #15  
Old 02-14-2013, 07:35 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

the script you're trying to modify is one of the most convoluted ones i've seen.

also, there's lots of good (and free) reading to be found here:

http://www.perl.org/books/library.html
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
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 07:41 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3