Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Bugs

Archive::Bugs Archive area for Bugs's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 02-06-2004, 11:35 PM
mollymillions's Avatar
mollymillions
Hill Giant
 
Join Date: May 2003
Posts: 176
Default

Regarding the scope of variables, i found that a variable used within a quest is available to that NPC only. Variables declared in plugins or with peval have zone wide scope (cleared when the client zones and I imagine they are all specific to the client, but i hav'nt tested this). The plugin and peval variables are restored once you re-enter that zone, somehow(?). With this knowledge i knocked up a small plugin to handle an associative array to be used for zone-wide flags.

Pugin.pl
Code:
sub get_flag { return $flags{$_[0]}; }
sub set_flag { $flags{$_[0]} = "$_[1]"; }
Use plugin::set_flag("anyname","anyvalue") to set a flag and plugin::get_flag("anyname") to return a flag. The number od flags is limited to the limit for an associative array and the flag names and values can be anything.

Test example:
Code:
sub EVENT_SAY { 
if($text=~/getflag/i){
	$flag = $text;
	$flag =~ s/(getflag)\s(\S+)/$2/;
	$flagvalue=plugin::get_flag("$flag");
	quest::say("$flag = $flagvalue"); }
if($text=~/setflag/i){ 
	$flag = $text;
	$flag =~ s/(setflag )(\S+)\s(\S+)/$2/;
	$flagvalue = $text;
	$flagvalue =~ s/(setflag )(\S+)\s(\S+)/$3/;	
	plugin::set_flag("$flag","$flagvalue"); } 
}
Say "setflag name value" and "getflag name" to test flags with this test example.

Is it possible to declare a variable that will have world -wide and/or client-wide scope?

Also, do the Devs want us users to test the Perl flags as implemented in the code or do the Devs know that- A) it works so dont bother, B) its not implemeted so dont bother, or C) its really low priority so dont bother?
Reply With Quote
 


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 08:02 AM.


 

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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3