Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-22-2013, 08:36 PM
Dabloon
Sarnak
 
Join Date: Oct 2007
Posts: 78
Default Buff bot script

Here is a buffbot script i made. It may not be the best available but it works. With some exceptions though. I have 8 buffs in the script but it is only casting 5. Im not sure if I have IDs wrong or if its a level issue or a bug. I tested the script on the latest eqemu source and peq db with a level 85 toon.


# A script for a buff bot
sub EVENT_SAY {

if ($text =~/Hail/i)
{ quest::say ("Hello $name. Would you like some [free buffs] or a [heal] to help you on your travels?"); }

if ($text=~/free buffs/i)
{quest::say ("There you go. Enjoy your free buffs");
quest::selfcast(27;
quest::selfcast(457);
quest::selfcast(1693);
quest::selfcast(2176);
quest::selfcast(2177);
quest::selfcast(3692);
quest::selfcast(3467);
quest::selfcast(2570);
}

elsif ($text =~/heal/i)
{ quest::say ("There you go your all patched up $name");
quest::selfcast(13);
}
}

If anyone can tell me whats wrong it would be greatly appreciated

Note: This is my very first perl script
Note2: The smiley face is an 8 not sure why its a smiley face lol
Reply With Quote
  #2  
Old 02-22-2013, 08:41 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

"...your all patched up", Hehe. And what do you mean what's wrong with it? It's pretty basic, you could make it more complex, but it's not completely necessary. Question?: Why are the buffs are equal for levels 1-85. I would change quest::say to plugin::Whisper unless you want to flood your chat, my edits below. Sorry for being so blunt. You could also add saylinks.

Edit: Also, post scripts within Code blocks, [ code ]* before, [ /code ]* one line after the end of the script.

*NO Spaces.

Code:
# A script for a buff bot
sub EVENT_SAY 
{
my $buffs = quest::saylink("Free Buffs", 1);
my $heal = quest::saylink("Heal", 1);

if($text =~/Hail/i)
{ 
plugin::Whisper("Hello $name. Would you like some [$buffs] or a [$heal] to help you on your travels?"); 
}

if($text=~/Free Buffs/i)
{
plugin::Whisper("There you go. Enjoy your free buffs");
quest::selfcast(278);
quest::selfcast(457);
quest::selfcast(1693);
quest::selfcast(2176);
quest::selfcast(2177);
quest::selfcast(3692);
quest::selfcast(3467);
quest::selfcast(2570);
}

if($text =~/Heal/i)
{ 
plugin::Whisper("There you go you're all patched up, $name");
quest::selfcast(13);
}
}
Reply With Quote
  #3  
Old 02-22-2013, 08:56 PM
Dabloon
Sarnak
 
Join Date: Oct 2007
Posts: 78
Default

The issue i was having is it isnt casting all the buffs and thank you by the way for the tips
Reply With Quote
  #4  
Old 02-22-2013, 08:59 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

Is it still not casting all the buffs? And no problem, if you would like a buff bot based upon level, just ask. Haha.
Reply With Quote
  #5  
Old 02-22-2013, 09:05 PM
Dabloon
Sarnak
 
Join Date: Oct 2007
Posts: 78
Default

That would be great. Made this script as an experiment trying to learn a bit of perl
Reply With Quote
  #6  
Old 02-22-2013, 09:07 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

Here you go, all the way to 85.

Code:
@SpellName10 = ("Center", "Spirit of Bear", "Feet like Cat", "Dextrous Aura", "Strengthen", "Quickness", "Breeze", "Spirit of Wolf", "Shield of Brambles", "Complete Heal");
@SpellName20 = ("Daring", "Turtle Skin", "Spirit of Cat", "Protection of Rock", "Spirit Strength", "Alacrity", "Clarity", "Spirit of Wolf", "Shield of Spikes", "Complete Heal");
@SpellName30 = ("Bravery", "Spirit of Ox", "Spirit of Cat", "Rising Dexterity", "Raging Strength", "Augmentation", "Clarity II", "Spirit of the Shrew", "Shield of Thorns", "Complete Heal");
@SpellName40 = ("Valor", "Health", "Nimble", "Deftness", "Furious Strength", "Celerity", "Boon of the Clear Mind", "Pack Spirit", "Legacy of Spike", "Complete Heal");
@SpellName50 = ("Blessing of Temperance", "Stamina", "Agility", "Dexterity", "Strength", "Swift like the Wind", "Gift of Pure Thought", "Spirit of Eagle", "Shield of Blades", "Complete Heal");
@SpellName60 = ("Aegolism", "Talisman of the Brute", "Talisman of the Cat", "Mortal Deftness", "Talisman of the Rhino", "Augment", "Koadic's Endless Intellect", "Spirit of Eagle", "Legacy of Thorn", "Complete Heal");
@SpellName65 = ("Virtue", "Focus of the Seventh", "Sylvan Infusion", "Protection of the Nine", "Visions of Grandeur", "Tranquility", "Circle of Seasons", "Spirit of Eagle", "Shield of Bracken", "Complete Heal");
@SpellName70 = ("Hand of Virtue", "Talisman of Wunshi", "Chlorotrope", "Steeloak Skin", "Vallon's Quickening", "Clairvoyance", "Protection of Seasons", "Flight of Eagles", "Nettle Shield", "Complete Heal");


@spellID10 = ("219", "279", "269", "266", "40", "39", "697", "278", "46", "129", "13");
@spellID20 = ("89", "283", "148", "2512", "147", "170", "174", "278", "46", "432", "13");
@spellID30 = ("244", "149", "148", "349", "151", "10", "1693", "4054", "356", "13");
@spellID40 = ("312", "161", "160", "152", "153", "171", "1694", "169", "1727", "13");
@spellID50 = ("4053", "158", "154", "157", "159", "172", "1695", "2517", "1560", "13");
@spellID60 = ("1447", "1580", "1579", "1596", "1581", "1729", "2570", "2517", "1561", "13");
@spellID65 = ("3467", "3397", "4883", "3234", "1710", "3350", "2519", "2517", "3448", "13");
@spellID70 = ("3479", "5415", "5355", "5352", "3178", "5513", "3444", "3185", "5358", "13");



sub EVENT_SAY
{
	my $Buff = quest::saylink("buffs", 1);
	my $heal = quest::saylink("heal", 1);
	my $cure = quest::saylink("cure", 1);
	my $speed = quest::saylink("speed", 1);
	my $KEI = quest::saylink("KEI", 1);
	my $NPCName = $npc->GetCleanName();
	my $total = 11;
	my $n = 0;
	my $Group = $client->GetGroup();

		if($text=~/Hail/i)
		{
			$client->Message(315, "$NPCName whispers to you, 'Hello, $name. Do you need $Buff? If you're in a Group you will get Group Buffs, if you're alone you will get Solo Buffs. Or maybe you need a $cure, $speed, $KEI, or a $heal?'");
		}
		
		if($text=~/Heal/i)
		{
			quest::selfcast(13);
			$client->Message(315, "$NPCName whispers to you, 'You have been healed! Enjoy!'");
		}
		
		if($text=~/Cure/i)
		{
			quest::selfcast(11274);
			$client->Message(315, "$NPCName whispers to you, 'You have been cured! Enjoy!'");
		}
		
		if($text=~/Speed/i)
		{
			quest::selfcast(1212);
			$client->Message(315, "$NPCName whispers to you, 'Enjoy!'");
		}
		
		if($text=~/KEI/i)
		{
			quest::selfcast(2570);
			$client->Message(315, "$NPCName whispers to you,' Enjoy!");
		}
	
		if($text=~/Buffs/i) 
		{			
			if($Group) 
			{
				
				if($ulevel<=10)
				{
					
					$Group->CastGroupSpell($npc, $spellID10[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID10[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID10[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID10[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID10[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID10[$n]);
					$n++;
				
					$Group->CastGroupSpell($npc, $spellID10[$n]);
					$n++;
			
					$Group->CastGroupSpell($npc, $spellID10[$n]);
					$n++;
			
					$Group->CastGroupSpell($npc, $spellID10[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID10[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID10[$n]);
					$n++;
				}

				if($ulevel>=11 && $ulevel<=20)
				{
					
					$Group->CastGroupSpell($npc, $spellID20[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID20[$n]);
					$n++;
			
					$Group->CastGroupSpell($npc, $spellID20[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID20[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID20[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID20[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID20[$n]);
					$n++;
		
					$Group->CastGroupSpell($npc, $spellID20[$n]);
					$n++;	
						
					$Group->CastGroupSpell($npc, $spellID20[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID20[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID20[$n]);
					$n++;
				}

				if($ulevel>=21 && $ulevel<=30)
				{	
					
					$Group->CastGroupSpell($npc, $spellID30[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID30[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID30[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID30[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID30[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID30[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID30[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID30[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID30[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID30[$n]);
					$n++;
				}

				if($ulevel>=31 && $ulevel<=40)
				{
					
					$Group->CastGroupSpell($npc, $spellID40[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID40[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID40[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID40[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID40[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID40[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID40[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID40[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID40[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID40[$n]);
					$n++;
				}


				if($ulevel>=41 && $ulevel<=50)
				{
					
					$Group->CastGroupSpell($npc, $spellID50[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID50[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID50[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID50[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID50[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID50[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID50[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID50[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID50[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID50[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID50[$n]);
					$n++;
				}

				if($ulevel>=51 && $ulevel<=60)
				{
					
					$Group->CastGroupSpell($npc, $spellID60[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID60[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID60[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID60[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID60[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID60[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID60[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID60[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID60[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID60[$n]);
					$n++;
				}

				if($ulevel>=61 && $ulevel<=65)
				{
					
					$Group->CastGroupSpell($npc, $spellID65[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID65[$n]);
					$n++;
				
					$Group->CastGroupSpell($npc, $spellID65[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID65[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID65[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID65[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID65[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID65[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID65[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID65[$n]);
					$n++;
				}

				if($ulevel>=66 && $ulevel<=85)
				{
					
					$Group->CastGroupSpell($npc, $spellID70[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID70[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID70[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID70[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID70[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID70[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID70[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID70[$n]);
					$n++;

					$Group->CastGroupSpell($npc, $spellID70[$n]);
					$n++;
					
					$Group->CastGroupSpell($npc, $spellID70[$n]);
					$n++;
				}				
			}
			else
			{
				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, 'Enjoy!'");
				}
				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, 'Enjoy!'");
				}
				if (($ulevel >= 25) && ($ulevel < 51)) 
				{
					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, 'Enjoy!'");
				}
				if ($ulevel >= 51) 
				{
					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, 'Enjoy!'");
				}
			}
		}	
	}	
}
Reply With Quote
  #7  
Old 02-22-2013, 09:35 PM
Dabloon
Sarnak
 
Join Date: Oct 2007
Posts: 78
Default

lol that worked great thank you. Casts without saying anything after hail though but great none the less. To be honest im perfectly ok with that. My server isnt that populated (usually just me) so it isnt a big deal and thanks again for the script
Reply With Quote
  #8  
Old 02-22-2013, 09:35 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

No problem, haha.
Reply With Quote
  #9  
Old 02-22-2013, 09:40 PM
Dabloon
Sarnak
 
Join Date: Oct 2007
Posts: 78
Default

One of my future projects is a gambling bot but im net yet working on that 1
Reply With Quote
  #10  
Old 02-22-2013, 09:58 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

instead of the blocks that look like this
Code:
$Group->CastGroupSpell($npc, $spellID10[$n]);
$n++;

$Group->CastGroupSpell($npc, $spellID10[$n]);
$n++;

$Group->CastGroupSpell($npc, $spellID10[$n]);
$n++;

$Group->CastGroupSpell($npc, $spellID10[$n]);
$n++;

$Group->CastGroupSpell($npc, $spellID10[$n]);
$n++;

$Group->CastGroupSpell($npc, $spellID10[$n]);
$n++;

$Group->CastGroupSpell($npc, $spellID10[$n]);
$n++;

$Group->CastGroupSpell($npc, $spellID10[$n]);
$n++;

$Group->CastGroupSpell($npc, $spellID10[$n]);
$n++;

$Group->CastGroupSpell($npc, $spellID10[$n]);
$n++;

$Group->CastGroupSpell($npc, $spellID10[$n]);
$n++;
you can use a single line like this
Code:
$Group->CastGroupSpell($npc, $_) for @spellID10;
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #11  
Old 02-22-2013, 09:59 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

0.o I just happen to have one of those too, but I'd like to see how you make yours before I give you mine. Haha.
Reply With Quote
  #12  
Old 02-22-2013, 10:16 PM
Dabloon
Sarnak
 
Join Date: Oct 2007
Posts: 78
Default

Reserching for it now hehe
Reply With Quote
  #13  
Old 02-22-2013, 11:10 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

Thanks C0ncrete, I wrote that script a while back, almost 2 months ago, hehe.
Reply With Quote
  #14  
Old 02-22-2013, 11:20 PM
Dabloon
Sarnak
 
Join Date: Oct 2007
Posts: 78
Default

Was thinking of using the rand function to generate random numbers but having issues figuring out how to get it to display the result of rand in quest::say
Reply With Quote
  #15  
Old 02-23-2013, 12:06 AM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

Code:
$random_result = 0;
my $random_result = int(rand(##));
Just put this:
Code:
quest::say("You rolled a $random_result!");
Edit: Make sure to replace ## with the number you want to be the max value.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

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


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3