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

09-19-2009, 08:04 PM
|
Hill Giant
|
|
Join Date: May 2005
Posts: 134
|
|
server first announcements thru quest system
i'm trying to set up so that when a player hits max level on your server, and they are the first to do so, it does a server wide announcement of it.
heres what i've got so far. i have it placed in quests/templates/player.pl, but I can't get it to work for some reason. can some one take a look at it, and tell me whats wrong pls?
Code:
sub EVENT_LEVEL_UP {
my $maxlvl = 50
if(!defined($qglobals{warmaxlvl}) && $ulevel == $maxlvl && $class eq 'Warrior') {
quest::setglobal("warmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel warrior!");
}
if(!defined($qglobals{clrmaxlvl}) && $ulevel == $maxlvl && $class eq 'Cleric') {
quest::setglobal("clrmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel cleric!");
}
if(!defined($qglobals{palmaxlvl}) && $ulevel == $maxlvl && $class eq 'Paladin') {
quest::setglobal("palmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel paladin!");
}
if(!defined($qglobals{rngmaxlvl}) && $ulevel == $maxlvl && $class eq 'Ranger') {
quest::setglobal("rngmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel ranger!");
}
if(!defined($qglobals{skmaxlvl}) && $ulevel == $maxlvl && $class eq 'ShadowKnight') {
quest::setglobal("skmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel shadow knight!");
}
if(!defined($qglobals{drumaxlvl}) && $ulevel == $maxlvl && $class eq 'Druid') {
quest::setglobal("drumaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel druid!");
}
if(!defined($qglobals{mkmaxlvl}) && $ulevel == $maxlvl && $class eq 'Monk') {
quest::setglobal("mkmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel monk!");
}
if(!defined($qglobals{brdmaxlvl}) && $ulevel == $maxlvl && $class eq 'Bard') {
quest::setglobal("brdmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel bard!");
}
if(!defined($qglobals{rogmaxlvl}) && $ulevel == $maxlvl && $class eq 'Rogue') {
quest::setglobal("rogmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel rogue!");
}
if(!defined($qglobals{shmmaxlvl}) && $ulevel == $maxlvl && $class eq 'Shaman') {
quest::setglobal("shmmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel shaman!");
}
if(!defined($qglobals{necmaxlvl}) && $ulevel == $maxlvl && $class 'Necromancer') {
quest::setglobal("necmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel necromancer!");
}
if(!defined($qglobals{wizmaxlvl}) && $ulevel == $maxlvl && $class eq 'Wizard') {
quest::setglobal("wizmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel wizard!");
}
if(!defined($qglobals{magmaxlvl}) && $ulevel == $maxlvl && $class eq 'Magician') {
quest::setglobal("magmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel magician!");
}
if(!defined($qglobals{encmaxlvl}) && $ulevel == $maxlvl && $class eq 'Enchanter') {
quest::setglobal("encmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel enchanter!");
}
if(!defined($qglobals{bstmaxlvl}) && $ulevel == $maxlvl && $class eq 'Beastlord') {
quest::setglobal("bstmaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel beastlord!");
}
if(!defined($qglobals{bermaxlvl}) && $ulevel == $maxlvl && $class eq 'Berserker') {
quest::setglobal("bermaxlvl",1,2,"F");
quest::shout2("$name has made the server first level $ulevel berserker!");
}
}
|
 |
|
 |

09-19-2009, 08:32 PM
|
 |
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
for starters, you need one more } at the very end
|

09-19-2009, 10:23 PM
|
Hill Giant
|
|
Join Date: May 2005
Posts: 134
|
|
just curious, sorry if this seems ignorant, but why do I need one more }? accordin to notepad++ the sub is closed, and every if statement is closed as well.
|
 |
|
 |

09-19-2009, 10:42 PM
|
 |
