PDA

View Full Version : Buff Bot Example


Angelox
07-17-2007, 08:54 PM
This is an example of how far you can go with just a little imagination - I have two bots in PoK, one for mana and one for HP buffs. they med when no one's talking to them, stand when hailed, and talk/wave to each other.
Also, I had placed random signal scripts all around PoK so you get the impression they are oocing what they sell. I think this is an older script as I had also randomized their "time to ooc" so they would drive you nuts with their offers.

#zone:PoKnowledge
#Angelox

sub EVENT_SAY {
if(($text=~/hail/i)&&($ulevel<= 45)){
$npc->SetAppearance(0);
quest::say("Hello $name, I can buff you with clarity for a fee of 5pp, and my friend over there has cleric buffs.");
quest::emote("waves at Qadar");
quest::doanim("29");
}
elsif(($text=~/hail/i)&&($ulevel=>46)){
$npc->SetAppearance(0);
quest::say("Hello $name, I can buff you with KEI for a fee of 15pp, and my friend over there has cleric buffs");
quest::emote("waves at Qadar");
quest::doanim("29");
}
}

sub EVENT_SPAWN
{
$x = $npc->GetX();
$y = $npc->GetY();
quest::set_proximity($x - 90, $x + 90, $y - 90, $y + 90);
}

sub EVENT_ENTER
{
$npc->SetAppearance(1);
my $random_result = int(rand(100));
if ($random_result<=15){
quest::shout("Casting KEI and Clarity for donations on the rock behind the main bank!");
}else{
#Do Nothing
}
}

sub EVENT_ITEM{
if (($platinum>=15)&&($ulevel=> 46)){
$npc->SetAppearance(0);
quest::selfcast(2570);
quest::say("Casting KEI, Good hunting!");
}elsif(($platinum>=5)&&($ulevel<= 45)){
$npc->SetAppearance(0);
$npc->CastSpell(174,$userid);
quest::say("Casting Clarity, Good hunting!");
}else{
quest::say("Thank you for your donation $name, it wasn't enough though ...");
}
}

sub EVENT_SIGNAL {
quest::shout("Casting KEI and Clarity for donations on the rock behind the main bank!");
}

GeorgeS
07-18-2007, 12:35 AM
"Casting KEI and Clarity for donations on the rock behind the main bank..."
- that brings back memories!

Nice example


GeorgeS


sub EVENT_SAY {
if ($text =~/Hail/i)
{ quest::say("Greetings $name. If you want me to cast a spell on you, please say so and I will give you my [pricelist]. If you want me to [heal] you, please say so and I will do it for free."); }
if($text=~/pricelist/i)
{quest::say("I can cast the following spells : Spirit of Wolf = 1 pp // Dead Man Floating = 3 pp // Clarity II = 5 pp // Spiritual Light = 8 pp // Spiritual Radiance = 15 pp // Temperance = 1 peridot // Virtue = 4 peridots // KEI = 50 pp");}
if ($text=~/heal/i) { quest::selfcast(13); }
}
sub EVENT_ITEM
{
if($platinum == 1)
{
quest::selfcast(278);
}
if($platinum == 3)
{
quest::selfcast(457);
}
if($platinum == 5)
{
quest::selfcast(1693);
}
if($platinum == 8)
{
quest::selfcast(2176);
}
if($platinum == 15)
{
quest::selfcast(2177);
}
if($item1== 10028)
{
quest::selfcast(3692);
}
if($itemcount{10028} == 4)
{
quest::selfcast(3467);
}
if($platinum == 50)
{
quest::selfcast(2570);
}
}
QUOTE]

shawnluc
02-01-2008, 04:03 AM
I apologize as this may sound like a stupid question.

Where, and how would I go about implementing this code into my server?

Thanks!

Soraken

Secrets
02-01-2008, 04:28 AM
I prefer using a global system for buff 'credit'.

sub EVENT_SPAWN
{
quest::settimer(1,1);
}

sub EVENT_SAY
{
my $cost = 500;

my $credit = $qglobals{buffcredit} ? $qglobals{buffcredit} : 0;

if ($text =~ /hail/i)
{
quest::say("If you want some [buffs] say the keyword.. They will cost $cost plat.");
$npc->SetAppearance(0);
quest::settimer(1,10);
}
elsif ($text =~ /buffs/i)
{
if ($credit < $cost)
{
quest::say("No can do sir. You need ".($cost - $credit)." more plat!");
}
else
{
quest::selfcast(2112);
quest::selfcast(2517);
quest::selfcast(8199);
quest::selfcast(1939);
quest::selfcast(2517);
if ($cost > 0)
{
$credit -= $cost;
quest::setglobal('buffcredit', "$credit", 5, 'F');
quest::say("Thanks $name! You lost $cost and now have $credit.");
}
}
}
}

