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-01-2012, 01:03 PM
Luccian
Sarnak
 
Join Date: Sep 2009
Posts: 32
Default Settimer variables

Good Morning,

I am working on a small script to add a little flavor to a zone I have been working on for a server. So far it works with a set timer, however when I realized all the NPCs would be swinging their picks in unison I decided it may be best to implement some sort of variable. Sadly my attempts to seems to have broken the loop somehow. Would someone mind giving this a good once over and maybe point out what could be wrong?

This one works-

Code:
sub EVENT_SPAWN
{
	quest::settimer("woodcut",1);
}
sub EVENT_TIMER
{
	if ($timer eq "mine")
	{
		# Random Animations: 2h slash and 1h slash
		my $anivar1=quest::ChooseRandom(3,5);
		quest::doanim($anivar1);
		quest::settimer("woodcut",3);
	}
}
sub EVENT_SAY 
{
	if($text=~/Hail/)
	{
		quest::emote("appears to be dripping in sweat as they chip away at large chunks of ore and crystal");
		quest::say("I don't mean to be rude but go away. There is enough work to do here without some outsider wasting our precious daylight.");
	}
}
I tried with just a simple quest::ChooseRandom but it didnt work, but looked like-

Code:
sub EVENT_SPAWN
{
	quest::settimer("woodcut",1);
}
sub EVENT_TIMER
{
	if ($timer eq "mine")
	{
		# Random Animations: 2h slash and 1h slash
		my $anivar1=quest::ChooseRandom(3,5);
		quest::doanim($anivar1);
                # Random Timer value between 1 and 5 seconds
		my $randomnum=quest::ChooseRandom(1,2,3,4,5);
		quest::settimer("woodcut",$randomnum);
	}
}
sub EVENT_SAY 
{
	if($text=~/Hail/)
	{
		quest::emote("appears to be dripping in sweat as they chip away at large chunks of ore and crystal");
		quest::say("I don't mean to be rude but go away. There is enough work to do here without some outsider wasting our precious daylight.");
	}
}
I also tried to download and use the RandomRange plugin I saw used in another script, however I either didnt use it properly or the syntax is wrong. In any case it is here-

Code:
sub EVENT_SPAWN
{
	quest::settimer("woodcut",1);
}
sub EVENT_TIMER
{
	if ($timer eq "mine")
	{
		# Random Animations: 2h slash and 1h slash
		my $anivar1=quest::ChooseRandom(3,5);
		quest::doanim($anivar1);
                # Random Timer value between 1 and 5 seconds
		my $randomnum=plugin::RandomRange(1,5);
		quest::settimer("woodcut",$randomnum);
	}
}
sub EVENT_SAY 
{
	if($text=~/Hail/)
	{
		quest::emote("appears to be dripping in sweat as they chip away at large chunks of ore and crystal");
		quest::say("I don't mean to be rude but go away. There is enough work to do here without some outsider wasting our precious daylight.");
	}
}
*Note* The plugin is saved as "RandomRange" in my plugins folder, in case someone were to ask.

I appreciate the help folks =)
Reply With Quote
  #2  
Old 02-02-2012, 04:00 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Take a closer look at your scripts you posted. Even the one you posted that you said works, would not actually work.

Code:
sub EVENT_SPAWN
{
	quest::settimer("woodcut",1);
}
sub EVENT_TIMER
{
	if ($timer eq "mine")
	{
		# Random Animations: 2h slash and 1h slash
		my $anivar1=quest::ChooseRandom(3,5);
		quest::doanim($anivar1);
		quest::settimer("woodcut",3);
	}
}
sub EVENT_SAY 
{
	if($text=~/Hail/)
	{
		quest::emote("appears to be dripping in sweat as they chip away at large chunks of ore and crystal");
		quest::say("I don't mean to be rude but go away. There is enough work to do here without some outsider wasting our precious daylight.");
	}
}
You need to check for the same timer name in EVENT_TIMER that you set the timer as in EVENT_SPAWN.

Other than that, your 2 random timer scripts look fine.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 02-02-2012, 06:25 AM
Luccian
Sarnak
 
Join Date: Sep 2009
Posts: 32
Default

Looks like you were right Trev. I thought I had the timers set correctly the first time but appears I was wrong. I appreciate the help pointing out my very obvious problem with the script =P
Plugin works great, random number selection great, all around good experiences with this. Thanks again.
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:30 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3