Legendary Member
|
|
Join Date: Apr 2002
Location: Seattle, WA
Posts: 506
|
|
Instead of copy pasting the code 15 times, you could do something like this:
Code:
sub EVENT_LEVEL_UP {
my $maxlvl = 50;
my @classlist = ("Warrior", "Cleric", "Paladin", "Ranger", "ShadowKnight", "Druid", "Monk", "Bard", "Rogue", "Shaman", "Necromancer", "Wizard", "Magician", "Enchanter", "Beastlord", "Berserker");
foreach my $curclass (@classlist) {
if(!defined($qglobals{$curclass."maxlvl"}) && $ulevel == $maxlvl && $curclass eq $class) {
quest::setglobal($curclass."maxlvl",$name,2,"F");
quest::shout2("$name has made the server first level $ulevel $class!");
return;
}
}
}
I think that may work. I'm storing the player's name in the variable instead of just a boolean flag in hopes that who knows, one day $pglobal will be loadable on NPC's.
If that ever occurs, I wrote a reporter NPC too, $qglobals are a little weird scope wise, NPC's don't load no NPC ID vars (aka Player vars). I may ask the coders to add a $pglobal that when you talk to a NPC, it loads non-NPC ID globals for the zone are loaded into $pglobal{}. Would be handy for this situation, and I can think of a few others.
This code doesn't work, but I wrote it anyways if the theory of player global vars non-NPC specific ever get written in.
Code:
sub EVENT_SAY
{
if ($text=~/Hail/i) { #Initial Hail
my @classlist = ("Warrior", "Cleric", "Paladin", "Ranger", "ShadowKnight", "Druid", "Monk", "Bard", "Rogue", "Shaman", "Necromancer", "Wizard", "Magician", "Enchanter", "Beastlord", "Berserker");;
my $buffer = "";
foreach my $curclass (@classlist) {
$buffer = $buffer . $pglobals{$curclass."maxlvl"} . " [$curclass], " if (defined($qglobals{$curclass."maxlvl"}));
if (defined($qglobals{Bardmaxlvl})) { $buffer = $buffer . $pglobals{Bardmaxlvl} . " [$curclass], "; }
}
if (length($buffer) > 3) {
$buffer = substr $buffer, 0, length($buffer)-3;
quest::say("Server First Classes: " . $buffer);
}
quest::say("end");
}
}
|
 |
|
 |
 |
|
 |

09-19-2009, 10:57 PM
|
Hill Giant
|
|
Join Date: May 2005
Posts: 134
|
|
Quote:
Originally Posted by Shin Noir
Instead of copy pasting the code 15 times, you could do something like this:
Code:
sub EVENT_LEVEL_UP {
my $maxlvl = 50;
my @classlist = ("Warrior", "Cleric", "Paladin", "Ranger", "ShadowKnight", "Druid", "Monk", "Bard", "Rogue", "Shaman", "Necromancer", "Wizard", "Magician", "Enchanter", "Beastlord", "Berserker");
foreach my $curclass (@classlist) {
if(!defined($qglobals{$curclass."maxlvl"}) && $ulevel == $maxlvl && $curclass eq $class) {
quest::setglobal($curclass."maxlvl",$name,2,"F");
quest::shout2("$name has made the server first level $ulevel $class!");
return;
}
}
}
I think that may work. I'm storing the player's name in the variable instead of just a boolean flag in hopes that who knows, one day $pglobal will be loadable on NPC's.
|
I put this in to quests/template/player.pl. restarted server, and still nothing, makes me feel like i'm not putting this in the correct spot, or that #level 50 isn't triggering the sub EVENT_LEVEL_UP. idk which, any enlightenment would be appreciated.
|
 |
|
 |

09-19-2009, 11:42 PM
|
 |
Legendary Member
|
|
Join Date: Apr 2002
Location: Seattle, WA
Posts: 506
|
|
It should. There may be an issue with scripts in the zone folder conflicting with the templates folder, just for testing try to put the player.pl inside the zone you're inside, and #reloadpl
|

09-19-2009, 11:52 PM
|
 |
