EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Custom (https://www.eqemulator.org/forums/forumdisplay.php?f=671)
-   -   Script for a Buff bot (https://www.eqemulator.org/forums/showthread.php?t=29401)

Durge 05-10-2011 10:55 PM

I used the same set up, but I can't figure out what is wrong here, can anyone help?


Code:

sub EVENT_SAY{

        $client->Message(7, " ");
        my $NPCName = $npc->Ram();

        if($text=~/Hail/i) {
                if ($ulevel <= 10) {
                        quest::selfcast(5415);
                        quest::selfcast(5312);
                        quest::selfcast(5405);
                        quest::selfcast(5409);
                        quest::selfcast(5521);
                        quest::selfcast(5365);
                        quest::selfcast(278);
                        quest::selfcast(939);
                        quest::selfcast(3391);
                        quest::selfcast(5390);
                        $client->Message(315, "$NPCName whispers to you, 'Since you are level 10 or lower you get free buffs, $name! Good luck to you.'");
                }
                if (($ulevel > 10) && ($ulevel < 25)) {
                $client->Message(315, "$NPCName whispers to you, 'Hello $name, I will give you buffs in exchange for 100 platinum.'");
                }
                if (($ulevel >= 25) && ($ulevel < 70)) {
                $client->Message(315, "$NPCName whispers to you, 'Hello $name, I will give you buffs in exchange for 500 platinum.'");
                }
                if ($ulevel >= 70) {
                $client->Message(315, "$NPCName whispers to you, 'Hello $name, I will give you buffs in exchange for 1,000 platinum.'");
                }
        }
}


sub EVENT_ITEM {

        $client->Message(7, " ");
        my $NPCName = $npc->Ram();
       
        if ($platinum == 1000) {
                if ($ulevel >= 70) {
                        quest::selfcast(5278);
                        quest::selfcast(5415);
                        quest::selfcast(5312);
                        quest::selfcast(5405);
                        quest::selfcast(5409);
                        quest::selfcast(5521);
                        quest::selfcast(5365);
                        quest::selfcast(278);
                        quest::selfcast(939);
                        quest::selfcast(3391);
                        quest::selfcast(5390);
                        $client->Message(315, "$NPCName whispers to you, 'Thank you $name!'");
                } else {
                        $client->Message(315, "$NPCName whispers to you, 'Use the correct amount of platinum, $name!'");
                        quest::givecash($copper,$silver,$gold,$platinum);
                }
        }
        if ($platinum == 500) {
                if (($ulevel < 75)&&($ulevel >= 25)) {
                        quest::selfcast(5278);
                        quest::selfcast(5415);
                        quest::selfcast(5312);
                        quest::selfcast(5405);
                        quest::selfcast(5409);
                        quest::selfcast(5521);
                        quest::selfcast(5365);
                        quest::selfcast(278);
                        quest::selfcast(939);
                        quest::selfcast(3391);
                        quest::selfcast(5390);
                        $client->Message(315, "$NPCName whispers to you, 'Thank you $name!'");
                } else {
                        $client->Message(315, "$NPCName whispers to you, 'Use the correct amount of platinum, $name!'");
                        quest::givecash($copper,$silver,$gold,$platinum);
                }
        }
        if ($platinum == 100) {
                if (($ulevel > 10) && ($ulevel < 25)) {
                        quest::selfcast(5415);
                        quest::selfcast(5312);
                        quest::selfcast(5405);
                        quest::selfcast(5409);
                        quest::selfcast(5521);
                        quest::selfcast(5365);
                        quest::selfcast(278);
                        quest::selfcast(939);
                        quest::selfcast(3391);
                        quest::selfcast(5390);
                        $client->Message(315, "$NPCName whispers to you, 'Thank you $name!'");
                } else {
                        $client->Message(315, "$NPCName whispers to you, 'Use the correct amount platinum, $name!'");
                        quest::givecash($copper,$silver,$gold,$platinum);
                }
        }
        if (($platinum < 100) || ($platinum < 500) && ($platinum > 100) || ($platinum < 1000) && ($platinum > 100) && ($platinum > 500) || ($platinum > 1000)) {
                $client->Message(315, "$NPCName whispers to you, 'Use the correct amount of platinum, $name!'");
                quest::givecash($copper,$silver,$gold,$platinum);
        }
}


lerxst2112 05-10-2011 11:16 PM

Can you give us more details of what works and what doesn't? Have you tried slimming down the script to the bare minimum and adding additional functions one at a time to see when it breaks?

lich2594 05-11-2011 07:11 AM

Without any details as to what's causing you the problems...

Try using:

Code:

my $NPCName = $npc->GetCleanName();
instead of:

Code:

my $NPCName = $npc->Ram();

Durge 05-11-2011 07:35 AM

Ok I'll try that, and the problem is when i hail the npc (Ram) just a blank line appears on my chat window.

lich2594 05-11-2011 07:38 AM

Quote:

Originally Posted by Durge (Post 199720)
Ok I'll try that, and the problem is when i hail the npc (Ram) just a blank line appears on my chat window.

If it still appears as a blank line, I would suggest removing everything inside of the if statement, and replacing it with a single output to test that your NPC functions.

example:

Code:

if($text=~/Hail/i) { $client->Message(315, "$NPCName whispers to you, 'Ugh... do I work?'");  }
If it works with the single line statement, in this post, and not with all of the other checks... that simply means you have an error inside of the IF bracket. Remove everything, then add one line at a time. (Remember to change your level, to the desired level that you want to check to make sure that it works.)

Usually, you will get a blank line if none of the IF brackets are triggered.

lerxst2112 05-11-2011 08:42 AM

I would guess the blank lines come from this:

$client->Message(7, " ");

lich2594 05-11-2011 08:43 AM

Quote:

Originally Posted by lerxst2112 (Post 199722)
I would guess the blank lines come from this:

$client->Message(7, " ");

That's correct... and since it isn't within the IF bracket, it will always execute as long as there isn't an error prior to that point in the script.

Durge 05-12-2011 07:36 AM

I tried even one small message and it still didn't work.
Here is what I have.
I also tried with the name you gave me and it didn't work.
Code:

sub EVENT_SAY {

$client->Message(7, " ");
my $NPCName = $npc->Ram();
my $Hello = quest::saylink("Hello", 1);

        if($text=~/Hail/i) {
        $client->Message(315, "$NPCName whispers to you, '[$Hello], I am a test bot.'");
        }
}


lich2594 05-12-2011 07:41 AM

After changing the quest files, are you reloading quest memory? If I remember correctly, the command is: #reload pl (I haven't worked on the Emu in a while.)

Durge 05-12-2011 07:13 PM

hmm, that didn't work either.

lerxst2112 05-12-2011 08:28 PM

This line is wrong.

my $NPCName = $npc->Ram();

Replace with this as noted above:

my $NPCName = $npc->GetCleanName();

provocating 05-12-2011 08:43 PM

Quote:

Originally Posted by lich2594 (Post 199785)
After changing the quest files, are you reloading quest memory? If I remember correctly, the command is: #reload pl (I haven't worked on the Emu in a while.)

#reloadquest

Durge 05-12-2011 10:24 PM

Yes i know it was wrong, I had already tried with "GetCleanName" and changed it back.

lerxst2112 05-12-2011 10:27 PM

Well, like I said before. Strip the script down to the bare minimum, no saylinks, no npc name, nothing but a simple response to the hail, and if that works add things and see where you break it.

provocating 05-13-2011 12:08 PM

Since this thread popped back up, I got back on finalizing my buff bot.

One thing I was never able to do is get the chanter or Cleric bot to cast spells that have a target of group v2. Spells like the Druid Skin like Nature work just fine.

I have tried combinations like these. I have in remarks what happened with each spell.

Code:

#$npc->SpellFinished(3479,  $client->GetID()); #Buff bot cast virtue on herself
#$ent->CastSpell(3479, $ent, 10, -1, -1); #I cast virtue on myself
#$npc->CastSpell(3479, $ent, 10, -1, -1); #Buff bot cast virtue on herself
#$npc->CastSpell(3479, $userid); #Buff bot cast virtue on herself

Yeah I could code it to where I cast Virtue on myself but that seems really lame. Plus people will complain they did not get it, because they moved or something.


All times are GMT -4. The time now is 09:24 PM.

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