Player.pl question
I an working on an event that covers several zones.
I am using Player.pl to detect the player level. Through signals (determined by the player level) A signal is sent to a zone controller. Zone controller depops a few NPC's and spawns NPC's of the correct level. All the above works as it should. Now he question. Since this happens in several zones, I am unsure of what to do with the player .pl Should I take all signals from every zone and place them all in a single player.pl? ( it would end up being about 5000 lines of code ( 100 lines of code per zone and there are 50 effected zones). If it all needs to go in one player.pl is there a way to sub devide the code by zone so it wont be looking through 5000 lines to find a match? Maybe something like this? Code:
sub EVENT_ZONE { if (zonen == "butcher") { line Or can each zone have a specific player.pl that only effects that zone? |
you can have a player.pl for each zone, yes.
|
ok that idea got shot to hell.
There is a player.pl in templates that is rather important in the newbie zones. Some of this takes place in newbie zones so I can not write a specific player.pl for those zones. Looking through commands (perl reference) I see that there is a sub EVENT_ENTERZONE and a sub EVENT_ZONE Could I use both of these in the same player.pl? sub EVENT_ENTERZONE is already being used and I dont want to break anything in that section. If so I could use sub_EVENTZONE for what I need in the templet for the newbie zones and use a separate player.pl for the other zones. |
Yes, you can use both in the same script, but they do different things. ZONE fires any time any player zones (via Client::Handle_OP_ZoneChange()). ENTERZONE only fires on entering a zone (via Client::CompleteConnect()).
It should be simple enough to put a conditional in any EVENT that you are worried about adding to, and then have it call an external, custom subroutine or collection of them. Also, you are able to call external files from your scripts via perl's 'do', that way you can keep all of your individual zone files separate, even if they're all in the same folder. Code:
# current full working directory |
ok that might work as far as the player.pl issue.
I have one further question. The whole purpose for using player.pl is so I can determine the player level. Lets say I add Event_Zone in the original player.pl (the one in templates). From your snippet, it signals the individual zone controller and it carries out the functions. How do I pass along the user level info to the zone controller? Am I back to 1000 lines because every 5 levels is a different signal? For sake of argument. I would prefere the player .pl (in templates using EVENT_ZONE) to sense what zone and player level then pass both of those on to the zone controller. Is it possible? Aardil |
You can pass any information on to the external script via the use of @ARGV, as shown below.
Code:
my $player = "YoMomma"; Code:
print $ARGV[0]; Code:
YoMomma |
All times are GMT -4. The time now is 02:59 AM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.