Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #16  
Old 08-13-2012, 08:17 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

I didn't go through much, but just got some obvious things for you:

Code:
sub EVENT_AGGRO {
  quest::setnexthpevent(99);
  quest::settimer("DT",1);
  quest::settimer("Slow",2);
  quest::settimer("Nuke",3);
}

sub EVENT_HP {
  if($hpevent == 99) {
    quest::shout2("You dare face the might of Vishimtar, mortals?!?!!");
    quest::setnexthpevent(75);
  }
  if($hpevent == 75) {
    quest::shout2("The power of the dragon ancients grows inside of me!");
    quest::setnexthpevent(50);
  }
  if($hpevent == 50) {
    quest::shout2("I...am...the Destroyer!!!");
    quest::setnexthpevent(25);
  }
  if($hpevent == 25) {
    quest::shout2("Arrghh! You will not defeat me!");
    quest::setnexthpevent(1);
  }
  if($hpevent == 1) {
    quest::shout2("Ahh.. My power was not.... Strong enough...");
  }
}
 
sub EVENT_DEATH {
  quest::stoptimer("DT");
  quest::stoptimer("Slow");
  quest::stoptimer("Nuke");
}
 
sub EVENT_SLAY {
  quest::shout("You cannot stand yourself against a dragon god $name!");
}
 
sub EVENT_TIMER {
  if ($timer eq "DT") {
    quest::shout("DT TEST");
  }
  if ($timer eq "Slow") {
    quest::shout("SLOW TEST");
  }
  if ($timer eq "Nuke") {
    quest::shout("NUKE TEST");
  }
}
Reply With Quote
  #17  
Old 08-13-2012, 08:44 PM
bad_captain
Developer
 
Join Date: Feb 2009
Location: Cincinnati, OH
Posts: 512
Default

