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 03-12-2015, 09:57 PM
Twilightmist
Fire Beetle
 
Join Date: Feb 2015
Location: California
Posts: 11
Default Player.pl and Player.lua - can they coexist?

I was playing around with global server wide quests last night, and wanted to run a simple test in player.pl to write some text when a character levels up. I named the file global_player.pl and put it in the global quest directory. There is a global_player.lua file in there already. When the character leveled, the text did not display. The code was your example sample player quest code:

sub EVENT_LEVEL_UP {
$client->Message(15, "You've leveled up, you are now $ulevel, perhaps you should go adventure elsewhere now.");
}

My question is, does only one of these files take presidence? I don't want to disturb the .lua file there because it looks like it adds adventure text I would like to see.

The reason for asking is my goal is to have a quest that scribes players spells when they level up. Is player.pl the place to put such a quest? Can someone suggest an alternative?

Thanks!
Reply With Quote
  #2  
Old 03-12-2015, 10:28 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by Twilightmist View Post
I was playing around with global server wide quests last night, and wanted to run a simple test in player.pl to write some text when a character levels up. I named the file global_player.pl and put it in the global quest directory. There is a global_player.lua file in there already. When the character leveled, the text did not display. The code was your example sample player quest code:

sub EVENT_LEVEL_UP {
$client->Message(15, "You've leveled up, you are now $ulevel, perhaps you should go adventure elsewhere now.");
}

My question is, does only one of these files take presidence? I don't want to disturb the .lua file there because it looks like it adds adventure text I would like to see.

The reason for asking is my goal is to have a quest that scribes players spells when they level up. Is player.pl the place to put such a quest? Can someone suggest an alternative?

Thanks!
Yes, if there is a LUA equivalent to a particular type of quest file (in your case the global_player) then, it has precedence over PL (perl).

So you have two options. Remove the LUA version (or rename it to, say, global_player.lu$) or learn LUA and use it and/or Perl (though knowing what I stated above).
Reply With Quote
  #3  
Old 03-13-2015, 06:57 AM
dagulus2
Hill Giant
 
Join Date: Feb 2013
Posts: 220
Default

It is a bit of a pain tbh. Global_player is probably the one place where it would be nice if there was some sort of workaround allowing you to somehow use both.
Reply With Quote
  #4  
Old 03-13-2015, 11:53 AM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by dagulus2 View Post
It is a bit of a pain tbh. Global_player is probably the one place where it would be nice if there was some sort of workaround allowing you to somehow use both.
But why?

/10char
Reply With Quote
  #5  
Old 03-13-2015, 12:27 PM
Twilightmist
Fire Beetle
 
Join Date: Feb 2015
Location: California
Posts: 11
Default

Thank you for the answers. I suspected this is what was happening. As to "Why" we would like to use both is because learning Perl is probably enough for a beginner in programming, without having to learn Lua too.

This is a great opportunity to learn some basic programming skills, using a medium I love (Everquest) but it is a little overwhelming at first.
Reply With Quote
  #6  
Old 03-13-2015, 12:34 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,071
Default

Quote:
Originally Posted by Twilightmist View Post
Thank you for the answers. I suspected this is what was happening. As to "Why" we would like to use both is because learning Perl is probably enough for a beginner in programming, without having to learn Lua too.

This is a great opportunity to learn some basic programming skills, using a medium I love (Everquest) but it is a little overwhelming at first.
Perl is the master race.
Reply With Quote
  #7  
Old 03-13-2015, 01:14 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by Twilightmist View Post
Thank you for the answers. I suspected this is what was happening. As to "Why" we would like to use both is because learning Perl is probably enough for a beginner in programming, without having to learn Lua too.

This is a great opportunity to learn some basic programming skills, using a medium I love (Everquest) but it is a little overwhelming at first.
I thought you may have had a technical reason for the request. Something that perhaps some coding assistance may have allowed you to overcome. I understand the "why" now to mean, you would have liked both perl and lua versions to be provided in which to learn from. So.

Here is the (older) Perl global_player.pl:

Code:
sub EVENT_ENTERZONE {
  if($ulevel >= 15 && !defined($qglobals{Wayfarer}) && $client->GetStartZone()!=$zoneid && $zoneid !=50 && $zoneid !=12) {
    $client->Message(15,"A mysterious voice whispers to you, 'If you can feel me in your thoughts, know this -- something is changing in the world and I reckon you should be a part of it. I do not know much, but I do know that in every home city and the wilds there are agents of an organization called the Wayfarers Brotherhood. They are looking for recruits . . . If you can hear this message, you are one of the chosen. Rush to your home city, or search the West Karanas and Rathe Mountains for a contact if you have been exiled from your home for your deeds, and find out more. Adventure awaits you, my friend.'");
  }
}

