All pastes #26082 Raw Edit

Unnamed

public text v1 · immutable
#26082 ·published 2005-10-20 18:41 UTC
rendered paste body
	if ($type=="30")
	{
		$item_array = multilinkstoarray($message);
		print_r($item_array);
	}


	// make a lowercase version of the message and strip out any color codes
	$lowecase_message = strtolower(stripcolors($message));

	// erase any extra spaces (some people seem to love using the spacebar too much)
	$lowecase_message = ereg_replace('[[:space:]]+', ' ', $lowecase_message);

	// split the message up into words
	// ("trash" is there so that the first word will be word[1], not word[0])
	$word = split(' ',"trash ".$lowecase_message);




	// examine the item link, or popup window, or voice sound in a chat channel or a /tell
	if ( ($type==65 || $type==57 || $type==30)  && strlen($blob)>1)
		$blob_info = examine_blob($blob);
	print_r($blob_info);


	// if they send a /tell (and the message is not that they are AFK)
	if ($type==30
	    && $message!="The user is currently AFK."
	    && !stristr($message,"I am away from my keyboard right now")
	   )
	{

		// if the first word is "echo" then reply back with their message
		// for example, do /tell <bot> echo I like ATRoX
		if ($word[1]=="echo"){
			send_private_tell($sender,"$lowecase_message");
		}
		// if someone does    /tell <bot> breakdown <message>, the bot will demonstrate the word[] array by echoing it back
		// for example, do /tell <bot> breakdown this  IS   an Example      here?!
		elseif ($word[1]=="breakdown")
		{
			foreach($word as $number => $wordpart)
				$reply.="word[".$number."]=".$wordpart."   ";
			send_private_tell($sender,"$reply");
		}


		// here is an example of checking two words
		// for example, do /tell <bot> eat me
		elseif ($word[1]=="eat" && $word[2]=="me")
		{
			send_private_tell($sender,"grow up");
		}

		// here is an example of checking if the first word is any of a few combinations
		// for example, do /tell <bot> hi     or do /tell <bot> hello
		elseif ($word[1]=="hi" || $word[1]=="hello")
		{
						send_private_tell($sender,"hello");
		}
		elseif ($word[1]=="trade");
		                {
		                $trade = file_get_contents("C:/program files/funcom/anarchy online/cd_image/text/help/mainpage.txt");
		                send_private_tell($sender,'<a href="text://'.$trade.'"> Click to view items for sale!</a>');
										}
		// if you want to send out a message inside of a popup window
		// for example, do /tell <bot> blob
		elseif ($word[1]=="blob")
		{
			// invent some text to be inside the window
			$window_contents="welcome to my first popup window";

			// package up the text into a blob   (Binary Large OBject)
			// (if the window contents is meant for a /tell, you need to put "1" as the second argument in MakeWndBlob()
			//  if it was going to be for a chat channel, then you would have put "0" )
			$window_blob=MakeWndBlob($window_contents,1);

			// to make text in the tell clickable, you need to surround it with character #17 and character #18
			$reply="here is a message ".chr(17)."click here".chr(18)." in a popup window";


			send_private_tell($sender,$reply,$window_blob);
		}



		// if you want to join your bot's private chat channel
		// for example, do /tell <bot> join
		elseif ($word[1]=="join")
		{
			$AOChat_Pointer->privategroup_invite($sender);
		}

		// if you want to leave your bot's private chat channel
		// for example, do /tell <bot> leave
		elseif ($word[1]=="leave")
		{
			if ($word[2]!=""){
				$AOChat_Pointer->privategroup_part($word[2]);
			}else{
				$AOChat_Pointer->privategroup_kick($sender);
			}
		}