Legendary Member
|
|
Join Date: Apr 2002
Location: Seattle, WA
Posts: 506
|
|
Some quest coder should help me out here.. I'm not very familiar with it. :/ but!
LoadPlayerScript() function in embparser.cpp
it does this whole..
Code:
string filename= "quests/";
filename += zone;
filename += "/player.pl";
string packagename = "player";
packagename += "_";
packagename += zone;
build of the quests\zone\player.pl directory.. tries to eval it
Code:
try {
perl->eval_file(packagename.c_str(), filename.c_str());
}
then if it doesn't load,
Code:
if(!isloaded(packagename.c_str()))
{
filename = "quests/";
filename += QUEST_TEMPLATES_DIRECTORY;
filename += "/player.pl";
try templates. So if I'm not corrected, if a /<zone>/player.pl exists, it stops the parser from loading /templates/player.pl?
|

09-20-2009, 07:07 AM
|
Hill Giant
|
|
Join Date: May 2005
Posts: 134
|
|
Quote:
Originally Posted by Shin Noir
Some quest coder should help me out here.. I'm not very familiar with it. :/ but!
LoadPlayerScript() function in embparser.cpp
it does this whole..
Code:
string filename= "quests/";
filename += zone;
filename += "/player.pl";
string packagename = "player";
packagename += "_";
packagename += zone;
build of the quests\zone\player.pl directory.. tries to eval it
Code:
try {
perl->eval_file(packagename.c_str(), filename.c_str());
}
then if it doesn't load,
Code:
if(!isloaded(packagename.c_str()))
{
filename = "quests/";
filename += QUEST_TEMPLATES_DIRECTORY;
filename += "/player.pl";
try templates. So if I'm not corrected, if a /<zone>/player.pl exists, it stops the parser from loading /templates/player.pl?
|
curiousity question, if I were to just take this code, and make it so it loads both player.pl, what would be wrong with that?
|

09-21-2009, 03:16 AM
|
Hill Giant
|
|
Join Date: May 2005
Posts: 134
|
|
anyone have a solution for this that doesn't involve copying and pasting into the 20 somethin odd player.pl's in the quest folder? and i'm still wondering what would happen if the source was changed to allow to load both, the player.pl's that are in the zone folders, as well as the templates one.
|

09-19-2009, 11:56 PM
|
Hill Giant
|
|
Join Date: May 2005
Posts: 134
|
|
did as suggested, tried it with the guild lobby, cut/paste the player.pl and #reloadpl, and worked. cut/paste back into templates folder, #reloadpl, doesn't work. now what I don't understand is there isn't anything in the guild lobby folder, cept the guildhall instance creation script, so i'm not seeing what would be conflicting with the EVENT_LEVEL_UP. btw is there a way to broadcast, instead of having "$name shouts, blah blah blah". was looking more for a system msg world wide, then having the player shout it world wide.
|

09-20-2009, 12:30 AM
|
 |
Legendary Member
|
|
Join Date: Apr 2002
Location: Seattle, WA
Posts: 506
|
|
Try $client->Message(13, "Message here");
|

09-20-2009, 12:37 AM
|
 |
Legendary Member
|
|
Join Date: Apr 2002
Location: Seattle, WA
Posts: 506
|
|
I really hate that 5 minute edit limit. So new post!
I'm working on a quest cheat sheet wiki. Not newb friendly, but a good quick reference is my objective.
This link should go to the $client->function() section, the message one and show the different color types noted in source.
|

09-20-2009, 12:55 AM
|
Hill Giant
|
|
Join Date: May 2005
Posts: 134
|
|
does $client->Message() broadcast worldwide, or just to the client that triggered the event?
|

09-22-2009, 11:32 AM
|
Fire Beetle
|
|
Join Date: Aug 2009
Location: LA
Posts: 12
|
|
Quote:
Originally Posted by nightsta69
does $client->Message() broadcast worldwide, or just to the client that triggered the event?
|
The client that triggered.
quest::we(type, "message"); should work. This is world emote.
|

09-22-2009, 11:44 AM
|
Hill Giant
|
|
Join Date: May 2005
Posts: 134
|
|
ah there we go, thats what i've been lookin for, thanx alot.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 03:18 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |