Hackerboard Wiki HaboBlog
Hackerboard bei Facebook Hackerboard bei Google+ Hackerboard bei Twitter

[HaBo]

 
(Web-) Design und webbasierte Sprachen Tipps & Tricks, Designabgleich, HTML & Javascript, Flash, ASP, PHP, Perl/CGI...

BOT programieren [webgame]

Diskussion: BOT programieren [webgame] im Forum (Web-) Design und webbasierte Sprachen, in der Kategorie Web, Network & Multimedia Palace; Anzeige Gibt es eine anleitung wie ich einen bot für ein onlinespiel progen kann ? Bots sind da nicht verboten. ...

Thema geschlossen
Alt 16.09.05, 16:11   #1 (permalink)
 
Registriert seit: 04.09.05
Dragon2003 Leistung: Facit NTK
Likes: 0
Standard BOT programieren [webgame]

Anzeige

Gibt es eine anleitung wie ich einen bot für ein onlinespiel progen kann ?
Bots sind da nicht verboten. (warscheinlich ein fehler in den AGB *sfg*)
Also alles legal.
Mir gehts um die grundlagen wie Logt sich ein bot ein wie kann ich befehle geben wie kann der bot reagieren auf ereignisse (keine resis oder so)

Dragon2003 ist offline  
Alt 17.09.05, 23:27   #2 (permalink)
 
Registriert seit: 04.04.05
BlackSpring Leistung: Facit NTK
BlackSpring eine Nachricht über ICQ schicken
Likes: 0
Standard

wenn du dann noch sagen könntest, ob der innen irc soll und in was du den proggen willst....
BlackSpring ist offline  
   
HaBOT
 
- Anzeige -

Werbung ist gerade online    
Alt 18.09.05, 00:28   #3 (permalink)
Senior Member
 
Benutzerbild von -=Draven=-
 
Registriert seit: 07.07.03
-=Draven=- Leistung: Facit NTK
-=Draven=- eine Nachricht über ICQ schicken -=Draven=- eine Nachricht über AIM schicken -=Draven=- eine Nachricht über Yahoo! schicken
Likes: 7
Standard

Zitat:
Original von BlackSpring
wenn du dann noch sagen könntest, ob der innen irc soll und in was du den proggen willst....
Vermute mal das er nen Bot für nen Browsergame haben möchte.
So das er nicht den ganzen tag am pc sitzen muss...
-=Draven=- ist offline  
Alt 18.09.05, 00:50   #4 (permalink)
 
Registriert seit: 07.06.05
Hashishin Leistung: Facit NTK
Likes: 0
Standard

für ein browsergame?

da würd ich vorher aber nochmal ganz genau die regeln lesen...
wo ich spiele würde dies als scripten zählen, und mit account-löschung bestraft werden...

aber viel spass noch
Hashishin ist offline  
Alt 18.09.05, 01:05   #5 (permalink)
Themenstarter
 
Registriert seit: 04.09.05
Dragon2003 Leistung: Facit NTK
Likes: 0
Standard

Jo genau soll für ein browsergame sein.
Ich hab die AGB genau durchgelesen und da steht nix das es verboten ist.
Wenn möglich will ich das in JS und PHP mit MySQL progen.
Ich hab da leider keine ahnung wie ich das machen kann und suche daher ein tutorial das sich mit dem thema beschäftigt.

Der bot soll:
automatisch verschiedene seite lesen und auswerten. (highscore usw.)
Es soll möglichsein eine bau querry zu erstellen (das zu bestimmten zeitpunkten gebaut wird.)
Mich bei besonderen ereignissen mit einem warnton aufmerksam machen. (oder mir ne mail schicken wenn ich im büro bin *g*)

Nur wie bekomme ich das hin das das script sich auf der seite einlocken kann und links "anklickt" usw.
Mir fehlt da der ansatz.
Dragon2003 ist offline  
Alt 18.09.05, 01:36   #6 (permalink)
 
Registriert seit: 04.04.05
BlackSpring Leistung: Facit NTK
BlackSpring eine Nachricht über ICQ schicken
Likes: 0
Standard

ich poste jetzt hier einfach mal nen php bot der eigentlich fürs irc ist....

php code:

Code:
/* Variables that determine server, channel, etc */
$CONFIG = array();
$CONFIG['server'] = '[server]'; // server 
$CONFIG['nick'] = '[botnick]'; // nick (i.e. Duane
$CONFIG['port'] = 6667; // port (standard: 6667)
$CONFIG['channel'] = '[channel]'; // channel  in den der bot joinen soll
$CONFIG['name'] = '[name]'; // bot name 
$CONFIG['admin_pass'] = '[pw]';

