• What are you working on? V4 (HTML ISN'T PROGRAMMING)
    2,003 replies, posted
Added some more events to my IRC bot and cleaned a bit of code up. [img]http://farm3.static.flickr.com/2547/4060928036_2c5b0a05d4_o.png[/img] There's a bug visible in that screenshot. :v:
[QUOTE=Diaklu;18110665] There's a bug visible in that screenshot. :v:[/QUOTE] 13:27:7 is that the bugbug?
No it's actually the channel topic coming up blank then returning correctly. But that is also a bug from where I did System.DateTime.Now.Second.ToString(). Fixed that. [img]http://farm4.static.flickr.com/3510/4060228639_d9ec1c15f2_o.png[/img]
Agh having real problems with my game, scrolling works but it wont scroll the level too. I think I need to work out the scrolling then work out the scaling.
[QUOTE=Robert64]Bot game :words:[/url][/QUOTE] Why do we need this line? [code]author: name;[/code] You could/should get the author name from the registered username.
[QUOTE=Robber;18111798]Why do we need this line? [code]author: name;[/code] You could/should get the author name from the registered username.[/QUOTE] It does, that line is deprecated now.
[QUOTE=Robert64;18110187]Added a leaderboard: [url]http://www.robertandsherman.co.uk/botbattle/leaderboard.php[/url] Damnit I'm 4th on my own fucking game[/QUOTE] Fuck ye 15th place
[QUOTE=raccoon12;18111916]Fuck ye 16th place[/QUOTE] 12th :buddy: Why aren't we allowed to update our bots without erasing our scores? [B]Edit:[/B] 11th! :buddy::buddy:
It should actually keep track of versions and retire outdated bots.
And maybe make scores against bots only count if that other bot ever won. There's so many "do nothing" or "drive in walls" bots.
[QUOTE=Maurice;18112081]Why aren't we allowed to update our bots without erasing our scores?[/QUOTE] Ok, I'll make it optional. In other news, I just added traps! [code]// New commands: droptrap: bomb; // Drops a bomb that takes off 75 health. Takes 2 seconds to activate. Costs 100 ammo. droptrap: sticky; // Drops a sticky pad that freezes whatever bot touches it first in place for two seconds. Takes 2 seconds to activate. Costs 100 ammo. //New "if" statement params: trap_x // x position of nearest trap trap_y // y pos trap_dir // direction of trap relative to direction of bot (same as with enemy_dir etc) trap_dist // distance to nearest trap. They can get you if you are under 32 units from them[/code] edit: [QUOTE=Maurice;18112199]And maybe make scores against bots only count if that other bot ever won. There's so many "do nothing" or "drive in walls" bots.[/QUOTE] Good idea, so the score only counts if the opponent has won at least, say 5 of their games.
[QUOTE=Robert64;18111849]It does, that line is deprecated now.[/QUOTE] Quick question about the bot code; is there a return function at all? or a gosub? It would be easier to code bots if you can run a function then return to the point that you left off.
[QUOTE=Mattz333;18112209]Quick question about the bot code; is there a return function at all? or a gosub? It would be easier to code bots if you can run a function then return to the point that you left off.[/QUOTE] Well you could do something like this: [code]lable: sub 1; if: a = b; goto: sub 2; lable: split 1; end if; goto: sub 1; lable: sub 2; // do something goto: split 1;[/code] After going to "sub 2" it would go back to where it was in sub 1. Oh and a command I haven't used or told anyone of yet is "setvar". At the moment you can only use it to set a constant number, not, say the position of the enemy etc. Like this: [code]setvar: pies 14; if: pies / 2 = 7; // something end if;[/code] Which would do the something because 14 / 2 = 7.
[QUOTE=Robert64;18110187]Added a leaderboard: [url]http://www.robertandsherman.co.uk/botbattle/leaderboard.php[/url] Damnit I'm 4th on my own fucking game[/QUOTE] Very nice. This can be tricked though, by making your bot verse a really easy bot (like the 'null' one) over and over again. You should use a language such as Lua. It's easily done using [url=http://code.google.com/p/lua-alchemy/]lua-alchemy[/url]. It uses Adobe Alchemy to convert the Lua source (in C) to ActionScript. Your command system is kinda interesting, but Lua would be so much more awesome. It would allow users to make bots with more advance AI (even [url=http://codepad.org/hcRsBsn1]neural nets[/url]!) while not requiring you to add tonnes of new commands and functionality. Just remove the os library (don't load it at all) and it will be secure. You can easily create your own types and set their metatables so you can have enemies and other entities handled like in GMod. If you need a hand, just add me on GTalk: [email]deco.da.man@gmail.com[/email]
[QUOTE=Jallen;18110196]I'm too much of a noob to realise what that does but ok.[/QUOTE] Otherwise people could do stuff similar to this: [url]http://vulnerablesite.com/getfile.php?file=/etc/passwd[/url] However, you can circumvent that .txt security measure by adding a nullbyte after the GET parameter(which terminates a filename), so you'll have to remove all nullbytes.
[QUOTE=Deco Da Man;18112296]Very nice. This can be tricked though, by making your bot verse a really easy bot (like the 'null' one) over and over again.[/QUOTE] From what I found out; Only if your bot appears in random match it counts towards scores. Also I'm back at 12. Haha, my bot sucks.
[QUOTE=Deco Da Man;18112296]Your command system is kinda interesting, but Lua would be so much more awesome. It would allow users to make bots with more advance AI (even [url=http://codepad.org/hcRsBsn1]neural nets[/url]!) while not requiring you to add tonnes of new commands and functionality.[/QUOTE] Thanks for the info, when I port this to AS3 later I'll probably do this. I'm not sure if Alchemy will export to AS2, but I'd rather wait until this is on AS3 before I do anything too complex because this version is just a prototype more than anything else. [QUOTE=Maurice;18112334]From what I found out; Only if your bot appears in random match it counts towards scores.[/QUOTE] Yup
[QUOTE=DrTaxi;18112300]Otherwise people could do stuff similar to this: [url]http://vulnerablesite.com/getfile.php?file=/etc/passwd[/url] However, you can circumvent that .txt security measure by adding a nullbyte after the GET parameter(which terminates a filename), so you'll have to remove all nullbytes.[/QUOTE] Easy. $p = trim($_GET['p');
[QUOTE=Robert64;18112269]Well you could do something like this: [code]lable: sub 1; if: a = b; goto: sub 2; lable: split 1; end if; goto: sub 1; lable: sub 2; // do something goto: split 1;[/code] After going to "sub 2" it would go back to where it was in sub 1. Oh and a command I haven't used or told anyone of yet is "setvar". At the moment you can only use it to set a constant number, not, say the position of the enemy etc. Like this: [code]setvar: pies 14; if: pies / 2 = 7; // something end if;[/code] Which would do the something because 14 / 2 = 7.[/QUOTE] Alright thanks, I'm trying to make a kind of 'multi threaded' bot that will try and do more things at once.
[QUOTE=DrTaxi;18112300]Otherwise people could do stuff similar to this: [url]http://vulnerablesite.com/getfile.php?file=/etc/passwd[/url] However, you can circumvent that .txt security measure by adding a nullbyte after the GET parameter(which terminates a filename), so you'll have to remove all nullbytes.[/QUOTE] I'd just remove all non alpha-numeric characters from the argument. I looked into it a bit and I get how it all works now. The whole $_GET thing is absolutely awesome.
[QUOTE=arienh4;18112447]Easy. $p = trim($_GET['p');[/QUOTE] fileiwannaaccess\0dummydata
Or, he could use something like [url=http://templatelite.sourceforge.net/]TemplateLite[/url]?
@Jallen: What about a switch? Like... [php]switch($_GET['p']) { case 'abc': echo "abc"; break; case 'def': echo "def"; break; default: echo "The page you're looking for couldn't be found!"; break; }[/php] Atleast that's what I use for "short" urls. Oh and on top I check if $_GET['p'] is set, and if not I just set it to "news". So, if then someone trys to go to like [url]http://myurl.com/?p=stuff[/url], it gives him the error that the site could not be found. [b]Edit:[/b] How is this bad reading?
[code]<?php $page = str_replace(array(".", "\\", "/"), "", $_REQUEST['page']); if (empty($page)) { $page = "home"; } else { if (!file_exists("includes/$page.page.php")) { $page = "error"; $errno = 404; } } [/code] A snippet from my index.php.
[QUOTE=Torekk;18112972]@Jallen: What about a switch? Like... [php]switch($_GET['p']) { case 'abc': echo "abc"; break; case 'def': echo "def"; break; default: echo "The page you're looking for couldn't be found!"; break; }[/php] Atleast that's what I use for "short" urls. Oh and on top I check if $_GET['p'] is set, and if not I just set it to "news". So, if then someone trys to go to like [url]http://myurl.com/?p=stuff[/url], it gives him the error that the site could not be found. [b]Edit:[/b] How is this bad reading?[/QUOTE] been suggested twice
[QUOTE=Diaklu;18113050][code]<?php $page = str_replace(array(".", "\\", "/"), "", $_REQUEST['page']); if (empty($page)) { $page = "home"; } else { if (!file_exists("includes/$page.page.php")) { $page = "error"; $errno = 404; } } [/code] A snippet from my index.php.[/QUOTE] trim() that $_REQUEST[ "page" ] and that's pretty much what I do, adding a suffix to the file like ".page" will ensure that they just don't include any old PHP file.
[QUOTE=ThePuska;18113077]been suggested twice[/QUOTE] Where? All I see is either an if check and that you suggested an array with allowed sites, but no one mentioned switch();. Anyways, don't want to "fuck" with someone, I'll just leave it as it is. Imo switch is the easiest method.
[QUOTE=Robert64;18112387]Thanks for the info, when I port this to AS3 later I'll probably do this. I'm not sure if Alchemy will export to AS2, but I'd rather wait until this is on AS3 before I do anything too complex because this version is just a prototype more than anything else. Yup[/QUOTE] You should make a match terminate after a minute. I'm leaving the random matches running in a few tabs and I have to regularly reset them because two dumbass bots don't do anything.
[QUOTE=Torekk;18113254]Where? All I see is either an if check and that you suggested an array with allowed sites, but no one mentioned switch();. Anyways, don't want to "fuck" with someone, I'll just leave it as it is. Imo switch is the easiest method.[/QUOTE] Different approaches but they all work the same way: checking from a pre-made list, that's defined in the code, which pages are allowed and which are not. Anyone can come up with multiple ways to implement that.
Bombs completely finished. [url]http://www.robertandsherman.co.uk/botbattle/[/url] In case anyone is wondering, traps your bot lays do not affect your bot, only the enemy.
Sorry, you need to Log In to post a reply to this thread.