Thread: review my work?
View Single Post
  #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 <= 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 <= $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