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 10-27-2007, 11:43 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default Integer in a global example.

This is an example of how you can store an integer for later use using perl.

This script can add one to a global every time you tell it 'store'.

It's an overlooked concept, so i'd thought i'd post it.

Code:
sub EVENT_SAY
{
	my $variable = 1;
	my $storedvariable = $qglobals{variablesaved} ? $qglobals{variable saved} : 0;

	if ($text=~/hail/i)
	{
	quest::say("Do you wish to [store] the variable + 1 and have me [return] it as two?");
	}

	if ($text=~/store/i)
	{
	$variable += 1;
	quest::setglobal('storedvariable', $variable, 5, 'F');
	quest::say("I have stored the variable plus one as $storedvariable.");
	}

	if ($text=~/return/i)
	{
	quest::say("My storedvariable is $storedvariable.");
	}
}
Make sure quest globals are toggled on, on the NPC you try this on.
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 07:13 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