Code:
Sub EVENT_TIMER {
if ($timer == DT) {
quest::shout("TEST");
if ($timer == Slow) {
quest::shout("TEST");
if ($timer == Nuke) {
quest::shout("TEST");
}
}
Count your brackets... 4 starting brackets, 2 ending brackets.
Reply With Quote
  #18  
Old 08-13-2012, 08:56 PM
Reynin89
Sarnak
 
Join Date: Apr 2010
Posts: 71
Default

Jolig that is working thanks a lot! What was wrong with it?

bad_captain, I see I had 4 starting brackets and 2 ending, but where would the other 2 brackets have gone?
Reply With Quote
  #19  
Old 08-13-2012, 09:41 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,743
Default

There's a reason people format code, because it is much more obvious when things are wrong. Compare your code to this:

Code:
Sub EVENT_TIMER 
{
	if ($timer == DT) 
	{
		quest::shout("TEST");
		
	if ($timer == Slow) 
	{
		quest::shout("TEST");
		
	if ($timer == Nuke) 
	{
		quest::shout("TEST");
	}
}
Much more obvious where the problem is isn't it? I don't know what you edit with, but there are a ton of editors out there that do things like brace highlighting and matching that help to avoid these simple mistakes.
Reply With Quote
  #20  
Old 08-13-2012, 10:45 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

This part:

Code:
Sub EVENT_TIMER {
if ($timer == DT) {
quest::shout("TEST");
if ($timer == Slow) {
quest::shout("TEST");
if ($timer == Nuke) {
quest::shout("TEST");
}
}

You're original posting was correct..the second one is wrong.

Quote:
[event handler] { // this bracket opens event handler procedure

[condition 1] { // this bracket opens condition 1 procedure
do_work_1;
} // this bracket closes condition 1 procedure

[condition 2] { // this bracket opens condition 2 procedure
do_work_2;
} // this bracket closes condition 2 procedure

} // this bracket closes event handler procedure

There could still be other issues, but this is how procedures should be wrapped.

I don't know if perl let's you use single-line conditional statements. If it does, and that's what you're attempting to do,
then the con checks shouldn't have the opening bracket after it.

IF perl does let you, it should look like this. Otherwise you need both open and close brackets around any procedure or
sub-procedure.

Code:
Sub EVENT_TIMER {
	if ($timer == DT)
		quest::shout("TEST");
	if ($timer == Slow)
		quest::shout("TEST");
	if ($timer == Nuke)
		quest::shout("TEST");
}
EDIT: omg..did it really take almost 3 hours to post this?? I'm so dense that I must be warping the very fabric of space-time...
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #21  
Old 08-14-2012, 01:20 AM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Here try this.
Also look at this:
Quote:
void quest::settimer(const char *timer_name, int seconds) {
So you basically set it to check DT (death touch?) every 1 second, slow every 2 and nuke every 3 or am I just way tired and reading that wrong.
Code:
sub EVENT_COMBAT {
	if ($combat_state == 1) {
		quest::setnexthpevent(99);
		quest::settimer(DT,1);
		quest::settimer(Slow,2);
		quest::settimer(Nuke,3);
	} else {
		quest::stoptimer("DT");
		quest::stoptimer("Slow");
		quest::stoptimer("Nuke");
		quest::depop();
	}
}

sub EVENT_HP {
	if($hpevent <= 99 && $hpevent >= 98) {
		quest::shout2("You dare face the might of Vishimtar, mortals?!?!!");
		quest::setnexthpevent(75);
	}
	if($$hpevent <= 75 && $hpevent >= 74) {
		quest::shout2("The power of the dragon ancients grows inside of me!");
		quest::setnexthpevent(50);
	}
	if($hpevent <= 50 && $hpevent >= 49) {
		quest::shout2("I...am...the Destroyer!!!");
		quest::setnexthpevent(25);
	}
	if($hpevent <= 25 && $hpevent >= 24) {
		quest::shout2("Arrghh! You will not defeat me!");
	}
}

Sub EVENT_DEATH {
	quest::shout2("Ahh.. My power was not.... Strong enough...");
	quest::stoptimer(DT);
	quest::stoptimer(Slow);
	quest::stoptimer(Nuke);
}

Sub EVENT_SLAY {
	quest::shout("You cannot stand yourself against a dragon god $name!");
}

Sub EVENT_TIMER {
	if ($timer == DT) {
		quest::shout("TEST"); }
	if ($timer == Slow) {
		quest::shout("TEST"); }
	if ($timer == Nuke) {
		quest::shout("TEST"); }
}
Reply With Quote
  #22  
Old 08-14-2012, 08:55 AM
Maze_EQ
Demi-God
 
Join Date: Mar 2012
Posts: 1,107
Default

If you need additional help you can contact me at akaishigpg@gmail.com
__________________
"No, thanks, man. I don't want you fucking up my life, too."

Skype:
Comerian1
Reply With Quote
  #23  
Old 08-14-2012, 01:15 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

as for your timer checks, when you are using a string, you should enclose it in quotations and use the eq operator (if the name of your timer is an integer, you don't need the quotations and you use == instead). it's also better practice to use elsif for when you only expect a single condition to be met, otherwise the script will continue to evaluate the rest of the conditions instead of stopping at the first one it sees. here's an example:

Code:
Sub EVENT_TIMER
{
	if ($timer eq "DT")
	{
		quest::shout("DT timer triggered");
	}
	elsif ($timer eq "Slow")
	{
		quest::shout("Slow timer triggered");
	}
	elsif ($timer eq "Nuke")
	{
		quest::shout("Nuke timer triggered");
	}
}
additionally, i don't think it's necessary to explicitly stop timers on NPC death.
Reply With Quote
  #24  
Old 08-14-2012, 03:52 PM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

Quote:
Originally Posted by c0ncrete View Post
additionally, i don't think it's necessary to explicitly stop timers on NPC death.
You generally do not have to. there have been a few rare oddities (MB in PoI) on PEQ where timers and such seem to not stop correctly on zone shutdown, but never noticed anything hang up past NPC death.
Reply With Quote
  #25  
Old 08-14-2012, 11:47 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 905
Default

Quote:
Originally Posted by sorvani View Post
You generally do not have to. there have been a few rare oddities (MB in PoI) on PEQ where timers and such seem to not stop correctly on zone shutdown, but never noticed anything hang up past NPC death.
combatstate == 0 covers both avenues (raid wipe/agro drop and death)
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 12:55 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3