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-10-2015, 11:41 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Yeah, "my" basically makes the variable only valid within the current block of code. If you remove the "my", then it can global to the whole script. Using "my" outside of a block (such as sub EVENT or anything with brackets) will just not let it work properly by perl design. I am not exactly sure why it even works for a single NPC, but either way it is not recommended.

When you have a static array like that which isn't being altered in the script, it is fine to define it outside of the subs as long as you leave off the "my". However, if you have a variable outside of the subs that does get modified by the script, it can effect all NPCs that use that same script since it is global.

It can sometime be tricky to get the right results when working with stuff like default.pl which will be applied to a large number of NPCs. Understanding the functionality of "my" and global variables can help a lot.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 05-16-2018, 06:20 PM
swansona65
Fire Beetle
 
Join Date: Oct 2013
Posts: 11
Default File

Where do you save this .pl file i cant seem to get it to spawn loot on npcs? I currently have it saved as default.pl in the /quests/crushbone folder
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 04:36 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