Blockland Forums > Modification Help
TCP Objects
jes00:
--- Quote from: Fluff-is-back on April 16, 2012, 02:31:46 PM ---Post your code
--- End quote ---
--- Code: ---package Translator
{
function translate(%msg)
{
%obj = new TCPObject(TimeCheck);
%obj.connect("translate.google.com/#auto|en|" @ strReplace(%msg, " ", "%20"));
}
function Translate::onLine(%this, %line)
{
if(%line !$= "")
{
//Do stuff
}
}
function Translate::onDisconnect(%this)
{
%this.delete();
}
};
activatePackage(Translator);
--- End code ---
Nexus:
you are supposed to do %obj.connect("google.com:80");
then have
Translate::onconnected(%this)
{
%this.send("GET" ...) erm I am not sure exactly what file you want to fetch, so yea
}
The way you are doing it, you may have more luck with http objects
Ipquarx:
--- Quote from: Nexus on April 16, 2012, 04:16:03 PM ---The way you are doing it, you may have more luck with http objects
--- End quote ---
google translate uses multiple arguments/parameters.
--- Quote from: Fluff-is-back on April 05, 2012, 06:32:53 AM ---HTTPObjects do not support multiple parameters.
--- End quote ---
jes00:
--- Quote from: Nexus on April 16, 2012, 04:16:03 PM ---you are supposed to do %obj.connect("google.com:80");
then have
Translate::onconnected(%this)
{
%this.send("GET" ...) erm I am not sure exactly what file you want to fetch, so yea
}
The way you are doing it, you may have more luck with http objects
--- End quote ---
But I don't want to connect to google, I want to connect to google translator.
Could you tell me more about this %this.send?
Ipquarx:
--- Quote from: jes00 on April 16, 2012, 05:24:54 PM ---I don't want to connect to google, I want to connect to google.
--- End quote ---
What? I'm not understanding this.
Google translate is part of google, if your connecting to google translate, you're connecting to google.