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-10-2015, 02:17 AM
utbbop
Sarnak
 
Join Date: May 2009
Location: Mentor
Posts: 58
Default Alternate Currency - Granted Hourly

Hello All,
Disclaimer: I am just getting set up with a server and am very new to this!

I wanted to know if anyone could help me get some framework going for granting players an Alternate Currency at a defined time interval of being online. I am thinking this would be something that gets added to a global quest file rather than a zone specific quest file?

Any thoughts or help would be appreciated. I can edit this heck out of some code to make it do what I want normally but I struggle with anything new and without framework. Any assistance would be huge...

Thanks guys!
Reply With Quote
  #2  
Old 01-10-2015, 06:21 AM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default

You can achieve this like this.
Code:
sub EVENT_CONNECT {
    quest::settimer("Crystals", 3600);
}

sub EVENT_TIMER {
    if ($timer eq "Crystals") {
        quest::stoptimer("Crystals");
        my $radiant = quest::ChooseRandom(1..5);
        my $ebon = quest::ChooseRandom(1..5);
        $client->AddCrystals($radiant, $ebon);
        $client->Message(315, "You have recieved $radiant Radiant Crystals and $ebon Ebon Crystals. You now have " . plugin::commify($client->GetRadiantCrystals()) . " Radiant Crystals and " . plugin::commify($client->GetEbonCrystals()) . " Ebon Crystals.");
        quest::settimer("Crystals", 3600);
    }
}

Last edited by Kingly_Krab; 01-10-2015 at 03:51 PM..
Reply With Quote
  #3  
Old 01-10-2015, 02:22 PM
Urkel
Fire Beetle
 
Join Date: Dec 2013
Posts: 3
Default

cant wait to afk on your server and become the best!
Reply With Quote
  #4  
Old 01-12-2015, 12:33 PM
utbbop
Sarnak
 
Join Date: May 2009
Location: Mentor
Posts: 58
Default

Quote:
Originally Posted by Kingly_Krab View Post
You can achieve this like this.
Code:
sub EVENT_CONNECT {
    quest::settimer("Crystals", 3600);
}

sub EVENT_TIMER {
    if ($timer eq "Crystals") {
        quest::stoptimer("Crystals");
        my $radiant = quest::ChooseRandom(1..5);
        my $ebon = quest::ChooseRandom(1..5);
        $client->AddCrystals($radiant, $ebon);
        $client->Message(315, "You have recieved $radiant Radiant Crystals and $ebon Ebon Crystals. You now have " . plugin::commify($client->GetRadiantCrystals()) . " Radiant Crystals and " . plugin::commify($client->GetEbonCrystals()) . " Ebon Crystals.");
        quest::settimer("Crystals", 3600);
    }
}
Thanks a ton!
Going to play with this a bit and will let you know if I have any questions!
Reply With Quote
  #5  
Old 01-12-2015, 12:34 PM
utbbop
Sarnak
 
Join Date: May 2009
Location: Mentor
Posts: 58
Default

Quote:
Originally Posted by Urkel View Post
cant wait to afk on your server and become the best!
lol. Well thats the plan.
Welcome to IdleQuest.
Reply With Quote
  #6  
Old 01-12-2015, 01:00 PM
utbbop
Sarnak
 
Join Date: May 2009
Location: Mentor
Posts: 58
Default

Quote:
Originally Posted by Kingly_Krab View Post
You can achieve this like this.
Code:
sub EVENT_CONNECT {
    quest::settimer("Crystals", 3600);
}

sub EVENT_TIMER {
    if ($timer eq "Crystals") {
        quest::stoptimer("Crystals");
        my $radiant = quest::ChooseRandom(1..5);
        my $ebon = quest::ChooseRandom(1..5);
        $client->AddCrystals($radiant, $ebon);
        $client->Message(315, "You have recieved $radiant Radiant Crystals and $ebon Ebon Crystals. You now have " . plugin::commify($client->GetRadiantCrystals()) . " Radiant Crystals and " . plugin::commify($client->GetEbonCrystals()) . " Ebon Crystals.");
        quest::settimer("Crystals", 3600);
    }
}
Having some trouble getting this to work. Might be because Ebon and Radiant crystals arent showing up in-game/in my client. They show as Unknown DB Strings.

