Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Quests

Archive::Quests Archive area for Quests's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-11-2004, 01:46 PM
8ball
Fire Beetle
 
Join Date: Sep 2004
Posts: 12
Default review my work?

was wondering if someone could review my work. ive been testing out a few things.
please respond with any errors i have.

Code:
#practice script

sub EVENT_SAY
{
	if($text=~/hail/i)
	{
		quest::say("Greetings $name. I can perform multiple [tasks] for you.");
	}
	if($text=~/what tasks/i)
	{
		quest::say("I can raise your [level] to whatever you wish, I can [save] your
			progress, and summon a [weapon] for you");
	}
	if($text=~/level/i)
	{
		quest::say("State the level you wish to be.");
	}
	$level = $level;
		if($text=~/$level/i)
		{
			quest::level($level);
			quest::say("You have been leveled");
		}
	if($text=~/save/i)
	{
		quest::save();
		quest::say("You have been saved");
	}
	if($text=~/what weapon/i)
	{
		quest::say("I can summon a random magical weapon for you. Decide now whether you want
			it or not.");
	}
	if($text=~/yes/i)
	{
		$random = int(rand(55261,24773,25989,22982,26031,54065,43148,7823));
			quest::summonitem($random);
			quest::say("Your weapon has been summoned.");
	}
}

sub EVENT_ITEM
{
	{
		quest::say("I do not require payment of any kind.");
	if($item1 > 0){quest::summonitem("$item1");} 
	if($item2 > 0){quest::summonitem("$item2");} 
	if($item3 > 0){quest::summonitem("$item3");} 
	if($item4 > 0){quest::summonitem("$item4");}
	if($platinum != 0 || $gold !=0 || $silver != 0 || $copper != 0) {
		quest::givecash($platinum, $gold, $silver, $copper);}
	}
}
also, so im not accused of stealing, the return items/cash piece at the end i got from sotonin. saw it in one of his quests and decided to use it since it is really useful thanks sotonin
Reply With Quote
  #2  
Old 09-11-2004, 01:50 PM
sotonin
Demi-God
 
Join Date: May 2004
Posts: 1,177
Default

It's ok. i didnt write it either, i got it from somebody here on the forums and posted it for all to use. glad you got some use from it. )
Reply With Quote
  #3  
Old 09-11-2004, 02:18 PM
animepimp
Dragon
 
Join Date: Jan 2004
Posts: 860
Default

Code:
$level = $level; 
      if($text=~/$level/i) 
      { 
         quest::level($level); 
         quest::say("You have been leveled"); 
      }
This block of code is completely not what you want. $level = $level; will not change anything at all. if($text=~/$level/i) will only be true if they say whatever $level is. Since you didn't really give it any value it'll never be true. Or does $level store the current level of the user? If so then it will level them to their current level. essentially doing nothing at all.


Code:
$random = int(rand(55261,24773,25989,22982,26031,54065,43148,7823));
This is also not going to do what you want at all. rand doesn't accept input, so it'll ignore anything you give it. You will end up with a completely random number between 0 and the max rand can make.
Reply With Quote
  #4  
Old 09-11-2004, 02:39 PM
8ball
Fire Beetle
 
Join Date: Sep 2004
Posts: 12
Default

what i was trying to do with the $level = $level thing was i wanted the person to just say a number, then use quest::level($level) to level them up to there desired level.

edit---

maybe this would work?

Code:
{
 int $level;
 if($text=~/$level/i)
  {
    quest::level($level);
  }
}
Reply With Quote
  #5  
Old 09-11-2004, 04:28 PM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

Quote:
Originally Posted by 8ball
what i was trying to do with the $level = $level thing was i wanted the person to just say a number, then use quest::level($level) to level them up to there desired level.

edit---

maybe this would work?

Code:
{
 int $level;
 if($text=~/$level/i)
  {
    quest::level($level);
  }
}
Try this.
Code:
{
if($text >= $ulevel)
  {
  quest::say("You are now level $text.");
  quest::level($text);
  }
if($text == $ulevel)
  {
  quest::say("You are already level $ulevel.");
  }
if($text <= $ulevel)
  {
  $difference = ($ulevel-$text);
  $levelto = ($text);
  quest::say("Are you sure you want to de-level $difference levels? [Yes] or [No].");
  }
if($text=~/yes/i)
  {
  if($difference != 0)
    {
    quest::level($levelto);
    $difference="0"
    $levelto="0"
    }
  else
    {
    quest::say("Yes what?");
    }
  }
if($text=~/no/i)
  {
  if($difference != 0)
    {
    quest::say("Alright then.");
    $difference="0"
    $levelto="0"
    }
  else
    {
    quest::say("No what?");
    }
  }
}
I think that should work. But not sure?
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
Reply With Quote
  #6  
Old 09-11-2004, 05:10 PM
8ball
Fire Beetle
 
Join Date: Sep 2004
Posts: 12
Default

thanks ill try that
Reply With Quote
  #7  
Old 09-11-2004, 05:35 PM
animepimp
Dragon
 
Join Date: Jan 2004
Posts: 860
Default

That code should work alright, but it'll be really weird because "hi" is >= "20". so if the input any text like hailing the NPC it'll try to level("Hail") the and that will probably cause problems.
Reply With Quote
  #8  
Old 09-11-2004, 06:20 PM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

Quote:
Originally Posted by animepimp
That code should work alright, but it'll be really weird because "hi" is >= "20". so if the input any text like hailing the NPC it'll try to level("Hail") the and that will probably cause problems.
It is? err.. Lets try this..

Code:
{ 
if($text == $text)
  {
  if($text &lt;= 255)
   {
   $xlevel = ($text);
   if($xlevel >= $ulevel) 
     { 
     quest::say("You are now level $text."); 
     quest::level($xlevel); 
     } 
   if($xlevel == $ulevel) 
     { 
     quest::say("You are already level $ulevel."); 
     } 
   if($xlevel &lt;= $ulevel) 
     { 
     $difference = ($ulevel-$xlevel); 
     $levelto = ($xlevel); 
     quest::say("Are you sure you want to de-level $difference levels? [Yes] or [No]."); 
     } 
   if($text=~/yes/i) 
     { 
     if($difference != 0) 
       { 
       quest::level($levelto); 
       $difference="0";
       $levelto="0";
       $xlevel="0";
       } 
     else 
       { 
       quest::say("Yes what?"); 
       } 
     } 
   if($text=~/no/i) 
     { 
     if($difference != 0) 
       { 
       quest::say("Alright then."); 
       $difference="0" 
       $levelto="0" 
       } 
     else 
       { 
       quest::say("No what?"); 
       } 
     }
    else
     { 
     quest::say("What was that?");
     }
   }
 }
Mind you Its 2:20 AM Im very sleepy, this could be very very wrong, lol.
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
Reply With Quote
  #9  
Old 09-12-2004, 04:50 AM
8ball
Fire Beetle
 
Join Date: Sep 2004
Posts: 12
Default

thank you thats exactly what i was looking for
Reply With Quote
  #10  
Old 09-12-2004, 12:58 PM
m0oni9
Hill Giant
 
Join Date: Dec 2003
Posts: 166
Default

For the random weapon thing, you could probably pick a random index out of an array -- ie, something like:
Code:
my @nums = (55261,24773,25989,22982,26031,54065,43148,7823);
srand();
my $weapon = $nums[int(rand() * ($#nums + 1))];
print "random weapon: $weapon\n";
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 01:41 AM.


 

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