Ok, working, quasi-finished product:
Code:
sub castdelay{ |
Code:
sub EVENT_SPAWN { |
I cannot immediately locate the sound file for ports, however, to give it a little flavor, you could put this before line 34 of the above code snippet (thus making it the new line 34):
Code:
$client->PlayMP3("twinkle001_loop.wav"); Code:
castdelay(5); Code:
castdelay(9); |
Congratulation on solving your puzzle. Now to tackle simplifying the code. As many have advised over the years, using an array or hash to handle multiple inputs and outputs is the best method to simplify code.
Basically you have a player /say "location" as input to the npc's EVENT_SAY subroutine, which triggers the wonderful spell animations and invis prior to porting to the various destinations as output. The inputs can be stored as a variable $playersaidthis and the outputs as a variable $portplayerhere in an associated array. Your code will have a single if statement instead of an if/elsif for every destination and be about 90% shorter. Let us know how it works and once again, congratulations on solving your perl puzzle and learning more about scripting. EDIT: haha, I forgot to hit send this morning and after I realized it this afternoon, ghanja had already posted the script I described. |
Here's my work around. This requires my plugin to be useful.
NPC Script: Code:
@zones = ("butcher", "feerrott", "northkarana", "lavastorm", "misty", "sro", "steamfont", "commons", "toxxulia"); Code:
sub EVENT_SIGNAL { |
LOL I feel like I won a prize :)
I'm about to give the array thing a try. I'm familiar with them, it's just understanding how Perl handles them. My next question was going to be can you do a case statement but I think you guys have pretty much answered that. I'll let you know how it works out :) Kingly - Your plugin looks tremendously helpful. Stupid question: How do I use it? Do I need to copy it into the script or can it reside elsewhere as its own script waiting to be called upon? |
You need to create a Perl file in your plugins folder in your server folder. Name it whatever you want. Also, Perl has switches, but it's not necessary in this situation, nor have I ever found it necessary.
|
Code:
sub EVENT_SAY { About to try KKs. This one's definitely over my head. I've read about globals and entitys but haven't messed with them yet. Also, side question brought up by the plugin thing: Could I turn this into a plugin by saving it in the plugins folder? Code:
sub castdelay{ |
KK, I'm getting a "<LINKER ERROR>" when I talk to the NPC where he would be listing the port locations. Does the players.pl need to be in plugins or part of the script? I've done something wrong apparently.
|
That 'linker' error may be part of my bailiwick..though, quests are not.
Pretty sure that kicks in when there is missing information in the text link constructor. I did test scripts to ensure that they worked when I pushed them. (EDIT: pushed the client translation version of the code) Try having the npc 'say' the information so that you can verify that wrong/null parameters are not being passed. |
Code:
quest::say("Hail! Where would you like to go?"); Side note: Code:
quest::saylink($_, 1, plugin::Zone("LN", $_)) for @zones; |
So the ghanja's code works, but it sends me to the zone safe spots rather than the druid ring. Would it make sense to add the x,y,z,h values into the $porthash array and call them in a quest::movenpc rather than a quest::zone command? Something like this:
Code:
sub EVENT_SAY { |
Here is where that text comes from: https://github.com/EQEmu/Server/blob...ient.cpp#L8394
Let me take your script home tonight to verify that it's not code-related..and hopefully someone will come up with a solution before I get back tomorrow. EDIT: Just read your last post..I'll still look it over and see where you are when I get back. |
LOL I don't think I'll make any more progress tonight. As I was reading, there are many ways to do things in Perl. I'm interested in seeing either way :) This is a learning experience for me.
|
Did you actually create a plugin file in your plugins folder in your base server folder? Mine is C:/EQ/EQEmuServer/plugins, you may have it in something like C:/EQ/EQEmuServer/quests/plugins or C:/EQ/EQEmuServer/quests/global.
Correct folder (C:/EQ/EQEmuServer/plugins): http://img.prntscr.com/img?url=http:...om/H9IZAtk.png Incorrect folder (C:/EQ/EQEmuServer/quests/plugins or C:/EQ/EQEmuServer/quests/global): http://img.prntscr.com/img?url=http:...om/CaxhTmJ.png |
All times are GMT -4. The time now is 01:42 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.