Any feedback as to why? Is it my client (UF)?

I have added a new currency called Planar Crystals of which I will use instead of Radiant and Ebon Crystals, but this is not showing up in-game at all in the Alt Currency Inventory window...
Reply With Quote
  #7  
Old 01-12-2015, 03:26 PM
utbbop
Sarnak
 
Join Date: May 2009
Location: Mentor
Posts: 58
Default

Quote:
Originally Posted by utbbop View Post
Having some trouble getting this to work. Might be because Ebon and Radiant crystals arent showing up in-game/in my client. They show as Unknown DB Strings.

Any feedback as to why? Is it my client (UF)?

I have added a new currency called Planar Crystals of which I will use instead of Radiant and Ebon Crystals, but this is not showing up in-game at all in the Alt Currency Inventory window...
Found some threads on dbstr.txt and was able to fix my unknown strings. Still cant get this to work.

I added this code to global_player.pl and I reduced the timer from 3600 to 10, for testing purposes, and nothing is happening.

Can you confirm that plugin::commify($client->GetRadiantCrystals()) is correct? Specifically the "commify". Havent seen that before and cant find it listed here: http://wiki.eqemulator.org/p?Ultimat...rence&frm=Main

Thanks for the help..
Reply With Quote
  #8  
Old 01-12-2015, 03:45 PM
rencro
Hill Giant
 
Join Date: Sep 2008
Location: So. California
Posts: 219
Default

Can you confirm that plugin::commify($client->GetRadiantCrystals()) is correct? Specifically the "commify". Havent seen that before and cant find it listed here: http://wiki.eqemulator.org/p?Ultimat...rence&frm=Main


It is "explained" here:
http://wiki.eqemulator.org/p?Perl_Pl...rence&frm=Main

Here are the helpful comments on it: If you need an example for this, you need help

Good luck..
Reply With Quote
  #9  
Old 01-12-2015, 04:13 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Ebon/Radiant crystals are not the same as alternate currency. The clients that have them (I think SoF+) all treat them separately from alternate currency. If you try to add Ebon/Radiant crystals as an alternate currency, they will show up as unknown-dbstr unless you edit client files. Instead of having Ebon/Radiant Crystals in the Alt Currency tab of your inventory, they should have their own little boxes similar to plat/gold/silver/copper in your main inventory window.

The crystals are loaded from the player profile, which differs from alt currency that loads from a specific packet for that. And, crystals have their own update packets for changing the amount displayed in the inventory window. They also use different vendor classes that are specific for Ebon or Radiant crystals, where Alt Currency vendors can be set to use 1 of any of the 19ish different standard alt currencies.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #10  
Old 01-12-2015, 04:20 PM
utbbop
Sarnak
 
Join Date: May 2009
Location: Mentor
Posts: 58
Default

Quote:
Originally Posted by rencro View Post
Can you confirm that plugin::commify($client->GetRadiantCrystals()) is correct? Specifically the "commify". Havent seen that before and cant find it listed here: http://wiki.eqemulator.org/p?Ultimat...rence&frm=Main


It is "explained" here:
http://wiki.eqemulator.org/p?Perl_Pl...rence&frm=Main

Here are the helpful comments on it: If you need an example for this, you need help

Good luck..
Ok, understood.
Still cant get it working though.

Tested some different code to make sure my currency and everything was working and it is. This appears to be an issue with the code in general or where I am putting it. I even tried switching from EVENT_CONNECT to EVENT_ZONE and it wont work.

Hmmmmm, going to keep trying...
Reply With Quote
  #11  
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
  #12  
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
  #13  
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


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 08:42 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