BuffBot
OK, what did I do wrong...if I hand in ANY of the plat amt is casts ALL spells?
sub EVENT_ITEM() { if ($platinum = 500) {quest::selfcast(3360);} if ($platinum = 200) {quest::selfcast(2570);} if ($platinum = 50) {quest::selfcast(1693);} if ($platinum = 20) {quest::selfcast(174);} if ($platinum = 400) {quest::selfcast(1710);} if ($platinum = 300) {quest::selfcast(1729);} if ($platinum = 60) {quest::selfcast(10);} if ($platinum = 30) {quest::selfcast(39);} } |
Not sure, but doesn't perl use "eq" for "="? I thought both worked, but maybe with integers, it's different?
|
try using:
if( $platinum == $somevalue ) in reference to eq, that is the operator for "string" equivalence. == is the operator for numerical equivalence. == sfisque |
It's been a looooong time since i scripted any perl but wasn't all based in copper value no matter what you wrote? so 500 'plat' really is 500 copper which is less than 1 plat so no matter how much you give him as long as it's over 5 gold you've met all requirements...
I dunno maybe it's fixed so labling plat really does work and all this doesn't mean anything, but that was my initial guess... |
try using elsif , that way it will stop at the first one it finds agreeable. I think a string of "ifs" prompts perl to look at all the options.
so if you gave 500 plat (500 plat being the most), this will satisfy all the if's. Code:
if Code:
if You can also use level checks (why would a level 50 character need a level 20 spell)? Code:
sub EVENT_ITEM{ |
His "if ... {quest::selfcast(3360);}" is actually ok, since the if is begun { and ended } properly. elsif is not a bad plan either. But yeah, i missed that... 500 would be 5 gold, not 500pp I think. Although, it has to equal, so 500 does not = 200, and should fail. Not sure what the issue is there, aside from '==' vs '='.
|
Have a look at my quest editor and built in examples,there are a few buff bot examples there.
GeorgeS |
Quote:
in each IF statement, he is ASSIGNING the value to $platinum, not testing for equivalence. in PERL, assignment always evaluates to true, unless the RHS is zero, undef, null, or eof. SO, every IF statement evaluates to true, and, thus, the buffbott casts everything. there's no need for elsif's. all he needs to do is change "if( $variable = some_value)" to the correct form of "if( $variable == some_value )" this concludes PERL 101, please take a blue book and exam guide. grades will be posted at the end of the semester. == sfisque |
why not make it so you have to say a command and pay plat to get the buff? otherwise how are people going to know what amount of plat to give and what buff they are getting?
edit: been a long time since ive been done this but try something like this? if(($platinum = xxx) && ($text eq 'buff')) { quest::selfcast(xxxx); } i think that would work |
If you make a good bot, you'll be able to chat with him and ask how much he charges.
|
Quote:
|
As a player, I absolutely hate having to give certain odd value of platinum to an npc to get a certain spell. For example, I would think, "Okay, he wants 62 platinum for c3, 54 platinum for Aego, etc". And that is undesirable in my opinion for the server host and the player. The player wants to buff up and move on. And as a host, you want players to quickly get buffs and enjoy content.
I wrote up this as an alternative credit system for obtaining buffs. I've commented out some things just to make it easier to use as a template. Also, I've only tested this with myself, but it should work with multiple players without bugging (unless I missed an undef). The reason I used Y9 instead of F for global expiration time was simply because F was not working for me. Hope this comes in handy as a template. Code:
sub EVENT_SAY { |
All times are GMT -4. The time now is 06:39 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.