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 07-01-2010, 12:54 AM
blackdragonsdg
Dragon
 
Join Date: Dec 2008
Location: Tennessee
Posts: 656
Default Quest Problem

I can not seem to get part of this simple quest to work. The hand in works flawlessly but the refund section is not working. If any amount of platinum is turned in it is refunded no matter what the amount....the problem is that it is making the AA's completely free. I am pretty sure the logic is correct but the implementation seems to be a problem and I am not sure how to fix it. If someone could point me in the right direction it would be greatly appreciated.

Code:
sub EVENT_SAY{
if ($ulevel >=70){
 if ($text =~/hail/i){
 quest::say("Hello, I have heard that AA exp moves rather slowly on this server, so I am here to take advantage of that and sell level 70s [AA].");
 }
 if ($text =~/AA/i){
 quest::say("Yes, it is 25K platinum for 5 AAs or 50k platinum for 10 AAs or 75k platinum for 15 AAs or 100k platinum for 20 AAs or 125k platinum for 25 AAs or 150k platinum for 30 AAs or 175k platinum for 35 AAs or 200k platinum for 40 AAs or 225k platinum for 45 AAs or 250k platinum for 50 AAs or . You must be level 70+ and have AA experience turned on to 100% or it will not work!");
 }
}
 else{
 quest::say("You must be level 70+ before I can help you.");
 } 
}

sub EVENT_ITEM{
 if ($ulevel >=70){
  if ($platinum ==25000){
  $client->AddAAPoints(5);
}
  elsif ($platinum ==50000){
  $client->AddAAPoints(10);
}
  elsif ($platinum ==75000){
  $client->AddAAPoints(15);
}
  elsif ($platinum ==100000){
  $client->AddAAPoints(20);
}
  elsif ($platinum ==125000){
  $client->AddAAPoints(25);
}
  elsif ($platinum ==150000){
  $client->AddAAPoints(30);
}
  elsif ($platinum ==175000){
  $client->AddAAPoints(35);
}
  elsif ($platinum ==200000){
  $client->AddAAPoints(40);
}
  elsif ($platinum ==225000){
  $client->AddAAPoints(45);
}
 elsif ($platinum ==250000){
  $client->AddAAPoints(50);
  }
}
 if ($platinum != 25000 || 50000 || 75000 || 100000 || 125000 || 150000 || 175000 || 200000 || 225000 || 250000){
 quest::say("That's the wrong amount.");
 quest::givecash($copper,$silver,$gold,$platinum );
 }
 if ($ulevel <=69){
 quest::say("Reach level 70 first.");
 quest::givecash($copper,$silver,$gold,$platinum );
}
}
Reply With Quote
  #2  
Old 07-01-2010, 04:46 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

$platinum != 25000 || 50000 || 75000 || 100000 || 125000 || 150000 || 175000 || 200000 || 225000 || 250000

Each condition is checked sequentially independent of the others, bitwise success is anything not 0 while failure is zero.

condition 1: $platinum != 25000 (true if $platinum != 25000)
condition 2: 50000 (always true)
condition 3: 75000 (always true)
condition 4: 100000 (always true)
condition 5: 125000 (always true)
condition 6: 150000 (always true)
condition 7: 175000 (always true)
condition 8: 200000 (always true)
condition 9: 225000 (always true)
condition 10: 250000 (always true)

Because 9/10 of the statements are true and they're all an inclusive disjunction it will always trigger as true. However even if it 'worked' as I imagine you want it to it would still always trigger because there will always be one condition that will evaluate as true.

ex: F v F v F v F v F v T = T

Personally I think you're making it far too complicated; here is how I would accomplish it.

Code:
sub EVENT_SAY
{
	if ($ulevel >=70)
	{
		if ($text =~/hail/i)
		{
			quest::say("Hello, I have heard that AA exp moves rather slowly on this server, so I am here to take advantage of that and sell level 70s [AA].");
		}
		elsif ($text =~/AA/i)
		{
			quest::say("Yes, it is 25K platinum for 5 AAs or 50k platinum for 10 AAs or 75k platinum for 15 AAs or 100k platinum for 20 AAs or 125k platinum for 25 AAs or 150k platinum for 30 AAs or 175k platinum for 35 AAs or 200k platinum for 40 AAs or 225k platinum for 45 AAs or 250k platinum for 50 AAs or . You must be level 70+ and have AA experience turned on to 100% or it will not work!");
		}
		else
		{
			quest::say("You must be level 70+ before I can help you.");
		}
	}
}

sub EVENT_ITEM
{
	if($ulevel >=70)
	{
		if($platinum > 0 && $platinum <= 250000 && ($platinum % 25000) == 0)
		{
			$client->AddAAPoints(5 * int($platinum / 25000));
		}
		else
		{
			quest::givecash($copper, $silver, $gold, $platinum);
			quest::say("That's the wrong amount.");
		}
	}
	else
	{
		quest::say("Reach level 70 first.");
		quest::givecash($copper, $silver, $gold, $platinum);
	}
}
Reply With Quote
  #3  
Old 07-01-2010, 08:05 AM
pfyon's Avatar
pfyon
Discordant
 
Join Date: Mar 2009
Location: Ottawa
Posts: 495
Default

Just to explain what KLS did with the platinum check there (in case you don't have any programming background).

Code:
if($platinum > 0 && $platinum <= 250000 && ($platinum % 25000) == 0)
returns true when the platinum amount is greater than 0, but less than 250000 and when divided by 25000 has no remainder (so any amount between 25000 and 250000 in intervals of 25000).
Reply With Quote
  #4  
Old 07-01-2010, 01:52 PM
blackdragonsdg
Dragon
 
Join Date: Dec 2008
Location: Tennessee
Posts: 656
Default

KLS your script worked perfectly and it was alot shorter than mine, thank you. I would never have thought to use division and check for a remainder.
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 02:56 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