| (Web-) Design und webbasierte Sprachen Tipps & Tricks, Designabgleich, HTML & Javascript, Flash, ASP, PHP, Perl/CGI... |
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. ...
![]() |
| | #1 (permalink) |
| Registriert seit: 04.09.05 ![]() Likes: 0 | 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) |
| |
| | #2 (permalink) |
| wenn du dann noch sagen könntest, ob der innen irc soll und in was du den proggen willst.... | |
| |
| HaBOT | - Anzeige - |
| |
| | #3 (permalink) | |
| Senior Member ![]() | Zitat:
So das er nicht den ganzen tag am pc sitzen muss... | |
| |
| | #4 (permalink) |
| Registriert seit: 07.06.05 ![]() Likes: 0 | 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 |
| |
| | #5 (permalink) |
| Themenstarter Registriert seit: 04.09.05 ![]() Likes: 0 | 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. |
| |
| | #6 (permalink) |
| 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);
}
?> | |
| |
| | #7 (permalink) |
| Registriert seit: 07.06.05 ![]() Likes: 0 | 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... |
| |
| | #8 (permalink) |
| Registriert seit: 15.10.04 ![]() Likes: 0 | Dir ist aber klar, dass ein in PHP "programmierter" Bot nicht läuft, wenn niemand die Seite aufruft? |
| |
| | #9 (permalink) |
| es sei denn ... www.cronjob.de | |
| |
| | #10 (permalink) |
| Themenstarter Registriert seit: 04.09.05 ![]() Likes: 0 | 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 ? |
| |
| | #11 (permalink) |
| ich glaube bots kannst du so ziemlich in jeder programmiersprache schreiben VB, c++, php, mirc remote......undundund...... | |
| |
| | #12 (permalink) |
| Registriert seit: 25.08.04 ![]() Likes: 0 | 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... |
| |
| | #13 (permalink) | |
| Registriert seit: 07.06.05 ![]() Likes: 0 | sag ich doch ![]() siehe Zitat:
was ins becken gehört, sondern sache der admins...und das du andere auch noch beleidigen musst... das geht auch netter! | |
| |
| | #14 (permalink) | |
| Zitat:
![]() 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..... | ||
| |
| | #15 (permalink) |
| Registriert seit: 04.01.05 ![]() Likes: 0 | 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 |
| |
![]() |
| - Anzeige - | |
| |
| Themen-Optionen | |
| Ansicht | |
| |
Ä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 |