/* Let it run forever (no timeouts) */
set_time_limit(0);

/* The connection */
$con = array();

/* start the bot... */
init();

function init()
{
	global $con, $CONFIG;
	/* We need this to see if we need to JOIN (the channel) during
	the first iteration of the main loop */
	$firstTime = true;
	
	/* Connect to the irc server */
	$con['socket'] = fsockopen($CONFIG['server'], $CONFIG['port']);
	
	/* Check that we have connected */
	if (!$con['socket']) {
		print ("Could not connect to: ". $CONFIG['server'] ." on port ". $CONFIG['port']);
	} else {
		/* Send the username and nick */
		cmd_send("USER ". $CONFIG['nick'] ." codedemons.net codedemons.net :". $CONFIG['name']);
		cmd_send("NICK ". $CONFIG['nick'] ." codedemons.net");
		
		/* Here is the loop. Read the incoming data (from the socket connection) */
		while (!feof($con['socket']))
		{
			/* Think of $con['buffer']['all'] as a line of chat messages.
			We are getting a 'line' and getting rid of whitespace around it. */
			$con['buffer']['all'] = trim(fgets($con['socket'], 4096));
			
			/* Pring the line/buffer to the console
			I used <- to identify incoming data, -> for outgoing. This is so that
			you can identify messages that appear in the console. */
			print date("[d/m @ H:i]")."<- ".$con['buffer']['all'] ."\n";
			
			/* If the server is PINGing, then PONG. This is to tell the server that
			we are still here, and have not lost the connection */
			if(substr($con['buffer']['all'], 0, 6) == 'PING :') {
				/* PONG : is followed by the line that the server
				sent us when PINGing */
				cmd_send('PONG :'.substr($con['buffer']['all'], 6));
				/* If this is the first time we have reached this point,
				then JOIN the channel */
				if ($firstTime == true){
					cmd_send("JOIN ". $CONFIG['channel']);
					/* The next time we get here, it will NOT be the firstTime */
					$firstTime = false;
				}
				/* Make sure that we have a NEW line of chats to analyse. If we don't,
				there is no need to parse the data again */
			} elseif ($old_buffer != $con['buffer']['all']) {
				/* Determine the patterns to be passed
				to parse_buffer(). buffer is in the form:
				:username!~identd@hostname JOIN :[channel]
				:username!~identd@hostname PRIVMSG [channel] :action text
		                    :username!~identd@hostname command channel :text */
				
				/*
				Right now this bot does nothing. But this is where you would
				add some conditions, or see what is being said in the chat, and then 
				respond. Before you try doing that you should become familiar with
				how commands are send over IRC. Just read the console when you run this
				script, and then you will see the patterns in chats, i.e. where the username
				occurs, where the hostmask is, etc. All you need is functions such as
				preg_replace_callback(), or perhaps your own function that checks for patterns
				in the text.
				
				Good Luck.
				*/
				// log the buffer to "log.txt" (file must have
				// already been created).
				// log_to_file($con['buffer']['all']);
				
				// make sense of the buffer
				parse_buffer();
				
				// now process any commands issued to the bot
				process_commands();
				
			}
			$old_buffer = $con['buffer']['all'];
		}
	}
}

/* Accepts the command as an argument, sends the command
to the server, and then displays the command in the console
for debugging */
function cmd_send($command)
{
	global $con, $time, $CONFIG;
	/* Send the command. Think of it as writing to a file. */
	fputs($con['socket'], $command."\n\r");
	/* Display the command locally, for the sole purpose
	of checking output. (line is not actually not needed) */
	print (date("[d/m @ H:i]") ."-> ". $command. "\n\r");
	
}

function log_to_file ($data)
{
	$filename = "log.txt";
	$data .= "\n";
	// open the log file
	if ($fp = fopen($filename, "ab"))
    {
        // now write to the file
        if ((fwrite($fp, $data) === FALSE))
        {
            echo "Could not write to file.<br />";
        }
    }
    else
    {
        echo "File could not be opened.<br />";
    }
}