sub EVENT_COMBINE_SUCCESS
{
    if ($recipe_id =~ /^1090[4-7]$/) {
        $client->Message(1,
            "The gem resonates with power as the shards placed within glow unlocking some of the stone's power. ".
            "You were successful in assembling most of the stone but there are four slots left to fill, ".
            "where could those four pieces be?"
        );
    }
    elsif ($recipe_id =~ /^10(903|346|334)$/) {
        my %reward = (
            melee  => {
                10903 => 67665,
                10346 => 67660,
                10334 => 67653
            },
            hybrid => {
                10903 => 67666,
                10346 => 67661,
                10334 => 67654
            },
            priest => {
                10903 => 67667,
                10346 => 67662,
                10334 => 67655
            },
            caster => {
                10903 => 67668,
                10346 => 67663,
                10334 => 67656
            }
        );
        my $type = plugin::ClassType($class);
        quest::summonitem($reward{$type}{$recipe_id});
        quest::summonitem(67704);
        $client->Message(1,"Success");
    }
}
Reply With Quote
  #8  
Old 03-13-2015, 01:25 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Actually, now looking at the new global_player.lua, perhaps this code would more closely resemble the way it works:

Code:
sub EVENT_ENTERZONE {
	if (($ulevel >= 15) && (!defined($qglobals{Wayfarer}))) {
		my @wayfarerzones = [1,2,3,8,9,10,19,22,23,24,29,30,34,35,40,41,42,45,49,52,54,55,60,61,62,67,68,75,82,106,155,202,382,383,392,393,408];
		if ($client->GetStartZone()!=$zoneid && $zoneid ~~ @wayfarerzones) {
			$client->Message(15,"A mysterious voice whispers to you, 'If you can feel me in your thoughts, know this -- ".
								"something is changing in the world and I reckon you should be a part of it. I do not know much, ".
								"but I do know that in every home city and the wilds there are agents of an organization called the ".
								"Wayfarers Brotherhood. They are looking for recruits . . . If you can hear this message, you are ".
								"one of the chosen. Rush to your home city, or search the West Karanas and Rathe Mountains for a ".
								"contact if you have been exiled from your home for your deeds, and find out more. Adventure awaits you, my friend.'");
		}
	}
}
Untested, as every server I've helped with has ripped out the entire WB functionality.

Last edited by ghanja; 03-14-2015 at 12:20 PM.. Reason: Missing ampersand in code
Reply With Quote
  #9  
Old 03-13-2015, 01:40 PM
Twilightmist
Fire Beetle
 
Join Date: Feb 2015
Location: California
Posts: 11
Default

Yes, that's exactly the reason! Thanks for the code. I will try it out and let you know.

Hey Akkadius, you work on the EZ server, right? How was the spell scribing when you level implemented there? I thought that was a great feature.
Reply With Quote
  #10  
Old 03-13-2015, 01:50 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

There are at least two posts showing such level up examples. Here is just one thread:

http://www.eqemulator.org/forums/showthread.php?t=36263
Reply With Quote
  #11  
Old 03-13-2015, 02:48 PM
Twilightmist
Fire Beetle
 
Join Date: Feb 2015
Location: California
Posts: 11
Default

Perfect, thanks ghanja!
Reply With Quote
  #12  
Old 03-14-2015, 05:51 AM
dagulus2
Hill Giant
 
Join Date: Feb 2013
Posts: 220
Default

Quote:
Originally Posted by ghanja View Post
Actually, now looking at the new global_player.lua, perhaps this code would more closely resemble the way it works:

