-
Posts
14 -
Joined
-
Last visited
Content Type
News Articles
Tutorials
Forums
Downloads
Posts posted by Ghost
-
-
Hey there, we hope you will enjoy the show
-
Haha im glad you like
If anyone is interested here is the source code for the various bits
Micro controller code (Written in C++):
#include <LiquidCrystal.h> // select the pins used on the LCD panel LiquidCrystal lcd(8, 9, 4, 5, 6, 7); int lcd_key = 0; int adc_key_in = 0; #define btnRIGHT 0 #define btnUP 1 #define btnDOWN 2 #define btnLEFT 3 #define btnSELECT 4 #define btnNONE 5 String data; // shove the raw input into here String themap; // stick the parsed map data into here String players; //stick the parsed player data into here boolean foundsplit; //record if we have found the split in the data char splitter='|'; //the char used to split the data char inData[20]; // Allocate some space for the string being read in from the serial interface char inChar; // Where to store the character read from the serial byte index = 0; // Index into array; where to store the character void setup() { // start serial port at 9600 bps: Serial.begin(9600); //set the time lcd.begin(16, 2); // start the LCD display lcd.setCursor(0,0); //set the cursor on the lcd display delay(1000); //wait a bit } void loop() { getdata(); } void getdata() { Serial.println("#S|GETMESSAGE|[]#"); //request gobetweno downloads the latest server info to the local pc. delay(1000);//wait a second just to give it time to chill. Serial.read(); //read in the status code deturned from getmessage so we dont have to bother with it later. Serial.println("#S|READMESSAG|[1]#"); //request gobetweno sends server info down the serial line delay(10000);//wait a bit again while(Serial.available() > 0) // Don't read unless there is data { if(index < 19) // One less than the size of the array { inChar = Serial.read(); // Read a character inData[index] = inChar; // Store it index++; // Increment where to write next inData[index] = '\0'; // Null terminate the string } } //Feed the chars into a string, becuase working with Char's is kinda a pain data = String(inData); //explode the data into its relevant parts, this bit is kinda rough and needs reworked for(int i=1; i<int(data.length());i++) { if(data[i] == splitter) { foundsplit=true; } if(foundsplit) { players= players+data[i+1]; } else { themap = themap + data[i]; } } //output the map and players for debugging purposes Serial.println(themap); Serial.println(players); //now to draw the info onthe display lcd.setCursor(0,0); lcd.print(themap); //the map data comes with "map: " at the start of it so we can just display it raw lcd.setCursor(0,1);//move to the bottom line lcd.print("Players: "+players); //show the current number of players on the server //go through and clear all the data from everything, ready for the next read themap=""; players=""; data=""; index = 0; foundsplit=false; for(int i=0;i<20;i++) { inData[i]=' '; } }
Server code (Written in php):
<?php /* This script incorporates a file from: http://www.gamefront.com/files/13442800/Ruckman_RCON___Quake_3 In order to provide the raw rcon functionality. */ $server=""; $port=0; $password=""; $q = new mohaa_rcon(); $result = $q -> rcon($server,$port,$password,'status'); $result = str_replace("\n","",$result ); $result = explode("ÿÿÿÿprint",$result); $output=$result[1]."|".(count($result)-6); print $output; # MEDAL OF HONOR AND QUAKE ENGINE RCON CLASS # BY WILLIAM RUCKMAN (HTTP://RUCKMAN.NET) class mohaa_rcon { function rcon ($IP, $PORT, $PASSWORD, $COMMAND) { if (!validateIpAddress($IP)) { $data = "IP Address malformed!"; return $data; } if ($PORT < 1 || $PORT > 65535 || $PORT == "") { $data = "Port range must be between 1-65535!"; return $data; } $data = ''; $fp = fsockopen('udp://'.$IP, $PORT, $errno, $errstr, 2); socket_set_timeout($fp,2); if (!$fp){ $data = "Unable to Connect! Socket Error!"; return $data; } else { $query = "\xFF\xFF\xFF\xFF\x02 rcon \"" . $PASSWORD . "\" " . $COMMAND; fwrite($fp,$query); } $data = ''; while ($d = fread ($fp, 10000)) { $data .= $d; } fclose ($fp); if ($data == "") { $data = "Connection failed, No responds from server, or changing maps."; return $data; } $data = preg_replace ("/.....print\n/", "", $data); if ($data == "") { $data = "Command sent successfully but returned no output. Possible bad command."; } return $data; } } function validateIpAddress($IP) { if(preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$IP)) { $parts=explode(".",$IP); foreach($parts as $ip_parts) { if(intval($ip_parts)>255 || intval($ip_parts)<0) return false; } return true; } else return false; } ?>
At the moment im trying to get the code on the Arduino that processes the incoming data to be a little more robust since it still falls down alot at the moment
Caelum likes this -
You know what this site really needs? Embedded midi!
-
Since work was quiet today I ended up making THIS!
I stuck a little LCD display onto an Arduino micro controller so that I could be obsessive compulsive about checking the server is still running and how popular it is without having to constantly be switching windows
Its still quite rough but it works as a proof of concept, currently there is a PHP script that Rcon's into my jka server and runs a status command then takes in what it gets back and processes it to make it more compact then this is picked up by gobetwino which is used to send the data on down the serial line where it is then displayed by the Arduino. Given the number of buttons I have on the controller the next logical step it seems to me would be to be able to browse through a list of players on the server and use admin commands on them from it as well MWAHAHA
-
I checked out your forums earlier, Sir, and I am appalled at the average signature size of the members and forum users.
Most atrocious. -Storms off-
Its all part of my dastardly plan, the truth is everyone in KAS has been complaining about me for years, its just nobody can see their messages because they are swamped by their massive signatures.
"CAN YOU DO THINGS?"
Yes, yes I can
Im this guy on jk3files: http://jediknight3.filefront.com/developer/cloudflint;29855 Ive done quite alot of other bits and bobs since then but with jk3files being all screwed up haven't been able to properly release most of it. I should say that looking at those files im appalled at how unskilled I was back then but I suppose we all have to start somewhere
I also run a web development/programming/engineering company and make a mean tortia.
Hey Ghost, I don't think we've met before although I have seen KAS members hang around sometimes on JAWA.
Nice to meet you
Nice to meet you too, we have spoken briefly I think via email about you guys bringing over my files from filefront, Im looking forward to having a website that actually functions to host mods on
To everyone else, hello!
MUG likes this -
Well mil posting his new comic reminded me that this website existed after him showing it to me ages ago
For those who don't know me im the current leader of the Knights of the Azure Sky (Thats the KAS listed in the hybrid section of this website.)
The Knights of the Azure Sky
in Communities
Posted
Are you looking for a fun, friendly clan who manage a careful balance of fun and competitive play? Do you want somewhere to hang while you try to find such a clan? Then join the Knights of the Azure Sky today!
Join our clan today for such great features as:
Two divisions to choose from, now YOU have the power to choose what admins use their power to slap you up!
A community that will treat you like family! A family we who loathes and despises each other!
A proud 4 year history!
A captain Commander who insists on making sarcastic and often wildly inaccurate recruiting posters!
Members who don't take themselves to seriously! Except when they do in which case we actually do quite well in TFFA's
Still not sure if you want to join? Why not come hang on one of our servers!
Or visit our website!
Or visit us under groups >> hybrid in the JKHub bar!