EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Help Refunding (https://www.eqemulator.org/forums/showthread.php?t=35037)

KingMort 03-10-2012 04:11 PM

Help Refunding
 
On Raid Addicts, the King npc would scribe peoples spells for 150,000 then I changed it to 15,000. Now i'm making it so they have to collect Guk Award Coins and hand those in for the spells instead.

What I am trying to figure out is how to refund the plat they have given the previous quest npc.

The quest globals were set as "spellspent" , then the value would be how much plat they gave it.

IE., (ID, CHARID, 0, 0, 'spellspent', '150000', NULL);

What would be the easiest way to refund their plat back to them?

Mort

sorvani 03-10-2012 07:46 PM

write a script to let them hail a guy who reads the variable value and gives them that much plat. then the npc deletes the variable or sets it to 0 or something

KingMort 03-11-2012 02:53 AM

Yeah I don't know how to do it exactly. If you could show me would be appreciated.

chrsschb 03-11-2012 03:09 AM

Roughly something like this?

Code:

sub EVENT_SAY
  {
  if($text=~/hail/i)
    {
    if(defined $qglobals{spellspent} == 150000)
      {
      quest::givecash(150000,0,0,0);
      quest::delglobal("spellspent");
      }
    else
      {
      plugin::Whisper("You've either already completed this refund script or you were never entitled to a refund");
      }
    }
  }


KingMort 03-11-2012 03:35 AM

Ok that's great, (and thank you for your reply) but what I mean is, say they have 150,000, or say they have 139,702....

I need it to be able to extract the amount, then refund them the same amount and delete the global afterward. That is the part I got stuck with seems pretty tricky to me.

Appreciate all your help in advance.
Morty

joligario 03-11-2012 06:53 AM

Untested and assuming the amount is set in cp:

Code:

if (defined($qglobals{spellspent})) {
  $total = $qglobals{spellspent};

  $pp = int($total / 1000);
  $remainder = $total - $pp * 1000;

  $gp = int($remainder / 100);
  $remainder = $remainder % 100;

  $sp = int($remainder / 10);
  $remainder = $remainder % 10;

  $cp = $remainder;

  quest::givecash($cp, $sp, $gp, $pp);
}


KingMort 03-11-2012 03:12 PM

This is what I have it setup as:

Quote:

sub EVENT_SAY
{

if($text=~/Refund/i)
{
if (defined($qglobals{spellspent})) {
$total = $qglobals{spellspent};

$pp = int($total / 1000);
$remainder = $total - $pp * 1000;

$gp = int($remainder / 100);
$remainder = $remainder % 100;

$sp = int($remainder / 10);
$remainder = $remainder % 10;

$cp = $remainder;

quest::givecash($cp, $sp, $gp, $pp);
}
}
}
Anyway the Test Char i used has "150,000" plat on his spellspent.. Said "Refund" and the npc gave him 150 plat.

So very close :) Once again thank you for your assistance, I'm not sure how to make it give the proper amount any ideas?

Tabasco 03-11-2012 04:12 PM

The answer is right in front of you. He's converting the value from CP, except it's being stored in PP, so the conversion isn't necessary. This is not even a programming issue, it's just math and you've already been given the answers.

This exchange is reminiscent of how quite a few players seem to handle quests that have any form of subtlety or require some small degree of thought.
ZOMG, totally lost, HE DROPPED A BOOK! What do these words mean? "Feel the steely kiss of me blade", are we supposed to make out, what is the client command for smooching?!

Code:

quest::givecash(0, 0, 0, $total);

KingMort 03-11-2012 04:33 PM

Thank you, I'll admit I have never been that great with the PERL stuff.. My expertise lays in Content Creation and Spell Design and Class Balancing etc. Just got done creating just over 2,300 custom spells from levels 88-100. But yeah PERL stuff has always been something I just had a hard time with ..

Anyway the script works now and I greatly appreciate the help :)

Mort


All times are GMT -4. The time now is 11:06 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.