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 01-12-2015, 04:21 PM
utbbop
Sarnak
 
Join Date: May 2009
Location: Mentor
Posts: 58
Default

Also, I switched from $client->AddCrystals to $client->AddAlternateCurrencyValue and cant get it to work with the timer...

Code:
sub EVENT_CONNECT {
    quest::settimer("Pearls", 10);
}

sub EVENT_TIMER {
    if ($timer eq "Pearls") 
	{
        quest::stoptimer("Pearls");
        $client->AddAlternateCurrencyValue(15, 1)
        $client->Message(315, "You have recieved 1 Planar Pearl. You now have ". plugin::commify($client->GetAlternateCurrencyValue(15))."" );
        quest::settimer("Pearls", 10);
    }
}
Reply With Quote
  #2  
Old 01-12-2015, 07:48 PM
utbbop
Sarnak
 
Join Date: May 2009
Location: Mentor
Posts: 58
Default

Quote:
Originally Posted by utbbop View Post
Also, I switched from $client->AddCrystals to $client->AddAlternateCurrencyValue and cant get it to work with the timer...

Code:
sub EVENT_CONNECT {
    quest::settimer("Pearls", 10);
}

sub EVENT_TIMER {
    if ($timer eq "Pearls") 
	{
        quest::stoptimer("Pearls");
        $client->AddAlternateCurrencyValue(15, 1)
        $client->Message(315, "You have recieved 1 Planar Pearl. You now have ". plugin::commify($client->GetAlternateCurrencyValue(15))."" );
        quest::settimer("Pearls", 10);
    }
}
I have compared this to my other quests that use a timer and it seems formatted correctly. Not sure why I cant get it working. Is it something related to global_player.pl? Or perhaps something related to my EVENT?

Thanks all!
Reply With Quote
  #3  
Old 01-13-2015, 01:06 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Well, you are missing the ; at the end of this line:

Code:
$client->AddAlternateCurrencyValue(15, 1)
You can run "perl -c global_player.pl" from command line and it will tell you of any syntax errors you have so you can fix them.

Also, for general troubleshooting purposes, I always simplify my script down as much as possible to verify things are working as expected. My suggestion would be to remove/comment out all of that except for a shout/debug message like this:

Code:
sub EVENT_CONNECT {
    quest::settimer("Pearls", 10);
}

sub EVENT_TIMER {
    if ($timer eq "Pearls") 
   {
        quest::shout("IT WORKS!");
    }
}
With that, you should see the IT WORKS! shout every 10 seconds. If you aren't seeing that, then either EVENT_CONNECT isn't working properly, or you don't have your global_player.pl in the templates folder.

Once you get that working, you can add your other stuff line by line and test as you go. Once it stops working, you will know where the issue is and just need to figure out why. One example might be that you could have a bad function name.

Most likely in this case, your problem is probably due to you trying to use the $client variable inside EVENT_TIMER which does not export that variable and cannot support it properly.

Alternatively, you could set an entity variable on the client and then loop through the client list and check each for the entity variable you set, and apply your currency that way. It is a bit more complex to do this properly, but it is probably the best way.

You could probably set the entity variables to a unix timestamp using time(). Then, in the timer you would check if the current timestamp is 1 hour later than what the client's entity variable is.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
Reply

Thread Tools
Display Modes

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 01: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