sub EVENT_ITEM
{
my $credit = $qglobals{buffcredit} ? $qglobals{buffcredit} : 0;

if ($platinum > 0)
{
$credit += $platinum;
quest::setglobal('buffcredit', "$credit", 5, 'F');
quest::say("Thanks $name! You now have $credit in credit!");
}
else
{
plugin::return_items(\%itemcount);
}
}

sub EVENT_TIMER
{
if($timer eq "1")
{
$npc->SetAppearance(1);
quest::stoptimer(1);
quest::settimer(1,5);
}
}

Angelox
02-01-2008, 06:42 AM
Those are Perl Quests - they usually come with the package you downloaded, and you might already have them.

I apologize as this may sound like a stupid question.
Where, and how would I go about implementing this code into my server?
Thanks!
Soraken

Ut0pia
03-13-2008, 08:47 AM
Hi, I'm trying to learn the how these bots are scripted in Perl but am having trouble understanding all the lines of code. Does anyone mind breaking each line down and explaining what they do so I can gain a further understanding of the Perl Scripts?

Aramid
03-13-2008, 10:46 AM
Hi, I'm trying to learn the how these bots are scripted in Perl but am having trouble understanding all the lines of code. Does anyone mind breaking each line down and explaining what they do so I can gain a further understanding of the Perl Scripts?

Here would be your best source of what does what in the quest code:

http://www.eqemulator.net/wiki/wikka.php?wakka=QuestTutorial

GeorgeS
03-14-2008, 01:43 PM
If you want, there are many examples on my quest editor. Also, there's a built in help/guide to assist.

GeorgeS

Ut0pia
03-16-2008, 10:36 AM
Well, I was able to learn just about everything that the scripts here do. But when I created my own scripts, they didn't work. I posted the scripts in the Q/A section.

However, I do love examples. Where can I Find your quest examples GeorgeS

HurtinuDaily
03-26-2008, 02:55 AM
Hey utopia this is spinningfists hows it going!? Should coem play on PvP with us!

GeorgeS
03-26-2008, 04:56 PM
DL the quest editor, and there are dozens of scripts to go by. Fill in the db.ini correctly, and you'll have access to the same scripts I did when learning the stuff. I believe all my quests are pre-tested and should work as is.


GeorgeS

Ut0pia
03-27-2008, 06:18 AM
DL the quest editor, and there are dozens of scripts to go by. Fill in the db.ini correctly, and you'll have access to the same scripts I did when learning the stuff. I believe all my quests are pre-tested and should work as is.


GeorgeS

Thank you very much GeorgeS. Thankfully, I have been using your script editor for a few weeks now to check my Syntax. I completely understand the Buff Bot Script here now and have created my own as well as understand a lot of the examples in your script editor.

In fact, now that I've started to put together a design team, I'm requiring them to do use GeorgeS quest script editor at least once. I like it because it connects to the database. My own concern is that there is no way to do the same thing for the scripts. The scripts have to be gathered from locally from a network or same machine. I was wondering if there was any plans to allow it to connect to ftp sites to grab the files. Or perhaps there is another method.

GeorgeS
03-27-2008, 02:03 PM
I have debated over the FTP issue, and can definitely develop it so that's an option. I look into adding ftp access...


GeorgeS

Ut0pia
03-27-2008, 02:11 PM
I have debated over the FTP issue, and can definitely develop it so that's an option. I look into adding ftp access...


GeorgeS

The problem is that the files if accessed via ftp, have to be opened on the client machine. So the file would have to be downloaded before it is opened. That's at least my understanding of how ftp works. Of course I could be wrong

shawnluc
05-26-2008, 01:58 PM
Anyone know if there is a call like the 'quest::selfcast' that will cast on the target?

I have setup one of my buffbots to do group buffs, but it only seems to buff one target at a time.

Thanks in advance!

eski2
05-28-2008, 10:57 AM
I love the buff bot but how would you tweak it to give extended durations? Is giving a bot AAs and gear hard?

I don't have the bot code that is being worked on elsewhere but just using the bot creator with georgeS' tools and copying the code above into a quest did the job, although i'd gladly pay more for an extended version! :)