function process_commands()
{
	global $con, $CONFIG;
	
	/* TIME */
	if(strtoupper($con['buffer']['text']) == '.TIME') {
		cmd_send(prep_text("Time", date("F j, Y, g:i a", time())));
	}
	
	/* NICK */
	if (substr(strtoupper($con['buffer']['text']), 0, 5) == ".NICK"){
		$args = explode(" ", $con['buffer']['text']);
		
		if (count($args) < 3)
		cmd_send(prep_text("Nick", "Syntax: .nick admin_pass new_nick"));
		else
		{
			if ($args[1] == $CONFIG['admin_pass'])
			cmd_send("NICK ". $args[2]);
			else
			cmd_send(prep_text("Nick", "Invalid password"));
		}
	}
	
	/* Noob */
	if(strtoupper(substr($con['buffer']['text'], 0, 5)) == '.NOOB') {
		$args = explode(" ", $con['buffer']['text'], 2);
		$name = (!empty($args[1]))?$args[1]:"beginner";
		cmd_send(prep_text("Beginner Help", "Welcome, ".$name.", to PHP! Some tutorials: www.codedemons.net, www.zend.com, www.phpbuilder.com, www.php.net"));
	}
	
	/* No PMs */
	if(strtoupper(substr($con['buffer']['text'], 0, 5)) == '.PM') {
		cmd_send(prep_text("please"," Please do not send PMs to ops/peons unless you have asked first."));
	}
}

function parse_buffer()
{
	
	/*
	:username!~identd@hostname JOIN :[channel]
	:username!~identd@hostname PRIVMSG [channel] :action text
	:username!~identd@hostname command channel :text
	*/
	
	global $con, $CONFIG;
		
	$buffer = $con['buffer']['all'];
	$buffer = explode(" ", $buffer, 4);
	
	/* Get username */
	$buffer['username'] = substr($buffer[0], 1, strpos($buffer['0'], "!")-1);
	
	/* Get identd */
	$posExcl = strpos($buffer[0], "!");
	$posAt = strpos($buffer[0], "@");
	$buffer['identd'] = substr($buffer[0], $posExcl+1, $posAt-$posExcl-1); 
	$buffer['hostname'] = substr($buffer[0], strpos($buffer[0], "@")+1);
	
	/* The user and the host, the whole shabang */
	$buffer['user_host'] = substr($buffer[0],1);
	
	/* Isolate the command the user is sending from
	the "general" text that is sent to the channel
	This is  privmsg to the channel we are talking about.
	
	We also format $buffer['text'] so that it can be logged nicely.
	*/
	switch (strtoupper($buffer[1]))
	{
		case "JOIN":
		   	$buffer['text'] = "*JOINS: ". $buffer['username']." ( ".$buffer['user_host']." )";
			$buffer['command'] = "JOIN";
			$buffer['channel'] = $CONFIG['channel'];
		   	break;
		case "QUIT":
		   	$buffer['text'] = "*QUITS: ". $buffer['username']." ( ".$buffer['user_host']." )";
			$buffer['command'] = "QUIT";
			$buffer['channel'] = $CONFIG['channel'];
		   	break;
		case "NOTICE":
		   	$buffer['text'] = "*NOTICE: ". $buffer['username'];
			$buffer['command'] = "NOTICE";
			$buffer['channel'] = substr($buffer[2], 1);
		   	break;
		case "PART":
		  	$buffer['text'] = "*PARTS: ". $buffer['username']." ( ".$buffer['user_host']." )";
			$buffer['command'] = "PART";
			$buffer['channel'] = $CONFIG['channel'];
		  	break;
		case "MODE":
		  	$buffer['text'] = $buffer['username']." sets mode: ".$buffer[3];
			$buffer['command'] = "MODE";
			$buffer['channel'] = $buffer[2];
		break;
		case "NICK":
			$buffer['text'] = "*NICK: ".$buffer['username']." => ".substr($buffer[2], 1)." ( ".$buffer['user_host']." )";
			$buffer['command'] = "NICK";
			$buffer['channel'] = $CONFIG['channel'];
		break;
		
		default:
			// it is probably a PRIVMSG
			$buffer['command'] = $buffer[1];
			$buffer['channel'] = $buffer[2];
			$buffer['text'] = substr($buffer[3], 1);	
		break;	
	}
	$con['buffer'] = $buffer;
}

function prep_text($type, $message)
{
	global $con;
	return ('PRIVMSG '. $con['buffer']['channel'] .' :['.$type.']'.$message);
}
?>
BlackSpring ist offline  
Alt 18.09.05, 11:21   #7 (permalink)
 
Registriert seit: 07.06.05
Hashishin Leistung: Facit NTK
Likes: 0
Standard

sag mir mal für welches browsergame....ich kann mir einfach nicht vorstellen das scripten enebled is^^

außer du spielst ogame, da werden ja auch account und ressorcen bei ebay verscherbelt...
Hashishin ist offline  
Alt 18.09.05, 16:28   #8 (permalink)
 
Registriert seit: 15.10.04
sheepd Leistung: Facit NTK
Likes: 0
Standard

Dir ist aber klar, dass ein in PHP "programmierter" Bot nicht läuft, wenn niemand die Seite aufruft?
sheepd ist offline  
Alt 18.09.05, 17:40   #9 (permalink)
 
