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

03-10-2012, 04:11 PM
|
Banned
|
|
Join Date: Sep 2006
Posts: 841
|
|
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
|

03-10-2012, 07:46 PM
|
Dragon
|
|
Join Date: May 2010
Posts: 965
|
|
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
|

03-11-2012, 02:53 AM
|
Banned
|
|
Join Date: Sep 2006
Posts: 841
|
|
Yeah I don't know how to do it exactly. If you could show me would be appreciated.
|

03-11-2012, 03:09 AM
|
 |
Dragon
|
|
Join Date: Nov 2008
Location: GA
Posts: 904
|
|
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");
}
}
}
|

03-11-2012, 03:35 AM
|
Banned
|
|
Join Date: Sep 2006
Posts: 841
|
|
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
|

03-11-2012, 06:53 AM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
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);
}
|

03-11-2012, 03:12 PM
|
Banned
|
|
Join Date: Sep 2006
Posts: 841
|
|
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?
|

03-11-2012, 04:12 PM
|
 |
Discordant
|
|
Join Date: Sep 2009
Posts: 269
|
|
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);
|

03-11-2012, 04:33 PM
|
Banned
|
|
Join Date: Sep 2006
Posts: 841
|
|
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
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 12:05 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |