|  |  | 
 
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  | 
	
		
   
   
      | Quests::Q&A This is the quest support section |  
	
	
		
	
	
	| 
			
			 
			
				01-21-2009, 02:45 PM
			
			
			
		 |  
	| 
		
			
			| Banned |  | 
					Join Date: Oct 2003 Location: Mattmecks Basement 
						Posts: 546
					      |  |  
	| 
				 qglobals 
 I am trying to understand Global Variables. Would this work? If not, why? 
	Code: sub EVENT_SAY
my $conversation = $qglobals{remember_conv};
{
if($text=~/hail/i && $conversation = "0")
{
quest::setglobal("remember_conv", $conversation, 5, "F");
quest::say("I will remember you, next time you hail me!");
}
if($text=~/hail/i && $conversation = "1");
{
quest::say("We have talked before!");
}
} |  
	
		
	
	
	| 
			
			 
			
				01-21-2009, 02:52 PM
			
			
			
		 |  
	| 
		
			
			| AX Classic Developer |  | 
					Join Date: May 2006 Location: filler 
						Posts: 2,049
					      |  |  
	| 
 Make sure you checked the setting for quest globals for the npc in npc_types |  
	
		
	
	
	| 
			
			 
			
				01-21-2009, 02:53 PM
			
			
			
		 |  
	| 
		
			
			| Banned |  | 
					Join Date: Oct 2003 Location: Mattmecks Basement 
						Posts: 546
					      |  |  
	| 
 Ah, the npc needs qglobals enabled on them? I see. So as far as that, I got the syntax correct? |  
	
		
	
	
	| 
			
			 
			
				01-21-2009, 03:00 PM
			
			
			
		 |  
	| 
		
			
			| Dragon |  | 
					Join Date: Feb 2007 
						Posts: 659
					      |  |  
	| 
 
	Quote: 
	
		| 
					Originally Posted by Richardo  Ah, the npc needs qglobals enabled on them? I see. So as far as that, I got the syntax correct? |  Close.  Make sure you have "==" or "eq" (in the case of string comparison) in your if statements.  Which you would probably figure out as soon as you ran it. |  
	
		
	
	
	| 
			
			 
			
				01-21-2009, 03:13 PM
			
			
			
		 |  
	| 
		
			|  | The PEQ Dude |  | 
					Join Date: Apr 2003 Location: - 
						Posts: 1,988
					      |  |  
	| 
 No need to assign a variable to the global, since the global is a variable. This would work better for you, and won't throw up warnings in the logs: 
	Code: sub EVENT_SAY {
  if($text=~/hail/i && !defined $qglobals{conversation}){
quest::setglobal("conversation", 1, 0, "F");
quest::say("I will remember you, next time you hail me!");
 }
  elsif($text=~/hail/i && defined $qglobals{conversation}){
quest::say("We have talked before!");
 }
} |  
	
		
	
	
	| 
			
			 
			
				01-22-2009, 06:17 PM
			
			
			
		 |  
	| 
		
			
			| Banned |  | 
					Join Date: Oct 2003 Location: Mattmecks Basement 
						Posts: 546
					      |  |  
	| 
 
	Quote: 
	
		| 
					Originally Posted by Andrew80k  Close.  Make sure you have "==" or "eq" (in the case of string comparison) in your if statements.  Which you would probably figure out as soon as you ran it. |  Yeah I understand general things like that. == for intergers eq for strings. Thanks for your help guys!   |  
	
		
	
	
	| 
			
			 
			
				01-22-2009, 07:22 PM
			
			
			
		 |  
	| 
		
			
			| AX Classic Developer |  | 
					Join Date: May 2006 Location: filler 
						Posts: 2,049
					      |  |  
	| 
 
	Quote: 
	
		| 
					Originally Posted by Richardo  Ah, the npc needs qglobals enabled on them? I see. So as far as that, I got the syntax correct? |  We never had to do this at first (would work anyways), but now we do, so it's always the first thing I forget when I do quests. |  
	
		
	
	
	| 
			
			 
			
				01-24-2009, 07:49 PM
			
			
			
		 |  
	| 
		
			
			| Banned |  | 
					Join Date: Oct 2003 Location: Mattmecks Basement 
						Posts: 546
					      |  |  
	| 
 Do you guys know if it's possible to make a quest to where once an npc is hailed, no one else can talk to him until the global variable expires? |  
	
		
	
	
	| 
			
			 
			
				01-24-2009, 08:03 PM
			
			
			
		 |  
	| 
		
			|  | The PEQ Dude |  | 
					Join Date: Apr 2003 Location: - 
						Posts: 1,988
					      |  |  
	| 
 Yep, 
	Code: quest::setglobal("name",1,2,"M10"); will be available to the NPC who called it, from the zone they called it in, and to all players for 10 minutes. The second number is the option and what calls this behavior. Here are the proper values, taken from the wiki:
 
	Code: -----------------------------------------
|  value |  npcid  |  player |   zone   |
-----------------------------------------
|   0    |  this   |   this  |   this   |
|   1    |  all    |   this  |   this   |
|   2    |  this   |   all   |   this   |
|   3    |  all    |   all   |   this   |
|   4    |  this   |   this  |   all    |
|   5    |  all    |   this  |   all    | 
|   6    |  this   |   all   |   all    |
|   7    |  all    |   all   |   all    |
----------------------------------------- |  
	
		
	
	
	
	
	| Thread Tools |  
	|  |  
	| Display Modes |  
	
	| 
		
		 Hybrid Mode |  
	| 
	|  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 09:50 PM.
 
 |  |  
    |  |  |  |  
    |  |  |  |  
     |  |  |  |  
 |  |