Registriert seit: 21.06.05
theo Leistung: Facit NTK
theo eine Nachricht über ICQ schicken theo eine Nachricht über AIM schicken
Likes: 0
Standard

es sei denn ... www.cronjob.de
theo ist offline  
Alt 18.09.05, 18:35   #10 (permalink)
Themenstarter
 
Registriert seit: 04.09.05
Dragon2003 Leistung: Facit NTK
Likes: 0
Standard

Jo hatte auch schon an gronjobs gedacht oder ein js counter die seite muß halt auf bleiben aber js kann ja zeitgesteuert sachen ausführen.

In welcher sprache sind denn so browsergame bots sonnst gemacht ?
Dragon2003 ist offline  
Alt 18.09.05, 19:16   #11 (permalink)
 
Registriert seit: 04.04.05
BlackSpring Leistung: Facit NTK
BlackSpring eine Nachricht über ICQ schicken
Likes: 0
Standard

ich glaube bots kannst du so ziemlich in jeder programmiersprache schreiben
VB, c++, php, mirc remote......undundund......
BlackSpring ist offline  
Alt 19.09.05, 14:23   #12 (permalink)
 
Registriert seit: 25.08.04
Sunstepper Leistung: Facit NTK
Likes: 0
Standard

Sagt mal, spinnt Ihr hier komplett?!
Ihr helft gerade einem Kiddy beim Cheaten in einem Onlinespiel!

Als junges Team vergisst man gerne mal ein paar Dinge bei den Nutzungsbedingungen bzw. eine Kiddy-Bot-Protection. Ich finde das unverschämt dreist, sowas auszunutzen.

Sowohl die Entwickler als auch die Spieler stecken Unmengen an Zeit in ein solches Spiel. Und mit einem Bot wird die Spielbalance einfach ausgehebelt. Du untergräbst die Arbeit der Entwickler und machst die Zeit, die andere Spieler in das Spiel stecken, zunichte.
Oft zerstören Bots und Cheats in Browserspielen sogar die gesamte Community.

Wenn das Spiel zu viel Zeit braucht, solltest du eher darüber nachdenken ein anderes Spiel zu spielen.

Ich kann wirklich nicht verstehen, wie man solchen Dummköpfen auch noch helfen kann. Wenn das nicht ins Planschbecken gehört, weiß ich nicht was dann...
Sunstepper ist offline  
Alt 19.09.05, 14:44   #13 (permalink)
 
Registriert seit: 07.06.05
Hashishin Leistung: Facit NTK
Likes: 0
Standard

sag ich doch

siehe
Zitat:
sag mir mal für welches browsergame....ich kann mir einfach nicht vorstellen das scripten enebled is
allerdings ist es nicht deine entscheidung zu entscheiden was ins becken gehört, sondern sache der admins...
und das du andere auch noch beleidigen musst... das geht auch netter!
Hashishin ist offline  
Alt 19.09.05, 16:12   #14 (permalink)
 
Registriert seit: 04.04.05
BlackSpring Leistung: Facit NTK
BlackSpring eine Nachricht über ICQ schicken
Likes: 0
Standard

Zitat:
und das du andere auch noch beleidigen musst... das geht auch netter!
o.O, das find ich auch......

da will man schonmal helfen und dann sowas......

falls ich da echt nen kapitalverbrechen begonnen hab, sry, bin kein onlinespielezocker, noch nichmal nen zocker und demzufolge hab auch ka wie die AGB's lauten oder lautn sollten.....
BlackSpring ist offline  
Alt 10.10.05, 23:54   #15 (permalink)
 
Registriert seit: 04.01.05
Sunrize Leistung: Facit NTK
Likes: 0
Standard

mach mal diverse aktionen in dem browsergame.
Du must herausfinden welche parameter übergeben werden. Wird GET verwendet, siehst Du das direkt in der adressleiste, sonst kannst du auch im html quellcode der seite nachsehen, welcher link was bewirkt.

Auf jedenfall baust Du Dir die korrekten befehle zusammen und löst die regelmässig aus, zb per cronjob
Sunrize ist offline  
Thema geschlossen
   
- Anzeige -

Werbung ist gerade online    

[HaBo] » Web, Network & Multimedia Palace » (Web-) Design und webbasierte Sprachen » BOT programieren [webgame]
Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind aus
Pingbacks sind aus
Refbacks sind aus


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
schnittiges WebGame sTEk Games 4 28.05.09 22:04
Pokersimulation programieren? Adis Code Kitchen 1 28.05.05 21:04
Swish Film Programieren Tron (Web-) Design und webbasierte Sprachen 1 26.03.04 14:17


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61