Code:
sub EVENT_ENTERZONE {
	if ($ulevel >= 15 & !defined($qglobals{Wayfarer})) {
		my @wayfarerzones = [1,2,3,8,9,10,19,22,23,24,29,30,34,35,40,41,42,45,49,52,54,55,60,61,62,67,68,75,82,106,155,202,382,383,392,393,408];
		if ($client->GetStartZone()!=$zoneid && $zoneid ~~ @wayfarerzones) {
			$client->Message(15,"A mysterious voice whispers to you, 'If you can feel me in your thoughts, know this -- ".
								"something is changing in the world and I reckon you should be a part of it. I do not know much, ".
								"but I do know that in every home city and the wilds there are agents of an organization called the ".
								"Wayfarers Brotherhood. They are looking for recruits . . . If you can hear this message, you are ".
								"one of the chosen. Rush to your home city, or search the West Karanas and Rathe Mountains for a ".
								"contact if you have been exiled from your home for your deeds, and find out more. Adventure awaits you, my friend.'");
		}
	}
}
Untested, as every server I've helped with has ripped out the entire WB functionality.
Brings up the feedback message '[Quests] Possible precedce problem on bitwise & operator at quests/global/global_player.pl line 2.'
Reply With Quote
  #13  
Old 03-14-2015, 11:48 AM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by dagulus2 View Post
Brings up the feedback message '[Quests] Possible precedce problem on bitwise & operator at quests/global/global_player.pl line 2.'
Put your global_player.pl in code blocks so we can look at it.
Reply With Quote
  #14  
Old 03-14-2015, 12:10 PM
dagulus2
Hill Giant
 
Join Date: Feb 2013
Posts: 220
Default

Currently:

Code:
###EQ20 global_player file, based on code by ghanja, Kingly_Krab, spyyder

sub EVENT_ENTERZONE {
	if (quest::istaskcompleted(9999) == 0 && quest::istaskactive(9999) == 0) #Check if completed Task: Welcome to EQ20
	{
    	quest::assigntask(9999); #Force assign Task: Welcome to EQ20
		}
	if ($ulevel >= 15 & !defined($qglobals{Wayfarer})) {
		my @wayfarerzones = [1,2,3,8,9,10,19,22,23,24,29,30,34,35,40,41,42,45,49,52,54,55,60,61,62,67,68,75,82,106,155,202,382,383,392,393,408];
		if ($client->GetStartZone()!=$zoneid && $zoneid ~~ @wayfarerzones) {
			$client->Message(15,"A mysterious voice whispers to you, 'If you can feel me in your thoughts, know this -- ".
								"something is changing in the world and I reckon you should be a part of it. I do not know much, ".
								"but I do know that in every home city and the wilds there are agents of an organization called the ".
								"Wayfarers Brotherhood. They are looking for recruits . . . If you can hear this message, you are ".
								"one of the chosen. Rush to your home city, or search the West Karanas and Rathe Mountains for a ".
								"contact if you have been exiled from your home for your deeds, and find out more. Adventure awaits you, my friend.'");
		}
	}
}

sub EVENT_COMBINE_SUCCESS
{
    if ($recipe_id =~ /^1090[4-7]$/) {
        $client->Message(1,
            "The gem resonates with power as the shards placed within glow unlocking some of the stone's power. ".
            "You were successful in assembling most of the stone but there are four slots left to fill, ".
            "where could those four pieces be?"
        );
    }
    elsif ($recipe_id =~ /^10(903|346|334)$/) {
        my %reward = (
            melee  => {
                10903 => 67665,
                10346 => 67660,
                10334 => 67653
            },
            hybrid => {
                10903 => 67666,
                10346 => 67661,
                10334 => 67654
            },
            priest => {
                10903 => 67667,
                10346 => 67662,
                10334 => 67655
            },
            caster => {
                10903 => 67668,
                10346 => 67663,
                10334 => 67656
            }
        );
        my $type = plugin::ClassType($class);
        quest::summonitem($reward{$type}{$recipe_id});
        quest::summonitem(67704);
        $client->Message(1,"Success");
    }
}

sub EVENT_SAY {
	if($text=~/internet/i) {
	$client->SendWebLink("https://www.google.com");
	}
}

sub EVENT_DISCOVER_ITEM {
	$client->Message(335, "You discovered " . quest::varlink($itemid) . "!");
	#quest::we("$name discovered " . quest::varlink($itemid) . "!", 335, 1, 0, 0);
	#quest::crosszonemessageplayerbyname(335, "$name discovered " . plugin::varlink($itemid) . "!");
}
Feedback message is now on line 8. The feedback message was there before I added the code to assign the task.
Reply With Quote
  #15  
Old 03-14-2015, 12:19 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Replace line 8 with:
Code:
if (($ulevel >= 15) && (!defined($qglobals{Wayfarer}))) {
I mistyped and had only one ampersand.
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:32 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